View source: R/genoprob_to_snpprob.R
genoprob_to_snpprob | R Documentation |
For multi-parent populations, convert use founder genotypes at a set of SNPs to convert founder-based genotype probabilities to SNP genotype probabilities.
genoprob_to_snpprob(genoprobs, snpinfo)
genoprobs |
Genotype probabilities as
calculated by |
snpinfo |
Data frame with SNP information with the following
columns (the last three are generally derived with
Alternatively, |
We first split the SNPs by chromosome and use
snpinfo$index
to subset to non-equivalent SNPs.
snpinfo$interval
indicates the intervals in the genotype
probabilities that contain each. For SNPs contained within an
interval, we use the average of the probabilities for the two
endpoints. We then collapse the probabilities according to the
strain distribution pattern.
An object of class "calc_genoprob"
, like the input genoprobs
,
but with imputed genotype probabilities at the selected SNPs indicated in
snpinfo$index
. See calc_genoprob()
.
If the input genoprobs
is for allele probabilities, the
probs
output has just two probability columns (for the two SNP
alleles). If the input has a full set of n(n+1)/2
probabilities for n
strains, the probs
output has 3 probabilities
(for the three SNP genotypes). If the input has full genotype
probabilities for the X chromosome (n(n+1)/2
genotypes for
the females followed by n
hemizygous genotypes for the
males), the output has 5 probabilities: the 3 female SNP genotypes
followed by the two male hemizygous SNP genotypes.
index_snps()
, calc_genoprob()
, scan1snps()
## Not run:
# load example data and calculate genotype probabilities
file <- paste0("https://raw.githubusercontent.com/rqtl/",
"qtl2data/main/DO_Recla/recla.zip")
recla <- read_cross2(file)
recla <- recla[c(1:2,53:54), c("19","X")] # subset to 4 mice and 2 chromosomes
probs <- calc_genoprob(recla, error_prob=0.002)
# founder genotypes for a set of SNPs
snpgeno <- rbind(m1=c(3,1,1,3,1,1,1,1),
m2=c(1,3,1,3,1,3,1,3),
m3=c(1,1,1,1,3,3,3,3),
m4=c(1,3,1,3,1,3,1,3))
sdp <- calc_sdp(snpgeno)
snpinfo <- data.frame(chr=c("19", "19", "X", "X"),
pos=c(40.36, 40.53, 110.91, 111.21),
sdp=sdp,
snp=c("m1", "m2", "m3", "m4"), stringsAsFactors=FALSE)
# identify groups of equivalent SNPs
snpinfo <- index_snps(recla$pmap, snpinfo)
# collapse to SNP genotype probabilities
snpprobs <- genoprob_to_snpprob(probs, snpinfo)
# could also first convert to allele probs
aprobs <- genoprob_to_alleleprob(probs)
snpaprobs <- genoprob_to_snpprob(aprobs, snpinfo)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.