public IEnumerable <FastQ> ReadFastQ(string fileName) { int nLine = -1; using (TextReader reader = File.OpenText(fileName)) { string line; while ((line = reader.ReadLine()) != null) { nLine++; if (nLine % 4 != 0) { continue; } FastQ read = new FastQ() { Name = line, Seq = reader.ReadLine(), Comment = reader.ReadLine(), Qual = reader.ReadLine() }; nLine += 3; yield return(read); } } }
public void CountContexts(FastQ read) { for (int i = 0; i < read.Seq.Length - this.k; i++) { int currentCount = 0; string kmer = read.Seq.Substring(i, this.k); this.contextCounters.TryGetValue(kmer, out currentCount); this.contextCounters[kmer] = currentCount + 1; } }