예제 #1
0
    def test_get_mol_wt(self):
        dna1 = core.DnaSpeciesType(id='dna6', sequence_path=self.sequence_path)
        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=6)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)

        exon1 = eukaryote_schema.ExonLocus(start=1, end=1)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon1])
        exp_mol_wt = \
            + Bio.SeqUtils.molecular_weight(transcript1.get_seq()) \
            - (transcript1.get_len() + 1) * mendeleev.element('H').atomic_weight
        self.assertAlmostEqual(transcript1.get_mol_wt(), exp_mol_wt, places=1)

        exon2 = eukaryote_schema.ExonLocus(start=3, end=3)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon2])
        exp_mol_wt = \
            + Bio.SeqUtils.molecular_weight(transcript2.get_seq()) \
            - (transcript2.get_len() + 1) * mendeleev.element('H').atomic_weight
        self.assertAlmostEqual(transcript2.get_mol_wt(), exp_mol_wt, places=1)

        exon3 = eukaryote_schema.ExonLocus(start=5, end=5)
        transcript3 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon3])
        exp_mol_wt = \
            + Bio.SeqUtils.molecular_weight(transcript3.get_seq()) \
            - (transcript3.get_len() + 1) * mendeleev.element('H').atomic_weight
        self.assertAlmostEqual(transcript3.get_mol_wt(), exp_mol_wt, places=1)
예제 #2
0
    def test_get_seq(self):
        dna1 = core.DnaSpeciesType(id='dna2', sequence_path=self.sequence_path)

        gene1 = eukaryote_schema.GeneLocus(polymer=dna1,
                                           start=1,
                                           end=15,
                                           strand=core.PolymerStrand.positive)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)

        exon1 = eukaryote_schema.ExonLocus(start=1, end=4)
        exon2 = eukaryote_schema.ExonLocus(start=7, end=8)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(
            rna=rna1, exons=[exon1, exon2])

        gene2 = eukaryote_schema.GeneLocus(polymer=dna1,
                                           start=4,
                                           end=18,
                                           strand=core.PolymerStrand.negative)
        rna2 = eukaryote_schema.PreRnaSpeciesType(gene=gene2)
        exon1 = eukaryote_schema.ExonLocus(start=4, end=10)
        exon2 = eukaryote_schema.ExonLocus(start=14, end=16)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(
            rna=rna2, exons=[exon1, exon2])

        self.assertEqual(transcript1.get_seq(), 'ACUGUU')
        self.assertEqual(transcript2.get_seq(), 'ACGGUAACUC')
예제 #3
0
    def test_constructor(self):
        dna1 = core.DnaSpeciesType(id='dna1', sequence_path=self.sequence_path)
        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=15)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)

        transcript1 = eukaryote_schema.TranscriptSpeciesType(
            id='t1', name='transcript1', rna=rna1, half_life=2)

        self.assertEqual(transcript1.id, 't1')
        self.assertEqual(transcript1.name, 'transcript1')
        self.assertEqual(transcript1.rna, rna1)
        self.assertEqual(transcript1.half_life, 2)
        self.assertEqual(transcript1.exons, [])
        self.assertEqual(transcript1.comments, '')
        self.assertEqual(transcript1.references, [])
        self.assertEqual(transcript1.database_references, [])

        exon1 = eukaryote_schema.ExonLocus(start=1, end=1)
        exon2 = eukaryote_schema.ExonLocus(start=2, end=2)
        transcript1.exons = [exon1, exon2]
        transcript2 = eukaryote_schema.TranscriptSpeciesType(
            id='t2', name='transcript2', rna=rna1, exons=[exon2])

        self.assertEqual(transcript1.exons, [exon1, exon2])
        self.assertEqual(transcript2.exons, [exon2])
예제 #4
0
    def test_ComplexSpeciesType(self):

        self.tmp_dirname = tempfile.mkdtemp()
        sequence_path = os.path.join(self.tmp_dirname, 'test_seq.fasta')
        with open(sequence_path, 'w') as f:
            f.write(
                '>dna1\nTTTATGAARGTNCTCATHAAYAARAAYGARCTCTAGTTTATGAARTTYAARTTYCTCCTCACNCCNCTCTAATTT\n'
            )

        dna1 = core.DnaSpeciesType(id='dna1', sequence_path=sequence_path)

        # Protein subunit 1
        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=36)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)
        exon1 = eukaryote_schema.ExonLocus(start=4, end=36)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon1])
        cds1 = eukaryote_schema.CdsLocus(start=4, end=36)
        prot1 = eukaryote_schema.ProteinSpeciesType(transcript=transcript1,
                                                    coding_region=cds1)

        # Protein subunit 2
        gene2 = eukaryote_schema.GeneLocus(polymer=dna1, start=37, end=75)
        rna2 = eukaryote_schema.PreRnaSpeciesType(gene=gene2)
        exon2 = eukaryote_schema.ExonLocus(start=40, end=72)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(rna=rna2,
                                                             exons=[exon2])
        cds2 = eukaryote_schema.CdsLocus(start=40, end=72)
        prot2 = eukaryote_schema.ProteinSpeciesType(transcript=transcript2,
                                                    coding_region=cds2)

        # Complex formation: (2) prot1 + (3) prot2 ==> complex1
        species_coeff1 = core.SpeciesTypeCoefficient(species_type=prot1,
                                                     coefficient=2)
        species_coeff2 = core.SpeciesTypeCoefficient(species_type=prot2,
                                                     coefficient=3)
        complex1 = core.ComplexSpeciesType(
            subunits=[species_coeff1, species_coeff2])

        self.assertEqual(complex1.get_charge(), 8)
        self.assertAlmostEqual(
            complex1.get_mol_wt(),
            (2 * prot1.get_mol_wt() + 3 * prot2.get_mol_wt()))
        self.assertEqual(complex1.get_empirical_formula(),
                         chem.EmpiricalFormula('C292H492N64O66S5'))

        shutil.rmtree(self.tmp_dirname)
예제 #5
0
    def test_get_charge(self):
        dna1 = core.DnaSpeciesType(id='dna5', sequence_path=self.sequence_path)

        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=1)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)
        exon1 = eukaryote_schema.ExonLocus(start=1, end=1)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon1])
        self.assertEqual(transcript1.get_charge(), -2)

        gene2 = eukaryote_schema.GeneLocus(polymer=dna1, start=2, end=4)
        rna2 = eukaryote_schema.PreRnaSpeciesType(gene=gene2)
        exon2_1 = eukaryote_schema.ExonLocus(start=2, end=2)
        exon2_2 = eukaryote_schema.ExonLocus(start=4, end=4)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(
            rna=rna2, exons=[exon2_1, exon2_2])
        self.assertEqual(transcript2.get_charge(), -3)
예제 #6
0
 def test_constructor(self):
     exon = eukaryote_schema.ExonLocus(id='e1',
                                       name='exon1',
                                       start=21,
                                       end=30,
                                       comments='No comment')
     self.assertEqual(exon.id, 'e1')
     self.assertEqual(exon.name, 'exon1')
     self.assertEqual(exon.start, 21)
     self.assertEqual(exon.end, 30)
     self.assertEqual(exon.comments, 'No comment')
     self.assertEqual(exon.references, [])
     self.assertEqual(exon.database_references, [])
예제 #7
0
    def setUp(self):
        self.tmp_dirname = tempfile.mkdtemp()
        sequence_path = os.path.join(self.tmp_dirname, 'test_seq.fasta')
        with open(sequence_path, 'w') as f:
            f.write(
                '>dna1\nTTTATGAARGTNCTCATHAAYAARAAYGARCTCTAGTTTTTACAGTTYCGGGGTCAGCAGAAATTTTTTCATTTT\n'
            )

        dna1 = core.DnaSpeciesType(id='dna1', sequence_path=sequence_path)

        cell1 = dna1.cell = core.Cell()

        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=36)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)
        exon1 = eukaryote_schema.ExonLocus(start=4, end=36)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon1])
        cds1 = eukaryote_schema.CdsLocus(id='cds1', start=4, end=36)
        self.prot1 = eukaryote_schema.ProteinSpeciesType(
            id='prot1',
            name='protein1',
            uniprot='Q12X34',
            transcript=transcript1,
            coding_region=cds1,
            half_life=0.35)

        gene2 = eukaryote_schema.GeneLocus(polymer=dna1,
                                           start=30,
                                           end=75,
                                           strand=core.PolymerStrand.negative)
        rna2 = eukaryote_schema.PreRnaSpeciesType(gene=gene2)
        exon2_1 = eukaryote_schema.ExonLocus(start=32, end=35)
        exon2_2 = eukaryote_schema.ExonLocus(start=38, end=45)
        exon2_3 = eukaryote_schema.ExonLocus(start=49, end=54)
        exon2_4 = eukaryote_schema.ExonLocus(start=55, end=72)
        exon2_5 = eukaryote_schema.ExonLocus(start=73, end=74)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(
            rna=rna2, exons=[exon2_1, exon2_2, exon2_3, exon2_4, exon2_5])
        cds2 = eukaryote_schema.CdsLocus(id='cds2', start=40, end=72)
        self.prot2 = eukaryote_schema.ProteinSpeciesType(
            id='prot2',
            name='protein2',
            uniprot='P12345',
            cell=cell1,
            transcript=transcript2,
            coding_region=cds2)
예제 #8
0
    def test_get_empirical_formula(self):
        dna1 = core.DnaSpeciesType(id='dna3', sequence_path=self.sequence_path)
        gene1 = eukaryote_schema.GeneLocus(polymer=dna1, start=1, end=4)
        rna1 = eukaryote_schema.PreRnaSpeciesType(gene=gene1)

        exon1 = eukaryote_schema.ExonLocus(start=1, end=1)
        transcript1 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon1])
        self.assertEqual(transcript1.get_empirical_formula(),
                         chem.EmpiricalFormula('C10H12N5O7P'))

        exon2 = eukaryote_schema.ExonLocus(start=2, end=2)
        transcript2 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon2])
        self.assertEqual(transcript2.get_empirical_formula(),
                         chem.EmpiricalFormula('C9H12N3O8P'))

        exon3 = eukaryote_schema.ExonLocus(start=3, end=3)
        transcript3 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon3])
        self.assertEqual(transcript3.get_empirical_formula(),
                         chem.EmpiricalFormula('C10H12N5O8P'))

        exon4 = eukaryote_schema.ExonLocus(start=4, end=4)
        transcript4 = eukaryote_schema.TranscriptSpeciesType(rna=rna1,
                                                             exons=[exon4])
        self.assertEqual(transcript4.get_empirical_formula(),
                         chem.EmpiricalFormula('C9H11N2O9P'))

        dna2 = core.DnaSpeciesType(id='dna4', sequence_path=self.sequence_path)
        gene2 = eukaryote_schema.GeneLocus(polymer=dna2, start=1, end=4)
        rna2 = eukaryote_schema.PreRnaSpeciesType(gene=gene2)
        exon5_1 = eukaryote_schema.ExonLocus(start=1, end=1)
        exon5_2 = eukaryote_schema.ExonLocus(start=3, end=3)
        transcript5 = eukaryote_schema.TranscriptSpeciesType(
            rna=rna2, exons=[exon5_1, exon5_2])
        self.assertEqual(transcript5.get_empirical_formula(),
                         chem.EmpiricalFormula('C20H23N10O13P2'))