public void TestRead()
    {
      var filename = @"../../../data/01-018-Post_CTTGTA_slim.sam";

      var builder = new SAMAlignedItemCandidateBuilder(1);

      HashSet<string> totalQueryNames;
      var items = builder.Build<TrimedSAMAlignedItem>(filename, out totalQueryNames);

      Assert.AreEqual(3, items.Count);

      Assert.AreEqual("HWI-ST508:279:D2BAFACXX:5:1101:12662:2102", items[0].Qname);
      Assert.AreEqual("HWI-ST508:279:D2BAFACXX:5:1101:16014:2180", items[1].Qname);
      Assert.AreEqual("HWI-ST508:279:D2BAFACXX:5:1101:20077:2189", items[2].Qname);

      Assert.AreEqual(7, items[0].Locations.Count);
      Assert.AreEqual(6, items[1].Locations.Count);
      Assert.AreEqual(1, items[2].Locations.Count);
    }
예제 #2
0
    public void TestFill()
    {
      var samfile = @"../../../data/01-018-Post_CTTGTA_slim.sam";
      var fastqfile = @"../../../data/01-018-Post_CTTGTA_slim.fastq";

      var builder = new SAMAlignedItemCandidateBuilder(1);

      HashSet<string> totalQueryNames;
      var items = builder.Build<TrimedSAMAlignedItem>(samfile, out totalQueryNames);

      items.FillOriginalSequence(fastqfile);

      Assert.AreEqual("GAGGACCGGGATGGACATAC", items[0].OriginalSequence, items[0].Qname);
      Assert.AreEqual("ATACCGTCGTAGTCTTAACC", items[1].OriginalSequence, items[1].Qname);
      Assert.AreEqual("AAGGATTGACAGATTGAGAGC", items[2].OriginalSequence, items[2].Qname);

      Assert.AreEqual(items[0].OriginalSequence.Substring(2).Substring(0, items[0].OriginalSequence.Length - 5), items[0].Sequence, items[0].Qname);
      Assert.AreEqual(items[1].OriginalSequence.Substring(2).Substring(0, items[1].OriginalSequence.Length - 5), items[1].Sequence, items[1].Qname);
      Assert.AreEqual(items[2].OriginalSequence.Substring(2).Substring(0, items[2].OriginalSequence.Length - 5), items[2].Sequence, items[2].Qname);
    }