fscRead: Read fastsimcoal output

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

Description

Read arlequin formatted output or parameter estimation files generated by fastsimcoal

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
fscReadArp(
  p,
  sim = c(1, 1),
  marker = c("all", "snp", "microsat", "dna", "standard"),
  chrom = NULL,
  sep.chrom = FALSE,
  drop.mono = FALSE,
  as.genotypes = TRUE,
  one.col = FALSE,
  sep = "/",
  coded.snps = FALSE
)

fscReadParamEst(p)

fscReadSFS(p, sim = 1)

Arguments

p

list of fastsimcoal input parameters.

sim

one or two-element numberic vector giving the number of the simulation replicate (and sub-replicate) to read. For example, sim = c(3, 5) will attempt to read "<label>_3_5.arp".

marker

type of marker to return.

chrom

numerical vector giving chromosomes to return. If NULL all chromosomes are returned.

sep.chrom

return a list of separate chromosomes?

drop.mono

return only polymorphic loci?

as.genotypes

return data as genotypes? If FALSE, original haploid data is returned. If TRUE, individuals are created by combining sequential haplotypes based on the ploidy used to run the simulation.

one.col

return genotypes with one column per locus? If FALSE, alleles are split into separate columns and designated as ".1", ".2", etc. for each locus.

sep

character to use to separate alleles if one.col = TRUE.

coded.snps

return diploid SNPs coded as 0 (major allele homozygote), 1 (heterozygote), or 2 (minor allele homozygote). If this is TRUE and marker = "snp" (or only SNPs are present) and the data is diploid, genotypes will be returned with one column per locus.

Value

fscReadArp

Reads and parses Arlequin-formatted .arp output files created by fastsimcoal2. Returns a data frame of genotypes, with individuals created by combining haplotypes based on the stored value of ploidy specified when the simulation was run.

fscReadParamEst

Reads and parses files output from a fastsimcoal2 run conducted for parameter estimation. Returns a list of data frames and vectors containing the data from each file.

fscReadSFS

Reads site frequency spectra generated from fastsimcoal2. Returns a list of the marginal and joint SFS, the polymorphic sites, and the estimated maximum likelihood of the SFS."

Note

fastsimcoal2 is not included with 'strataG' and must be downloaded separately. Additionally, it must be installed such that it can be run from the command line in the current working directory. The function fscTutorial() will open a detailed tutorial on the interface in your web browser.

Author(s)

Eric Archer eric.archer@noaa.gov

References

Excoffier, L. and Foll, M (2011) fastsimcoal: a continuous-time coalescent simulator of genomic diversity under arbitrarily complex evolutionary scenarios Bioinformatics 27: 1332-1334.
Excoffier, L., Dupanloup, I., Huerta-Sánchez, E., Sousa, V.C., and M. Foll (2013) Robust demographic inference from genomic and SNP data. PLOS Genetics, 9(10):e1003905.
http://cmpg.unibe.ch/software/fastsimcoal2/

See Also

fsc.input, fscWrite, fscRun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
#' # three demes with optional names
demes <- fscSettingsDemes(
  Large = fscDeme(10000, 10), 
  Small = fscDeme(2500, 10),
  Medium = fscDeme(5000, 3, 1500)
)

# four historic events
events <- fscSettingsEvents(
  fscEvent(event.time = 2000, source = 1, sink = 2, prop.migrants = 0.05),
  fscEvent(2980, 1, 1, 0, 0.04),
  fscEvent(3000, 1, 0),
  fscEvent(15000, 0, 2, new.size = 3)
 )
 
# four genetic blocks of different types on three chromosomes.  
genetics <- fscSettingsGenetics(
  fscBlock_snp(10, 1e-6, chromosome = 1),
  fscBlock_dna(10, 1e-5, chromosome = 1),
  fscBlock_microsat(3, 1e-4, chromosome = 2),
  fscBlock_standard(5, 1e-3, chromosome = 3)
)

params <- fscWrite(demes = demes, events = events, genetics = genetics)

# runs 100 replicates, converting all DNA sequences to 0/1 SNPs
# will also output the MAF site frequency spectra (SFS) for all SNP loci.
params <- fscRun(params, num.sim = 100, dna.to.snp = TRUE, num.cores = 3)

# extracting only microsattelite loci from simulation replicate 1
msats <- fscReadArp(params, marker = "microsat")

# read SNPs from simulation replicate 5 with genotypes coded as 0/1
snp.5 <- fscReadArp(params, sim = 1, marker = "snp", coded.snps = TRUE

# read SFS for simulation 20
sfs.20 <- fscReadSFS(params, sim = 20)

## End(Not run)

strataG documentation built on Feb. 28, 2020, 9:07 a.m.