vcf2impostar: Convert VCF to impostar format

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function reformats a VCF file into the format required by impostar functions runLogRegTest and runAMOVA

Usage

1
vcf2impostar(vcfFile="filename", designFile=NULL, ploidy=2, savecsv=FALSE)

Arguments

vcfFile

a character string indicating the vcf file you want to convert to impostar format. Required.

designFile

a character string indicating the design file, which contains the number of indiviudals in each pool. Only required for pools. Default is NULL and should be left this way for individuals. The file can be .csv or .txt (tab-delimited)

ploidy

a numeric indicating the ploidy of the focal organism. Default is 2. Note for pooled datasets: ploidy should be set to the ploidy of a single organism, the number of alleles included in a pool should be indicated in the designFile.

savecsv

a logical indicating if you want to save the output as a csv file. If FALSE (default), the output will only be stored as an R object.

Value

The vcf2impostar function returns a dataframe and optional csv file written to the working directory. The dataframe contains a row for each SNP locus and columns containing a unique name for each SNP based on its sequence location (snpID), reference allelic state (REF), alternate allelic state (ALT), reference reads (RD), alternate reads (AD), total read depth (DP), and total number of alleles (2n, TotAlleles) per individual or pool (as indicated by sequential numbers in the column names).

Author(s)

Rebecca M. Hamner

References

Hamner, R.M., J.D. Selwyn, E. Krell, S.A. King, and C.E. Bird. In review. Modeling next-generation sequencer sampling error in pooled population samples dramatically reduces false positives in genetic structure tests.

See Also

runLogRegTest, runAMOVA

Examples

1
2
3
4
5
6
7
8
# load example vcf file
myvcfFile <- impostar::: exVCF
# generate an example designFile
designFile <- data.frame(n=rep(20,6), Sample=c(seq(1:6)), Region=c(1,1,2,2,3,3))
# run vcf2impostar format converter
data.impostar <- vcf2impostar(vcfFile = vcfFile, designFile = designFile, ploidy = 2, savecsv = FALSE)
# to feed it directly into runAMOVA
testAMOVA <- runAMOVA(designFile = designFile, dataFile = data.impostar, NresamplesToStop = 5, maxPermutations = 10)

cbirdlab/impostar documentation built on June 1, 2019, 7:08 p.m.