예제 #1
0
 def test_mrna_contains_internal_stop(self):
     helper = SeqHelper("gattacaTAGgattaca") # TAG = stop codon
     mrna = Mock()
     mrna.strand = '+'
     mrna.cds = Mock()
     mrna.cds.indices = [[2, 4], [8, 14]]
     # verify that the internal stop is in the sequence ...
     self.assertEquals("attTAGgatt", helper.get_sequence_from_indices('+', mrna.cds.indices))
     # make sure the method catches it
     self.assertTrue(helper.mrna_contains_internal_stop(mrna))
예제 #2
0
 def test_mrna_contains_internal_stop(self):
     helper = SeqHelper("gattacaTAGgattaca")  # TAG = stop codon
     mrna = Mock()
     mrna.strand = '+'
     mrna.cds = Mock()
     mrna.cds.indices = [[2, 4], [8, 14]]
     # verify that the internal stop is in the sequence ...
     self.assertEquals(
         "attTAGgatt",
         helper.get_sequence_from_indices('+', mrna.cds.indices))
     # make sure the method catches it
     self.assertTrue(helper.mrna_contains_internal_stop(mrna))
예제 #3
0
파일: sequence.py 프로젝트: jdzurisin/GAG
 def remove_mrnas_with_internal_stops(self):
     helper = SeqHelper(self.bases)
     for gene in self.genes:
         gene.remove_mrnas_with_internal_stops(helper)
         if not gene.mrnas:
             gene.death_flagged = True
     self.genes = [g for g in self.genes if not g.death_flagged]
예제 #4
0
파일: sequence.py 프로젝트: jdzurisin/GAG
 def to_protein_fasta(self):
     helper = SeqHelper(self.bases)
     result = ""
     for gene in self.genes:
         result += gene.to_protein_fasta(helper)
     return result
예제 #5
0
 def setUp(self):
     self.helper = SeqHelper("nnnGATTACAnnnnnNNNNNgattacaNNN")
예제 #6
0
class TestSeqHelper(unittest.TestCase):

    def setUp(self):
        self.helper = SeqHelper("nnnGATTACAnnnnnNNNNNgattacaNNN")

    def test_initialize(self):
        self.assertEquals("nnnGATTACAnnnnnNNNNNgattacaNNN", self.helper.full_sequence)

    def test_mrna_to_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.exon = Mock()
        mrna.exon.indices = [[4, 10], [21, 27]]
        mrna.strand = '+'
        expected = ">foo_mrna\nGATTACAgattaca\n"
        self.assertEquals(expected, self.helper.mrna_to_fasta(mrna))

    def test_mrna_to_fasta_reverse_strand(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.exon = Mock()
        mrna.exon.indices = [[4, 10], [21, 27]]
        mrna.strand = '-'
        expected = ">foo_mrna\ntgtaatcTGTAATC\n"
        self.assertEquals(expected, self.helper.mrna_to_fasta(mrna))

    def test_mrna_to_cds_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.strand = '-'
        expected = ">foo_mrna CDS\ntgtaatcTGTAATC\n"
        self.assertEquals(expected, self.helper.mrna_to_cds_fasta(mrna))

    def test_mrna_to_protein_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.cds.get_phase.return_value = 0
        mrna.strand = '+'
        expected = ">foo_mrna protein\nDYRL\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_to_protein_fasta_phase1(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.cds.get_phase.return_value = 1
        mrna.strand = '+'
        expected = ">foo_mrna protein\nITDY\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_to_protein_fasta_reverse(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[21, 27], [4, 10]]
        mrna.cds.get_phase.return_value = 0
        mrna.strand = '-'
        expected = ">foo_mrna protein\nCNL*\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_contains_internal_stop(self):
        helper = SeqHelper("gattacaTAGgattaca") # TAG = stop codon
        mrna = Mock()
        mrna.strand = '+'
        mrna.cds = Mock()
        mrna.cds.indices = [[2, 4], [8, 14]]
        # verify that the internal stop is in the sequence ...
        self.assertEquals("attTAGgatt", helper.get_sequence_from_indices('+', mrna.cds.indices))
        # make sure the method catches it
        self.assertTrue(helper.mrna_contains_internal_stop(mrna))
예제 #7
0
 def setUp(self):
     self.helper = SeqHelper("nnnGATTACAnnnnnNNNNNgattacaNNN")
예제 #8
0
class TestSeqHelper(unittest.TestCase):
    def setUp(self):
        self.helper = SeqHelper("nnnGATTACAnnnnnNNNNNgattacaNNN")

    def test_initialize(self):
        self.assertEquals("nnnGATTACAnnnnnNNNNNgattacaNNN",
                          self.helper.full_sequence)

    def test_mrna_to_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.exon = Mock()
        mrna.exon.indices = [[4, 10], [21, 27]]
        mrna.strand = '+'
        expected = ">foo_mrna\nGATTACAgattaca\n"
        self.assertEquals(expected, self.helper.mrna_to_fasta(mrna))

    def test_mrna_to_fasta_reverse_strand(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.exon = Mock()
        mrna.exon.indices = [[4, 10], [21, 27]]
        mrna.strand = '-'
        expected = ">foo_mrna\ntgtaatcTGTAATC\n"
        self.assertEquals(expected, self.helper.mrna_to_fasta(mrna))

    def test_mrna_to_cds_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.strand = '-'
        expected = ">foo_mrna CDS\ntgtaatcTGTAATC\n"
        self.assertEquals(expected, self.helper.mrna_to_cds_fasta(mrna))

    def test_mrna_to_protein_fasta(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.cds.get_phase.return_value = 0
        mrna.strand = '+'
        expected = ">foo_mrna protein\nDYRL\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_to_protein_fasta_phase1(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[4, 10], [21, 27]]
        mrna.cds.get_phase.return_value = 1
        mrna.strand = '+'
        expected = ">foo_mrna protein\nITDY\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_to_protein_fasta_reverse(self):
        mrna = Mock()
        mrna.identifier = "foo_mrna"
        mrna.cds = Mock()
        mrna.cds.indices = [[21, 27], [4, 10]]
        mrna.cds.get_phase.return_value = 0
        mrna.strand = '-'
        expected = ">foo_mrna protein\nCNL*\n"
        self.assertEquals(expected, self.helper.mrna_to_protein_fasta(mrna))

    def test_mrna_contains_internal_stop(self):
        helper = SeqHelper("gattacaTAGgattaca")  # TAG = stop codon
        mrna = Mock()
        mrna.strand = '+'
        mrna.cds = Mock()
        mrna.cds.indices = [[2, 4], [8, 14]]
        # verify that the internal stop is in the sequence ...
        self.assertEquals(
            "attTAGgatt",
            helper.get_sequence_from_indices('+', mrna.cds.indices))
        # make sure the method catches it
        self.assertTrue(helper.mrna_contains_internal_stop(mrna))