public override void RunScan() { int numberOfPurines = scanSequence.CountDistinctSubsequences("[ag]"); int numberOfPyrimidines = scanSequence.CountDistinctSubsequences("[ct]"); string comparisonResult = (numberOfPurines > numberOfPyrimidines)?"Yes, there are more purines than pyrimidines.":"No, there are more pyrimidines than purines."; scanResult = new AbsoluteNumberResult(comparisonResult + " The following shares have been found:"); scanResult.addAbsoluteNumberToResult("purines", numberOfPurines); scanResult.addAbsoluteNumberToResult("pyrimidines", numberOfPyrimidines); }
public override void RunScan() { scanResult = new AbsoluteNumberResult("The following shares of nucleobases have been found:"); foreach (char nucleobase in new char[] { 'g', 'a', 'c', 't' }) { int matchOfSubsequence = scanSequence.CountDistinctSubsequences(nucleobase.ToString()); scanResult.addAbsoluteNumberToResult(nucleobase.ToString(), matchOfSubsequence); } }
public void AbsoluteNumberResultTest() { AbsoluteNumberResult res = new AbsoluteNumberResult("1"); res.addAbsoluteNumberToResult("a", 1); res.addAbsoluteNumberToResult("a", 1); res.addAbsoluteNumberToResult("b", 1); res.addAbsoluteNumberToResult("a", 1); System.Collections.Generic.Dictionary<string, int> values = res.getValues(); Console.WriteLine(res.getAnswer()); int sum = 0; foreach (string s in values.Keys) { Console.WriteLine(s + " " + values[s]); sum += values[s]; } Console.WriteLine(res.getSumOfAllValues()); Assert.AreEqual(sum, res.getSumOfAllValues()); }