diff --git a/src/Source/Framework/Bio.Core/IO/PacBio/PacBioCCSBamReader.cs b/src/Source/Framework/Bio.Core/IO/PacBio/PacBioCCSBamReader.cs index 2f37e22..be99bef 100644 --- a/src/Source/Framework/Bio.Core/IO/PacBio/PacBioCCSBamReader.cs +++ b/src/Source/Framework/Bio.Core/IO/PacBio/PacBioCCSBamReader.cs @@ -11,7 +11,7 @@ namespace Bio.IO.PacBio /// /// Reads the data from a PacBio BAM file produced by the pbccs program. /// - public class PacBioCCSBamReader + public class PacBioCCSBamReader : ISequenceParser { /// /// Parse the CCS reads in a PacBio CCS BAM File. @@ -51,6 +51,43 @@ namespace Bio.IO.PacBio } } + #region IParser implementation + IEnumerable IParser.Parse (Stream stream) + { + return PacBioCCSBamReader.Parse (stream); + } + public ISequence ParseOne (Stream stream) + { + return PacBioCCSBamReader.Parse (stream).First(); + } + #endregion + #region IParserWithAlphabet implementation + public IAlphabet Alphabet { + get { + return DnaAlphabet.Instance; + } + set { + throw new NotImplementedException (); + } + } + #endregion + #region IParser implementation + public string Name { + get { + return "CCS-BAM-Parser"; + } + } + public string Description { + get { + return "Parses BAM Files output by the PacBio CCS Program"; + } + } + public string SupportedFileTypes { + get { + return Properties.Resource.BAM_FILEEXTENSION; + } + } + #endregion } } diff --git a/src/Source/Tests/Bio.Tests/PacBio/ParserTests.cs b/src/Source/Tests/Bio.Tests/PacBio/ParserTests.cs index cd59edc..e5a41e9 100644 --- a/src/Source/Tests/Bio.Tests/PacBio/ParserTests.cs +++ b/src/Source/Tests/Bio.Tests/PacBio/ParserTests.cs @@ -19,15 +19,15 @@ namespace Bio.Tests.PacBio var seqs = csp.Parse (fname).Select(z => z as PacBioCCSRead).ToList(); var seq4 = seqs [4]; - Assert.AreEqual (146331, seq4.HoleNumber); - Assert.AreEqual (124, seq4.NumPasses); - Assert.AreEqual (2, seq4.ReadCountBadZscore); - Assert.AreEqual (136, seq4.Sequence.Count); - Assert.AreEqual (128, seq4.ZScores.Length); - Assert.AreEqual("m141008_060349_42194_c100704972550000001823137703241586_s1_p0/146331/ccs", + Assert.AreEqual (273, seq4.HoleNumber); + Assert.AreEqual (12, seq4.NumPasses); + Assert.AreEqual (1, seq4.ReadCountBadZscore); + Assert.AreEqual (1946, seq4.Sequence.Count); + Assert.AreEqual (14, seq4.ZScores.Length); + Assert.AreEqual("m150930_045019_42194_c100916310150000001823201204291662_s1_p0/273/ccs", seq4.Sequence.ID); var seq = new Sequence (DnaAlphabet.Instance, seq4.Sequence.ToArray (), true); - Assert.AreEqual("CCCGGGGATCCTCTAGAATGCTCATACACTGGGGGATACATATACGGGGGGGGGCACATCATCTAGACAGACGACTTTTTTTTTTCGAGCGCAGCTTTTTGAGCGACGCACAAGCTTGCTGAGGACTAGTAGCTTC", + Assert.AreEqual("TGTCACTCATCTGAGTGATCCCGCGAAATTAATACGACTCACTATAGGGGAATTGTGAGCGGATAACAATTCCCCTCTAGAAATAATTTTGTTTAACTTTAAGAAGGAGATATACATATGAAACACATGCCACGTAAAATGTATTCCTGCGACTTTGAGACTACACCAAGGTTGAAGATTGCCGCGTATGGGCATACGGTTACATGAACATCGAAGACCACTCCGAGTATAAGATTGGTAACTCCCTGGATGAATTTATGGCTTGGGTTCTGAAAGTTCAGGCTGACCTGTACTTCCACAATCTGAAATTTGATGGCGCATTCATCATCAACTGGCTGGAACGTAACGGTTTTAAATGGTCCGCAGATGGTCTGCCAAATACCTACAACACCATCATTTCTCGCATGGGCCAGTGGTATATGATTGATATTTGCCTGGGTTACAAGGGTAAACGCAAGATCCACACCGTGATCTACGACTCTCTGAAGAAACTGCCGTTTCCGGTTAAGAAAATTGCGAAAGACTTTAAGCTGACGGTACTGAAAGGCGACATCGACTATCATAAGGAGCGCCCGGTCGTTACAAAATCACCCGGAAGAATATGCCTACATTAAAAACGATATTCAGATTATCGCAGAAGCTCTGCTGATCCAGTTCAAGCAGGGTCTGGATCGTATGACGGCAGGTTCTGACTCTCTGAAAGGCTTCAAAGACATTATCACCACCAAGAAGTTTAAAAAGGTTTCCCGACCCTGAGCCTGGGTCTGGACAAGGAAGTTCGTTATGCCTACCGTGGTGGTTTCACCTGGCTGAATGACCGTTTTAAAGAAAAAGAGATCGGCGAAGGTATGGTTTTTGATGTTAATTCCCTGTACCCAGCGCAAATGTACTCTCGCCTGCTGCCGTACGGCGAGCCGATCGTATTCGAGGGTAAATACGTCTGGGACGAGGACTACCCTCTGCACATTCAGCACATTCGTTGTGAATTTGAACTGAAGGAAGGCTACATCCCGACCATCCAGATCAATCGTTCCCGTTTCTACAAGGGTAACGAATACCTGAAATCTTCCGGCGGTGAAATTGCTGACCTGTGGCTGTCTAATGTTGATCTGGAACTGATGAAAGAGCACTACGACCTGTACAATGTTGAATATATCTCTGGTCTGAAGTTCAAAGCAACCACTGGCCTGTTCAAGGACTTTATCGACAAATGGACGTATATCAAAACTACCTCTGAAGGCGCCATCAAACAGCTGGCGAAGCTGATCCTGAACAGCCTGTACGGTAAATTCGCGTCCAACCCGGACGTTACCGGTAAAGTGCCATACCTGAAAGAGAACGGTGCTCTGGGTTTTCGTCTGGGTGAGGAGGAAACGAAAGACCCTGTATATACCCGATGGGTGTCTTTATCACGGCCTGGGCACGCTATACGACCATCACGGCAGCGCAGGCTTGTTATGATCGTATTATCTACTGCGATACCGATTCTATTCACCTGACTGGTACTGAAATTCCGGACGTTATCAAAGACATCGTAGACCCGAAGAAACTGGGCTACTGGGCGCACGAATCTACTTTTAAGCGTGCAAAATATCTGCGTCAGAAAACCTACATCCAGGATATTTACATGAAAGAAGTAGACGGCAAATTGGTAGAGGGCTCTCCTGACGACTACACTGACATCAAGTTCTCTGTGAAATGCGCAGGCATGACGGACAAAATCAAAAAGGAAGTGACTTTCGAAAACTTCAAAGTGGGTTTTTCTCGTAAAATGAAACCGAAGCCTGTTCAGGTACCGGGTGGCGTAGTGCTGGTTGATGACACTTTTACTATCAAATAACTCGAGCTGCAGGAATTCAAGCTTGGATCCGGCTGCTAACAAAGCCCGAAAGGAAGCTGAGTTGGCTGCTGCCACCGCTGAGCAATAACTTGTCACTCATCTGAGT", seq.ConvertToString()); Assert.AreEqual (seqs.Count, 7);