Description Usage Arguments Value Note Author(s) See Also Examples
calcKL
takes in an object that inherits from
SequenceSummary
that has a kmers slot, and returns the terms of
the K-L divergence sum (which correspond to items in the sample space,
in this case, k-mers).
1 | calcKL(x)
|
x |
an S4 object a class that inherits from |
calcKL
returns a data.frame
with columns:
kmer |
the k-mer sequence. |
position |
the position in the read. |
kl |
the K-L term for this k-mer in the K-L sum, calculated as p(i)*log2(p(i)/q(i)). |
p |
the probability for this k-mer, at this position. |
q |
the probability for this k-mer across all positions. |
The K-L divergence calculation in calcKL
uses base 2 in the
log; the units are in bits.
Vince Buffalo <vsbuffalo@ucdavis.edu>
1 2 3 4 5 6 7 8 9 10 11 | ## Load a somewhat contaminated FASTQ file
s.fastq <- readSeqFile(system.file('extdata', 'test.fastq',
package='qrqc'), hash.prop=1)
## As with getQual, this function is provided so custom graphics can
## be made easily. For example K-L divergence by position:
kld <- with(calcKL(s.fastq), aggregate(kl, list(position),
sum))
colnames(kld) <- c("position", "KL")
p <- ggplot(kld) + geom_line(aes(x=position, y=KL), color="blue")
p + scale_y_continuous("K-L divergence")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.