Function
calculateVariance
Calculates the variance for the number of word occurrences of a word in a sequence of length n given a background model.
calculateVariance(variance, word, backgroundFrequencies, n)
calculateVariance(variance, word, bgModel, n)
seqan/alignment_free.h
Parameters
 variance Variance of the number of occurrences of the word in a sequence of length n given the modelTypes: double word Usually a DNA sequenceTypes: String backgroundFrequencies String of background frequencies representing the modelTypes: double bgModel Markov modelTypes: MarkovModel n Length of the sequence where the occurrences of word are countedTypes: integer
Remarks
Calculates the variance for the number of word occurrences of a word in a sequence of length n given a background model (Markov model or Bernoulli model). The formula is obtained from Robin, S., Rodolphe, F., and Schbath, S. (2005). DNA, Words and Models. Cambridge University Press. See Jonathan Goeke et al (to appear) for details on the implementation.
Return Values
TValue variance; Variance of the number of occurrences of the word in a sequence of length n given the model
Examples
Calculate the variance for the number of occurrences of CAAGTC in a sequence of length 10000bp with p(A)=p(T)=0.3 and p(C)=p(G)=0.2.
using namespace seqan;
double var = 0.0;
int n = 10000;
DnaString word = "CAAGTC";
String<double> model;
resize(model, 4);
model = 0.3;  // p(A)
model = 0.2;  // p(C)
model = 0.2;  // p(G)
model = 0.3;  // p(T)
calculateVariance(var, word, model, n);  // var = 2.16
Estimate a Markov model on a set of sequences and calculate the variance for the number of occurrences of the word CAAGTC in a sequence of length 10000bp.
using namespace seqan;
double var = 0.0;
int n = 10000;
DnaString word = "CAAGTC";
StringSet<DnaString> sequences;
appendValue(sequences, "CAGAAAAAAACACTGATTAACAGGAATAAGCAGTTTACTTATTTTGGGCCTGGGACCCGTGTCTCTAATTTAATTAGGTGATCCCTGCGAAGTTTCTCCA");
MarkovModel<Dna, double> model(0);  // Bernoulli model
model.build(sequences);
calculateVariance(var, word, model, n);  // var = 2.16
MarkovModel<Dna, double> model1(1);  // First order Markov model
model1.build(sequences);
calculateVariance(var, word, model1, n);  // var = 1.69716
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2013/07/11 09:12:36