Run STACKS sstacks module inside R! Inside the P folder (where the ustacks and the cstacks files are), you should have:

  • 3 Catalog files: the files created in cstacks and usually looking like this: batch_1.catalog.alleles.tsv.gz, batch_1.catalog.snps.tsv.gz, batch_1.catalog.tags.tsv.gz

  • 3 files for each samples: The sample name is the prefix of the files ending with: .alleles.tsv.gz, .snps.tsv.gz, .tags.tsv.gz. Those files are created in the ustacks module.

run_sstacks(
  P = "06_ustacks_2_gstacks",
  M = NULL,
  sample.list = NULL,
  c = "06_ustacks_2_gstacks",
  parallel.core = parallel::detectCores() - 1,
  o = "06_ustacks_2_gstacks",
  x = FALSE,
  disable.gapped = FALSE,
  v = FALSE,
  h = FALSE
)

Arguments

P

(character) Path to the directory containing STACKS files. Contrary to sstacks, this argument can be use with sample.list (the s in sstacks) Default: P = "06_ustacks_2_gstacks".

M

(character) Path to a population map file from which to take sample names (this argument won't work if sample.list). Advice: don't modify the default (please see details). Default: M = NULL.

sample.list

This is for the s option in sstacks. s: Filename prefix from which to load sample loci. Here, you have 2 choices: 1. you leave empty and let the function use the default:sample.list = NULL which will scan for the files in the P folder given above. 2. you supply a character string of the samples. This could come from the INDIVIDUALS_REP column of the project info file, e.g. sample.list = project.info$INDIVIDUALS_REP. (Please see details).

c

(character, path) Path to the catalog. Default: c = "06_ustacks_2_gstacks"

parallel.core

(Integer) Enable parallel execution with num_threads threads. Default: parallel.core = parallel::detectCores() - 1

o

output path to write results. Default: o = "06_ustacks_2_gstacks"

x

Don't verify haplotype of matching locus. Default: x = FALSE

disable.gapped

Disable gapped alignments between stacks. Default: disable.gapped = FALSE (use gapped alignments).

v

Print program version. Default: v = FALSE

h

Display this help messsage. Default: h = FALSE

Value

sstacks returns a .matches.tsv.gz file for each sample. If lnl_dist = TRUE, the function will also return a summary of catalog loci log-likelihood.

Details

Computer or server problem during the sstacks ? Just launch again the same command, the function will start again, but only with the unmatched samples!

Some argument can't be use together:

Don't use these arguments together: M and sample.list/c. You can't add samples to an existing catalog using a population map. If you want to match new samples to an existing catalog, very easy, just add the samples in the folder and let run_sstacks function find the samples that were not matched to the catalog.

References

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.

See also

Examples