def testBadPositions(self): tester = "TCONS_00001425 . gene 2000 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass tester = "TCONS_00001425 . gene 1564 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass
def setUp(self): ret = unittest.TestCase.setUp(self) exon1 = "TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" exon2 = "TCONS_00001425 . gene 1043 1231 . + . ID=g.11419;Name=ORF%20g.11419%20m.11419%20type%3Acomplete%20len%3A63%20%28%2B%29" exon3 = "TCONS_00001425 . gene 1 1062 . + . ID=g.11414;Name=ORF%20g.11414%20m.11414%20type%3A5prime_partial%20len%3A354%20%28%2B%29" self.actual_exon = Exon( "Spolyrrhiza9509S001 Cufflinks exon 26722 26764 . - . Parent=TCONS_00001425" ) self.actual_trans = Transcript(exon1) actual_exon1 = "Spolyrrhiza9509S001 Cufflinks exon 24497 24656 . - . Parent=TCONS_00001425" actual_exon2 = "Spolyrrhiza9509S001 Cufflinks exon 24809 24938 . - . Parent=TCONS_00001425" actual_exon3 = "Spolyrrhiza9509S001 Cufflinks exon 26237 26599 . - . Parent=TCONS_00001425" self.actual_exon1 = Exon(actual_exon1) self.actual_exon2 = Exon(actual_exon2) self.actual_exon3 = Exon(actual_exon3) self.exon1 = Transcript(exon1) self.exon2 = Transcript(exon2) self.exon3 = Transcript(exon3) return ret
def setUp(self): ret = unittest.TestCase.setUp(self) exon1 ="TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" exon2 ="TCONS_00001425 . gene 1043 1231 . + . ID=g.11419;Name=ORF%20g.11419%20m.11419%20type%3Acomplete%20len%3A63%20%28%2B%29" exon3 ="TCONS_00001425 . gene 1 1062 . + . ID=g.11414;Name=ORF%20g.11414%20m.11414%20type%3A5prime_partial%20len%3A354%20%28%2B%29" self.actual_exon = Exon("Spolyrrhiza9509S001 Cufflinks exon 26722 26764 . - . Parent=TCONS_00001425") self.actual_trans = Transcript(exon1) actual_exon1 = "Spolyrrhiza9509S001 Cufflinks exon 24497 24656 . - . Parent=TCONS_00001425" actual_exon2 = "Spolyrrhiza9509S001 Cufflinks exon 24809 24938 . - . Parent=TCONS_00001425" actual_exon3 = "Spolyrrhiza9509S001 Cufflinks exon 26237 26599 . - . Parent=TCONS_00001425" self.actual_exon1 = Exon(actual_exon1) self.actual_exon2 = Exon(actual_exon2) self.actual_exon3 = Exon(actual_exon3) self.exon1 = Transcript(exon1) self.exon2 = Transcript(exon2) self.exon3 = Transcript(exon3) return ret
class GFFLineTest(unittest.TestCase): def setUp(self): ret = unittest.TestCase.setUp(self) exon1 ="TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" exon2 ="TCONS_00001425 . gene 1043 1231 . + . ID=g.11419;Name=ORF%20g.11419%20m.11419%20type%3Acomplete%20len%3A63%20%28%2B%29" exon3 ="TCONS_00001425 . gene 1 1062 . + . ID=g.11414;Name=ORF%20g.11414%20m.11414%20type%3A5prime_partial%20len%3A354%20%28%2B%29" self.actual_exon = Exon("Spolyrrhiza9509S001 Cufflinks exon 26722 26764 . - . Parent=TCONS_00001425") self.actual_trans = Transcript(exon1) actual_exon1 = "Spolyrrhiza9509S001 Cufflinks exon 24497 24656 . - . Parent=TCONS_00001425" actual_exon2 = "Spolyrrhiza9509S001 Cufflinks exon 24809 24938 . - . Parent=TCONS_00001425" actual_exon3 = "Spolyrrhiza9509S001 Cufflinks exon 26237 26599 . - . Parent=TCONS_00001425" self.actual_exon1 = Exon(actual_exon1) self.actual_exon2 = Exon(actual_exon2) self.actual_exon3 = Exon(actual_exon3) self.exon1 = Transcript(exon1) self.exon2 = Transcript(exon2) self.exon3 = Transcript(exon3) return ret """ Tests comparison on RNAseq format """ def testTranscriptComparison(self): self.assertGreater(self.exon2, self.exon1) self.assertGreater(self.exon3, self.exon1) self.assertGreater(self.exon2, self.exon3) self.assertLess(self.exon1, self.exon2) self.assertLess(self.exon1, self.exon3) self.assertLess(self.exon3, self.exon2) self.assertEqual(self.exon1, self.exon1) def testBaseGetDicFormat(self): actual = self.actual_exon.getDicFormat() expected = {"name": "TCONS_00001425", "start": 26722, "stop": 26764} self.assertEqual(actual, expected) def testBaseConstructor(self): self.assertEqual(self.exon1.start, 1439) self.assertEqual(self.exon1.stop, 1564) self.assertEqual(self.exon1.getLabel(), "gene") self.assertEqual(self.exon1.parent, "TCONS_00001425") self.assertEqual(len(self.exon1), 125) self.assertEqual(str(self.exon1), "TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29") self.assertEqual(self.exon1.partial, "partial") self.assertEqual(self.exon1.strand, "-") def testBadPositions(self): tester = "TCONS_00001425 . gene 2000 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass tester = "TCONS_00001425 . gene 1564 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass def testSetLenth(self): self.exon1.setLength(2222) self.assertEqual(len(self.exon1), 2222) def testSwitchStrand(self): self.exon1.switchStrand() self.assertEquals(self.exon1.strand, "+") def testGetExonDicFormat(self): temp = self.actual_trans temp.addExon(self.actual_exon1) temp.addExon(self.actual_exon2) temp.addExon(self.actual_exon3) actual = temp.getExonDicList() expected = [{"start": 24497, "stop":24656 ,"name": "TCONS_00001425"}, {"start":24809 , "stop": 24938 ,"name": "TCONS_00001425"}, {"start": 26237, "stop": 26599 ,"name": "TCONS_00001425"}] self.assertEqual(actual, expected)
class GFFLineTest(unittest.TestCase): def setUp(self): ret = unittest.TestCase.setUp(self) exon1 = "TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" exon2 = "TCONS_00001425 . gene 1043 1231 . + . ID=g.11419;Name=ORF%20g.11419%20m.11419%20type%3Acomplete%20len%3A63%20%28%2B%29" exon3 = "TCONS_00001425 . gene 1 1062 . + . ID=g.11414;Name=ORF%20g.11414%20m.11414%20type%3A5prime_partial%20len%3A354%20%28%2B%29" self.actual_exon = Exon( "Spolyrrhiza9509S001 Cufflinks exon 26722 26764 . - . Parent=TCONS_00001425" ) self.actual_trans = Transcript(exon1) actual_exon1 = "Spolyrrhiza9509S001 Cufflinks exon 24497 24656 . - . Parent=TCONS_00001425" actual_exon2 = "Spolyrrhiza9509S001 Cufflinks exon 24809 24938 . - . Parent=TCONS_00001425" actual_exon3 = "Spolyrrhiza9509S001 Cufflinks exon 26237 26599 . - . Parent=TCONS_00001425" self.actual_exon1 = Exon(actual_exon1) self.actual_exon2 = Exon(actual_exon2) self.actual_exon3 = Exon(actual_exon3) self.exon1 = Transcript(exon1) self.exon2 = Transcript(exon2) self.exon3 = Transcript(exon3) return ret """ Tests comparison on RNAseq format """ def testTranscriptComparison(self): self.assertGreater(self.exon2, self.exon1) self.assertGreater(self.exon3, self.exon1) self.assertGreater(self.exon2, self.exon3) self.assertLess(self.exon1, self.exon2) self.assertLess(self.exon1, self.exon3) self.assertLess(self.exon3, self.exon2) self.assertEqual(self.exon1, self.exon1) def testBaseGetDicFormat(self): actual = self.actual_exon.getDicFormat() expected = {"name": "TCONS_00001425", "start": 26722, "stop": 26764} self.assertEqual(actual, expected) def testBaseConstructor(self): self.assertEqual(self.exon1.start, 1439) self.assertEqual(self.exon1.stop, 1564) self.assertEqual(self.exon1.getLabel(), "gene") self.assertEqual(self.exon1.parent, "TCONS_00001425") self.assertEqual(len(self.exon1), 125) self.assertEqual( str(self.exon1), "TCONS_00001425 . gene 1439 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" ) self.assertEqual(self.exon1.partial, "partial") self.assertEqual(self.exon1.strand, "-") def testBadPositions(self): tester = "TCONS_00001425 . gene 2000 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass tester = "TCONS_00001425 . gene 1564 1564 . - . ID=g.11422;Name=ORF%20g.11422%20m.11422%20type%3A5prime_partial%20len%3A42%20%28-%29" try: Exon(tester) self.fail("No exception thrown") except: pass def testSetLenth(self): self.exon1.setLength(2222) self.assertEqual(len(self.exon1), 2222) def testSwitchStrand(self): self.exon1.switchStrand() self.assertEquals(self.exon1.strand, "+") def testGetExonDicFormat(self): temp = self.actual_trans temp.addExon(self.actual_exon1) temp.addExon(self.actual_exon2) temp.addExon(self.actual_exon3) actual = temp.getExonDicList() expected = [{ "start": 24497, "stop": 24656, "name": "TCONS_00001425" }, { "start": 24809, "stop": 24938, "name": "TCONS_00001425" }, { "start": 26237, "stop": 26599, "name": "TCONS_00001425" }] self.assertEqual(actual, expected)