This commit is contained in:
Nigel Delaney 2015-10-14 12:15:20 -07:00
Родитель c4c1640c9c
Коммит 721e106a94
2 изменённых файлов: 45 добавлений и 8 удалений

Просмотреть файл

@ -11,7 +11,7 @@ namespace Bio.IO.PacBio
/// <summary>
/// Reads the data from a PacBio BAM file produced by the pbccs program.
/// </summary>
public class PacBioCCSBamReader
public class PacBioCCSBamReader : ISequenceParser
{
/// <summary>
/// Parse the CCS reads in a PacBio CCS BAM File.
@ -51,6 +51,43 @@ namespace Bio.IO.PacBio
}
}
#region IParser implementation
IEnumerable<ISequence> IParser<ISequence>.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
}
}

Просмотреть файл

@ -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);