def testMismatchNames(self):
     trans = {"start": 1, "stop": 648, "name": "not a name"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for name mismatch.")
     except:
         pass
 def testMismatchNames(self):
     trans = {"start":1, "stop": 648, "name":"not a name"}
     try:
         cds = build_coordinates(self.gene,trans)
         self.fail("expected exception for name mismatch.")
     except:
         pass
 def testMiddle(self):
     trans = {"start": 147, "stop": 550, "name":"off1end"}
     cds = build_coordinates(self.gene, trans)
     expect =   [{ "start": 301, "stop": 700},
                 { "start": 801, "stop": 804}
                 ]
     self.assertEqual(expect, cds, "included last region") 
 def testNegativeNumbers(self):
     trans = {"start": -200, "stop": 400, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene,trans)
         self.fail("expected exception for negative number.")
     except:
         pass
     trans = {"start": 200, "stop": -400, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for negative number")
     except:
         pass
     trans = {"start": -200, "stop": -100, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for negative number")
     except:
         pass
 def testTooShort(self):
     trans = {"start": 1, "stop": 646, "name":"off1end"}
     cds = build_coordinates(self.gene, trans)
     expect =   [{ "start": 101, "stop": 105},
                                  { "start": 111, "stop": 200},
                                  { "start": 225, "stop": 275},
                                  { "start": 301, "stop": 700},
                                  { "start": 801, "stop": 900}
                                  ]
     self.assertEqual(expect, cds, "included last region") #should map off by one
 def testNegativeNumbers(self):
     trans = {"start": -200, "stop": 400, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for negative number.")
     except:
         pass
     trans = {"start": 200, "stop": -400, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for negative number")
     except:
         pass
     trans = {"start": -200, "stop": -100, "name": "off1end"}
     try:
         cds = build_coordinates(self.gene, trans)
         self.fail("expected exception for negative number")
     except:
         pass
 def testCorrectPlusPlus(self):
     """
         Plus Plus works exactly as expected. No reverse transcription required. ATG appears immediately
         at final[522:3012], and the sequence in the transdecoder.cds match the subsequence.
     """
     gene = {'start': 74641, 'stop': 78761, 'name':'plusplus', 
             'exons': ({ 'start': 74641, 'stop': 76014 } , 
                       { 'start': 76111, 'stop': 76277 } , 
                       { 'start': 76368, 'stop': 76465 } ,
                       { 'start': 76558, 'stop': 76914 } ,
                       { 'start': 77029, 'stop': 77445 } ,
                       { 'start': 77628, 'stop': 78761 }
                      )}
     transcript = {'name':'plusplus', 'start': 523, 'stop':3012}
     cds = build_coordinates(gene, transcript) #??? what should this do... 
     # should equal start-1:stop
     self.assertEqual(self.plusplusgen[522:3012], self.plusplusorf)
 def testTooShort(self):
     trans = {"start": 1, "stop": 646, "name": "off1end"}
     cds = build_coordinates(self.gene, trans)
     expect = [{
         "start": 101,
         "stop": 105
     }, {
         "start": 111,
         "stop": 200
     }, {
         "start": 225,
         "stop": 275
     }, {
         "start": 301,
         "stop": 700
     }, {
         "start": 801,
         "stop": 900
     }]
     self.assertEqual(expect, cds,
                      "included last region")  #should map off by one
 def testCorrectPlusPlus(self):
     """
         Plus Plus works exactly as expected. No reverse transcription required. ATG appears immediately
         at final[522:3012], and the sequence in the transdecoder.cds match the subsequence.
     """
     gene = {
         'start':
         74641,
         'stop':
         78761,
         'name':
         'plusplus',
         'exons': ({
             'start': 74641,
             'stop': 76014
         }, {
             'start': 76111,
             'stop': 76277
         }, {
             'start': 76368,
             'stop': 76465
         }, {
             'start': 76558,
             'stop': 76914
         }, {
             'start': 77029,
             'stop': 77445
         }, {
             'start': 77628,
             'stop': 78761
         })
     }
     transcript = {'name': 'plusplus', 'start': 523, 'stop': 3012}
     cds = build_coordinates(gene, transcript)  #??? what should this do...
     # should equal start-1:stop
     self.assertEqual(self.plusplusgen[522:3012], self.plusplusorf)
 def testSingleExon(self):
     trans = {"start":6, "stop": 48, "name":"off1end"}
     cds = build_coordinates(self.gene, trans)
     expect = [{"start": 111, "stop":153}]
     self.assertEqual(expect, cds)
 def testTooLong(self):
     trans = {"start": 1, "stop": 648, "name":"off1end"}
     cds = build_coordinates(self.gene, trans)
     self.assertEqual(self.gene['exons'], cds, "Did not correct for an input that goes past maximum length") 
 def testPerfectMatch(self):
     trans = {"start": 1, "stop": 647, "name":"off1end"}
     cds = build_coordinates(self.gene, trans)
     self.assertEqual(self.gene['exons'], cds, "Full gene does not match.") #should map perfectly
 def testSingleExon(self):
     trans = {"start": 6, "stop": 48, "name": "off1end"}
     cds = build_coordinates(self.gene, trans)
     expect = [{"start": 111, "stop": 153}]
     self.assertEqual(expect, cds)
 def testMiddle(self):
     trans = {"start": 147, "stop": 550, "name": "off1end"}
     cds = build_coordinates(self.gene, trans)
     expect = [{"start": 301, "stop": 700}, {"start": 801, "stop": 804}]
     self.assertEqual(expect, cds, "included last region")
 def testTooLong(self):
     trans = {"start": 1, "stop": 648, "name": "off1end"}
     cds = build_coordinates(self.gene, trans)
     self.assertEqual(
         self.gene['exons'], cds,
         "Did not correct for an input that goes past maximum length")
 def testPerfectMatch(self):
     trans = {"start": 1, "stop": 647, "name": "off1end"}
     cds = build_coordinates(self.gene, trans)
     self.assertEqual(self.gene['exons'], cds,
                      "Full gene does not match.")  #should map perfectly