hybridize           package:adegenet           R Documentation(utf8)

_S_i_m_u_l_a_t_e_d _h_y_b_r_i_d_i_z_a_t_i_o_n _b_e_t_w_e_e_n _t_w_o _s_a_m_p_l_e_s _o_f _p_o_p_u_l_a_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     The function 'hybridize' performs hybridization between two set of
     genotypes stored in genind objects (referred as the "2
     populations"). Allelic frequencies are derived for each
     population, and then gametes are sampled following a multinomial
     distribution. 

     The result consists in a set of 'n' genotypes, with different
     possible outputs (see 'res.type' argument).

_U_s_a_g_e:

     hybridize(x1, x2, n, pop=NULL, res.type=c("genind","df","STRUCTURE"), file=NULL,
       quiet=FALSE, sep="/", hyb.label="h")

_A_r_g_u_m_e_n_t_s:

      x1: a genind object

      x2: a genind object

       n: an integer giving the number of hybrids requested

     pop: a character string giving naming the population of the
          created hybrids. If NULL, will have the form "x1-x2"

res.type: a character giving the type of output requested. Must be
          "genind" (default), "df" (i.e. data.frame like in
          'genind2df'), or "STRUCTURE" to generate a .str file readable
          by STRUCTURE (in which case the 'file' must be supplied). See
          'details' for STRUCTURE output.

    file: a character giving the name of the file to be written when
          'res.type' is "STRUCTURE"; if NULL, a the created file is of
          the form "hybrids_[the current date].str".

   quiet: a logical specifying whether the writing to a file (when
          'res.type' is "STRUCTURE") should be announced (FALSE,
          default) or not (TRUE).

     sep: a character used to separate two alleles

hyb.label: a character string used to construct the hybrids labels; by
          default, "h", which gives labels: "h01", "h02", "h03",...

_D_e_t_a_i_l_s:

     If the output is a STRUCTURE file, this file will have the
     following caracteristics:
      - file contains the genotypes of the parents, and then the
     genotypes of hybrids
      - the first column identifies genotypes
      - the second column identifies the population (1 and 2 for
     parents x1 and x2; 3 for hybrids)
      - the first line contains the names of the markers
      - one row = one genotype (onerowperind will be true)
      - missing values coded by "-9" (the software's default)

_V_a_l_u_e:

     A genind object (by default), or a data.frame of alleles
     (res.type="df"). No R output if res.type="STRUCTURE" (results
     written to the specified file).

_A_u_t_h_o_r(_s):

     Thibaut Jombart t.jombart@imperial.ac.uk

_E_x_a_m_p_l_e_s:

     ## Let's make some cattle hybrids
     ##
     data(microbov)

     ## first, isolate each breed
     temp <- seppop(microbov)
     names(temp)

     salers <- temp$Salers
     zebu <- temp$Zebu
     borgou <- temp$Borgou
     somba <- temp$Somba

     ## let's make some... Zeblers
     zebler <- hybridize(salers, zebu, n=40)

     ## and some Somgou
     somgou <- hybridize(somba, borgou, n=40)

     ## now let's merge all data into a single genind
     newDat <- repool(microbov, zebler, somgou)

     ## make a correspondance analysis
     ## and see where hybrids are placed
     if(require(ade4)){
     X <- genind2genpop(newDat,missing="chi2",quiet=TRUE)
     coa1 <- dudi.coa(as.data.frame(X$tab),scannf=FALSE,nf=3)
     s.label(coa1$li,label=X$pop.names)
     add.scatter.eig(coa1$eig,2,1,2)
     }

