genobaypass2countdata: Convert BayPass allele count input files into a coundata...

View source: R/genobaypass2countdata.R

genobaypass2countdataR Documentation

Convert BayPass allele count input files into a coundata object

Description

Convert BayPass allele count input files into a coundata object

Usage

genobaypass2countdata(
  genobaypass.file = "",
  snp.pos = NA,
  popnames = NA,
  min.indgeno.per.pop = -1,
  min.maf = -1,
  verbose = TRUE
)

Arguments

genobaypass.file

The name (or a path) of the BayPass allele count file (see the BayPass manual https://forgemia.inra.fr/mathieu.gautier/baypass_public/)

snp.pos

An optional two column matrix with nsnps rows containing the chromosome (or contig/scaffold) of origin and the position of each markers

popnames

A character vector with the names of pool

min.indgeno.per.pop

Minimal number of overall counts required in each population. If at least one pop is not genotyped for at least min.indgeno.per.pop (haploid) individual, the position is discarded

min.maf

Minimal allowed Minor Allele Frequency (computed from the ratio overall counts for the reference allele over the overall number of (haploid) individual genotyped)

verbose

If TRUE extra information is printed on the terminal

Details

Information on SNP position is only required for some graphical display or to carried out block-jacknife sampling estimation of confidence intervals. If no mapping information is given (default), SNPs will be assumed to be ordered on the same chromosome and separated by 1 bp. As blocks are defined with a number of consecutive SNPs (rather than a length), the latter assumption has actually no effect (except in the reported estimated block sizes in Mb).

Value

A countdata object containing 6 elements:

  1. "refallele.count": a matrix (nsnp rows and npops columns) with the allele counts for the reference allele

  2. "total.count": a matrix (nsnp rows and npops columns) with the total number of counts (i.e., twice the number of genotyped individual for diploid species and autosomal markers)

  3. "snp.info": a matrix with nsnp rows and four columns containing respectively the contig (or chromosome) name (1st column) and position (2nd column) of the SNP; the allele taken as reference in the refallele.count matrix (3rd column); and the alternative allele (4th column)

  4. "popnames": a vector of length npops containing the names of the pops

  5. "nsnp": a scalar corresponding to the number of SNPs

  6. "npops": a scalar corresponding to the number of populations

Examples

 make.example.files(writing.dir=tempdir())
 pooldata=popsync2pooldata(sync.file=paste0(tempdir(),"/ex.sync.gz"),poolsizes=rep(50,15))
 pooldata2genobaypass(pooldata=pooldata,writing.dir=tempdir())
 ##NOTE: This example is just for the sake of illustration as it amounts 
 ##to interpret read count as allele count which must not be done in practice!
 countdata=genobaypass2countdata(genobaypass.file=paste0(tempdir(),"/genobaypass")) 

poolfstat documentation built on Sept. 8, 2023, 5:49 p.m.