Description Usage Arguments Details Value Note Author(s) Examples
An uncertain SNP genotype call is represented by the three posterior
probabilities of the three possible calls. In the class
SnpMatrix
, an approximation to these is packed into a single
1-byte variable of type raw
. These functions carry out this coding (and
decoding).
1 2 3 |
p |
A matrix of posterior probabilities. If |
m |
A vector of posterior means |
g |
A |
transpose |
A logical flag indicating transposition of the matric of posterior probabilities (see Description) |
maxE |
A logical flag selecting the maximum entropy option in
|
post2g
and g2post
convert from posterior probabilities to
raw
code and back respectively. If only the posterior expectation
of the genotype (when numerically coded 0, 1, or 2) is available, no
unique soultion exists in general and the behaviour of the function is
determined by the value of maxE
. If TRUE
, then the maximum
entropy solutions are returned while, if FALSE
, an attempt is made
to return the least uncertain solution, by setting the posterior
probability of the BB
genotype to zero when the posterior mean is
less than 1.0 and the probability of AA
to zero when the mean is
greater than 1.0.
post2g
and mean2g
return a vector of type
raw
. g2post
returns a numeric matrix.
These functions are provided mainly for users wishing to write their own data input functions.
David Clayton dc208@cam.ac.uk
1 2 3 4 5 6 7 8 9 | data(testdata)
g <- Autosomes[1:10, 20] ## A vector of codes
p <- g2post(g) ## Transform to probabilities ...
pg <- post2g(p) ## ... and back to codes
m <- p[,2]+2*p[,3] ## Posterior expectations
mg <- mean2g(m) ## Transform to codes ...
pmg <- g2post(mg) ## ... and transform to probabilities
## Write everything out
print(cbind(as(g, "numeric"), p, as.numeric(pg), m, as.numeric(mg), pmg))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.