Description Usage Arguments Value Note See Also Examples
View source: R/inject-errors.r
Takes a geno_table
object and injects a total of
perr errors with a concentration-dependent rate described
by a cumulative distribution functions, cdf, using the
probability calculation described in loose_eag
..
1 | inject_errors(x, cdf, perr, odds = 1)
|
x |
A |
cdf |
A cumulative distribution function describing a DNA-concentration-
dependent error rate. See |
perr |
The overall error rate. |
odds |
The odds of loosing an EAG on exon 2 or exon 3, respectively.
E.g. |
A geno_table
object with attribute has_errors = TRUE
.
The next step is to map genotype frequencies onto the sampled
genotypes: map_genotype_frequencies
.
Other simulation.functions: make_genotype_sampler
,
map_genotype_frequencies
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 | ## Not run:
## Extract HLA-DPB1 genotype frequencies
dpb1 <- HLA("DPB1", "01/01/2014", "23/03/2015")
## Restrict the data to the German sample
dpb1.de <- dpb1[provenance == "DE"]
## Generate an EAG table
dpb1_eag1412 <- eag_table(gene = "DPB1", nextype_basis_id = "1412")
## Generate a distribution of DNA concentrations
conc <- sample_dna_concentration(dpb1.de, n = 1000, ncores = 8)
## Generate a sampling function
sample_dpb1_de <- make_genotype_sampler(dpb1.de, eag_1267)
## Load precomputed DNA-concentration-dependent error distribution for HLA-A
data(cdfA)
## Sample genotypes
n <- 10000
bin_size <- 3
perr <- 0.01
odds <- 0.25
ans <- sample_dpb1_de(conc, n, bin_size) %>%
inject_errors(cdfA, perr, odds)
ans
summary(ans)
samples(ans)
errors(ans)
merge(ans)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.