/// <summary> /// Calculates the theoretical volume the alphabet for a chain. /// </summary> /// <param name="chain"> /// An estimated chain. /// </param> /// <param name="alphabet"> /// Current alphabet. /// </param> /// <returns> /// The theoretical volume the alphabet. /// </returns> public double TheoryVolume(ComplexChain chain, FrequencyDictionary alphabet) { double f = 0; List<string> wordsList = alphabet.GetWords(); foreach (string word in wordsList) { double freq = Frequency(chain, word); if (freq > f) { f = freq; } } double z = chain.GetLength(); double k = 1 / Math.Log(f * z); double b = (k / f) - 1; double v = (k * z) - b; return v; }
public void GetWordsTest() { var alphabet = new FrequencyDictionary(chain); string[] words = { "A", "G", "C", "T" }; List<string> alphabetWords = alphabet.GetWords(); Assert.True(!words.Except(alphabetWords).Any()); }