fb_diploid: Inferring hidden ancestry states from diploids

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

Description

Uses the forward-backward algorithm to estimate ancestry along a given chromosome for a given genotyped diploid.

Usage

1
fb_diploid(snp_locations, p0, p1, p_assign, scale)

Arguments

snp_locations

a numeric vector specifying the locations of each snp (in bps). This vector is assumed to be ordered (sorted from smallest to largest snp).

p0

a vector specifying the number of reads that mapped to parent 0. p0 is assumed to be in the smae order as snp_locations.

p1

a vector specifying the number of reads that mapped to parent 1. p1 is assumed to be in the smae order as snp_locations.

p_assign

a value specifying the assignment probabilty (see details).

scale

a numeric specifying the the genome-wide recombination rate (Morgans / bp). scale is assumed to be between 0 and 1 but in practice it is usually quite small.

Details

This is an extension of fb_haploid with three hidden states: two homozygous states and a heterozygous state.

Value

a dataframe with the following columns:

Author(s)

Tyler D. Hether

References

Hether, T.D., C. G. Wiench1, and P.A. Hohenlohe (in review). 2015. Novel molecular and analytical tools for efficient estimation of rates of meiotic crossover, non-crossover and gene conversion

Drubin, R. S. Eddy, A. Krogh, and G. Mitchison. 1998. Biological Sequence Analysis: Probabilistic Models of proteins and nucleic acids. Cambridge University Press, Cambridge CB2 8RU, UK.

See Also

fb_haploid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
set.seed(1234567)        # For reproducibility
n_spores <- 1            # number of spores
l <- 75                  # number of snps to simulate
c <- 3.5e-05             # recombination rate between snps (Morgan/bp)
snps <- c(1:l)*1.3e4     # snps are evenly spaced 20kbp apart
p_a <- 0.95              # assignment probability
coverage <- 2.1          # mean coverage
# Now simulate two haploids
sim1 <- sim_en_masse(n.spores=n_spores, scale=c, snps=snps,
 p.assign=p_a, mu.rate=0, f.cross=0.8, f.convert=0.3,
 length.conversion=2e3, coverage=coverage)
sim2 <- sim_en_masse(n.spores=n_spores, scale=c, snps=snps,
 p.assign=p_a, mu.rate=0, f.cross=0.8, f.convert=0.3,
 length.conversion=2e3, coverage=coverage)
# Now merge the two haploids to make a diploid
p0 <- sim1$p0+sim2$p0
p1 <- sim1$p1+sim2$p1
res <- fb_diploid(snp_locations=sim1$Snp, p0=p0, p1=p1, p_assign=p_a, scale=c)
res

tylerhether/fbgenotyper documentation built on May 3, 2019, 1:53 p.m.