Ejemplo n.º 1
0
 def test_in_features(self):
     self.expressed_locus_alignment.rewind()
     alignment = self.expressed_locus_alignment
     genes = self.test_annotation.filter_features(lambda x: x.f_type == "gene")
     locus_gen = sam.expressed_loci(alignment)
     group1 = next(locus_gen)
     group2 = next(locus_gen)
     assert not gff.in_features(group1, genes)
     assert gff.in_features(group2, genes)
Ejemplo n.º 2
0
 def test_expressed_loci(self):
     self.expressed_locus_alignment.rewind()
     alignment = self.expressed_locus_alignment
     locus_gen = sam.expressed_loci(alignment)
     group1 = next(locus_gen)
     group2 = next(locus_gen)
     assert group1[0].qname == "SRR360147.1"
     assert group1[1].qname == "SRR360147.3"
     assert group2[0].qname == "SRR360147.2"
     assert group2[1].qname == "SRR360147.4"
Ejemplo n.º 3
0
 def test_in_features(self):
     self.expressed_locus_alignment.rewind()
     alignment = self.expressed_locus_alignment
     genes = self.test_annotation.filter_features(
         lambda x: x.f_type == "gene")
     locus_gen = sam.expressed_loci(alignment)
     group1 = next(locus_gen)
     group2 = next(locus_gen)
     assert not gff.in_features(group1, genes)
     assert gff.in_features(group2, genes)
Ejemplo n.º 4
0
    def test_consensus(self):
        self.indel_algn.rewind()
        with pytest.raises(sam.UnmappedReadError):
            sam.consensus([self.single_read])
        assert sam.consensus(list(self.indel_algn)) ==\
             "AGATGACGGAAGCTTGATCTCACGAANNNNNNNNTTNNCATCCNNNTNNT"

        assert sam.consensus(self.reverse_complement_align) == \
                                                                "AAAGGGAAAA"

        self.mate_pair_align.rewind()
        mate_pair_loci = sam.expressed_loci(self.mate_pair_align)
        con = sam.consensus(next(mate_pair_loci))
        assert con == self.mate_pair_consensus
Ejemplo n.º 5
0
def test_speed_test():
   align = sam.SamAlignment(TEST_FOLDER + "/test_data/speed_test.sam")
   annotation = gff.GenomeAnnotation(TEST_FOLDER + "/test_data/speed_test.gff")
   for locus in sam.expressed_loci(align):
        gff.in_features(locus, annotation.features)
        sam.consensus(locus)