Run STACKS populations module inside R!
run_populations( P = "06_ustacks_2_gstacks", V = NULL, O = "07_populations", M, parallel.core = parallel::detectCores() - 1, batch.size = 10000, p = 1, r = 0.3, R = 0.3, H = TRUE, min.maf = NULL, min.mac = NULL, max.obs.het = NULL, write.single.snp = FALSE, write.random.snp = FALSE, B = NULL, W = NULL, e = NULL, merge.sites = FALSE, merge.prune.lim = NULL, hwe = FALSE, fstats = FALSE, fst.correction = NULL, p.value.cutoff = 0.05, k = FALSE, smooth.fstats = FALSE, smooth.popstats = FALSE, sigma = 150000, bootstrap = FALSE, N = 100, bootstrap.pifis = FALSE, bootstrap.fst = FALSE, bootstrap.div = FALSE, bootstrap.phist = FALSE, bootstrap.wl = NULL, ordered.export = FALSE, fasta.samples = TRUE, fasta.samples_raw = FALSE, fasta.loci = TRUE, vcf = TRUE, genepop = FALSE, structure = FALSE, radpainter = FALSE, phase = FALSE, fastphase = FALSE, plink = FALSE, hzar = FALSE, phylip = FALSE, phylip.var = FALSE, phylip.var.all = FALSE, treemix = FALSE, no.hap.exports = FALSE, h = FALSE, verbose = FALSE, v = FALSE, log.fst.comp = FALSE )
P | (path, character) Path to the directory containing all the STACKS files.
Default: |
---|---|
V | (character) Path to an input VCF file. When this module is used to
filter an existing vcf file.
Default: |
O | (character) Path to a directory where to write the output files.
With default: |
M | path to a population map file. The format is a tab-separated file,
with first column containing sample name and second column population id.
No heather (column name).
e.g. |
parallel.core | (integer) enable parallel execution with num_threads threads.
Default: |
batch.size | (integer) The number of loci (de novo mode) or
chromosome (reference mode), to process in a batch.
Increase to speed analysis, uses more memory, decrease to save memory).
Default in de novo mode (loci/batch): |
p | (integer) Minimum number of populations a locus must be present in to process a locus.
Default: |
r | (double) Minimum percentage of individuals in a population required to process a locus for that population.
Default: |
R | (double) Minimum percentage of individuals across populations required to process a locus.
Default: |
H | (logical) Apply the above filters haplotype wise
(unshared SNPs will be pruned to reduce haplotype-wise missing data).
Default: |
min.maf | (double) Specify a minimum minor allele frequency required to process a nucleotide site at a locus (0 < min.maf < 0.5).
Default: |
min.mac | (integer) Specify a minimum minor allele count required to process a nucleotide site at a locus.
Default: |
max.obs.het | (double) Specify a maximum observed heterozygosity required to process a nucleotide site at a locus.
Default: |
write.single.snp | (logical) Restrict data analysis to only the first SNP per locus (implies --no-haps).
Default: |
write.random.snp | (logical) Restrict data analysis to one random SNP per locus (implies --no-haps).
Default: |
B | (character) Path to a file containing Blacklisted markers to be excluded from the export.
Default: |
W | (character) Path to a file containing Whitelisted markers to include in the export.
Default: |
e | (character) Restriction enzyme name.
Default: |
merge.sites | (logical) Merge loci that were produced from the same restriction enzyme cutsite (requires reference-aligned data).
Default: |
merge.prune.lim | (integer) When merging adjacent loci, if at least X
Default: |
hwe | (logical) Calculate divergence from Hardy-Weinberg equilibrium
using the exact test at the SNP level and Guo and Thompson MCMC algorithm at
the haplotype level.
Default: |
fstats | (logical) Enable SNP and haplotype-based F statistics.
Default: |
fst.correction | (character) Specify a correction to be applied to Fst values: 'p_value', 'bonferroni_win', or 'bonferroni_gen'.
Default: |
p.value.cutoff | (double) maximum p-value to keep an Fst measurement.
Also used as base for Bonferroni correction.
Default: |
k | (logical) Enable kernel-smoothed Pi, Fis, Fst, Fst', and Phi_st calculations.
Default: |
smooth.fstats | (logical) Enable kernel-smoothed Fst, Fst', and Phi_st calculations.
Default: |
smooth.popstats | (logical) Enable kernel-smoothed Pi and Fis calculations.
Default: |
sigma | (integer) Standard deviation of the kernel smoothing weight distribution.
Default: |
bootstrap | (logical) Turn on boostrap resampling for all smoothed statistics.
Default: |
N | (integer) Number of bootstrap resamplings to calculate.
Default: |
bootstrap.pifis | (logical) Turn on boostrap resampling for smoothed SNP-based Pi and Fis calculations.
Default: |
bootstrap.fst | (logical) Turn on boostrap resampling for smoothed Fst calculations based on pairwise population comparison of SNPs.
Default: |
bootstrap.div | (logical) Turn on boostrap resampling for smoothed haplotype diveristy and gene diversity calculations based on haplotypes.
Default: |
bootstrap.phist | (logical) Turn on boostrap resampling for smoothed Phi_st calculations based on haplotypes.
Default: |
bootstrap.wl | (character) Path to a whitelist file. Only use bootstrap loci contained in this whitelist.
Default: |
ordered.export | (logical) If data is reference aligned, exports will be ordered; only a single representative of each overlapping site.
Default: |
fasta.samples | (logical) Output the sequences of the two haplotypes of each (diploid) sample, for each locus, in FASTA format.
stackr default is different than stacks default because I think having this info helps to identify problems.
Default: |
fasta.samples_raw | (logical) Output all haplotypes observed in each sample, for each locus, in FASTA format.
Default: |
fasta.loci | (logical) Output consensus sequences of all loci, in FASTA format.
stackr default is different than stacks default because I think having this info helps to identify problems.
Default: |
vcf | (logical) Output SNPs in Variant Call Format (VCF).
Default: |
genepop | (logical) Output results in GenePop format.
Default: |
structure | (logical) Output results in Structure format.
Default: |
radpainter | (logical) Output results results in fineRADstructure/RADpainter format.
Default: |
phase | (logical) Output genotypes in PHASE format.
Default: |
fastphase | (logical) Output genotypes in fastPHASE format.
Default: |
plink | (logical) Output genotypes in PLINK format.
Default: |
hzar | (logical) Output genotypes in Hybrid Zone Analysis using R (HZAR) format.
Default: |
phylip | (logical) Output nucleotides that are fixed-within, and variant among populations in Phylip format for phylogenetic tree construction.
Default: |
phylip.var | (logical) Include variable sites in the phylip output encoded using IUPAC notation.
Default: |
phylip.var.all | (logical) Include all sequence as well as variable sites in the phylip output encoded using IUPAC notation.
Default: |
treemix | (logical) Output SNPs in a format useable for the TreeMix program (Pickrell and Pritchard).
Default: |
no.hap.exports | (logical) Omit haplotype outputs.
Default: |
h | Display this help messsage.
Default: |
verbose | turn on additional logging.
Default: |
v | print program version.
Default: |
log.fst.comp | (logical) Log components of Fst/Phi_st calculations to a file.
Default: |
populations returns different output depending on arguments selected.
Catchen JM, Amores A, Hohenlohe PA et al. (2011) Stacks: Building and Genotyping Loci De Novo From Short-Read Sequences. G3, 1, 171-182.
Catchen JM, Hohenlohe PA, Bassham S, Amores A, Cresko WA (2013) Stacks: an analysis tool set for population genomics. Molecular Ecology, 22, 3124-3140.
Guo SW, Thompson EA (1992) Performing the exact test of Hardy-Weinberg proportion for multiple alleles. Biometrics, 48, 361-372.
if (FALSE) { pop <- stackr::run_populations(M = "population.map.tsv") }