Ejemplo n.º 1
0
 def addProtein(self):
     protein_1 = Protein(10, 30, "+", "chr1", "p1")
     protein_2 = Protein(32, 50, "+", "chr1", "p2")
     transcript_1 = Transcript(name="tr1")
     # Empty
     self.assertEqual([elt.name for elt in transcript_1.proteins], [])
     # Add protein_1
     transcript_1.addProtein(protein_1)
     self.assertEqual([elt.name for elt in transcript_1.proteins],
                      ["p1"])  # Check from tr
     self.assertEqual(protein_1.transcript, transcript_1)  # Check from prot
     # Add protein_2
     transcript_1.addProtein(protein_2)
     self.assertEqual([elt.name for elt in transcript_1.proteins],
                      ["p1", "p2"])  # Check from tr
     self.assertEqual(protein_1.transcript, transcript_1)  # Check from prot
     self.assertEqual(protein_2.transcript, transcript_1)  # Check from prot
Ejemplo n.º 2
0
 def delProtein(self):
     protein_1 = Protein(10, 30, "+", "chr1", "p1")
     protein_2 = Protein(32, 50, "+", "chr1", "p2")
     transcript_1 = Transcript(name="tr1", proteins=[protein_1, protein_2])
     # Init
     self.assertEqual([elt.name for elt in transcript_1.proteins],
                      ["p1", "p2"])  # Check from tr
     self.assertEqual(protein_1.transcript, transcript_1)  # Check from prot
     self.assertEqual(protein_2.transcript, transcript_1)  # Check from prot
     # Delete protein 2
     transcript_1.delProtein(protein_2)
     self.assertEqual([elt.name for elt in transcript_1.proteins],
                      ["p1"])  # Check from tr
     self.assertEqual(protein_1.transcript, transcript_1)  # Check from prot
     self.assertEqual(protein_2.transcript, None)  # Check from prot
     # Delete protein 1
     transcript_1.addProtein(protein_1)
     self.assertEqual([elt.name for elt in transcript_1.proteins],
                      [])  # Check from tr
     self.assertEqual(protein_1.transcript, None)  # Check from prot
     self.assertEqual(protein_2.transcript, None)  # Check from prot