def testSimpleRead(self): """ Read a good maflite file and make sure that each mutation validates """ tmp = MafliteInputMutationCreator("testdata/maflite/Patient0.indel.maf.txt", 'configs/maflite_input.config') muts = tmp.createMutations() # If no exception is thrown, then this test passes. for m in muts: MutUtils.validateMutation(m)
def testSimpleRead(self): """ Read a good maflite file and make sure that each mutation validates """ tmp = MafliteInputMutationCreator( "testdata/maflite/Patient0.indel.maf.txt", None, 'configs/maflite_input.config') muts = tmp.createMutations() # If no exception is thrown, then this test passes. for m in muts: MutUtils.validateMutation(m)
def testNoUnknownAnnotations(self): """ Make sure that the gaf 3.0 datasource does not annotate anything with source set to Unknown """ inputCreator = MafliteInputMutationCreator('testdata/maflite/Patient0.snp.maf.txt') gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config) mutations = inputCreator.createMutations() for m in mutations: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) unknownAnnotations = MutUtils.getUnknownAnnotations(m) self.assertTrue(len(unknownAnnotations) == 0, "Unknown annotations exist in mutation: " + str(unknownAnnotations))
def testChrGLs(self): """ Test that mutations on unaligned transcripts can be annotated properly. I.e. when chromosome = GL.....""" inputCreator = MafliteInputMutationCreator('testdata/maflite/chrGLs.maf.tsv', "configs/maflite_input.config") gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config) mutations = inputCreator.createMutations() for m in mutations: try: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) except Exception as e: # Fail this test because an exception was thrown self.assertTrue(False, "Erroneous exception was thrown: " + str(e) + "\n" + traceback.format_exc()) self.assertTrue(m['gene'] != '')
def testNoLostMutations(self): """ Does a simple gaf datasource annotation run and makes sure that no mutations were lost """ inputFilename = 'testdata/maflite/Patient0.snp.maf.txt' inputCreator = MafliteInputMutationCreator(inputFilename, "configs/maflite_input.config") gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config) numMutsInput = len(file(inputFilename, 'r').readlines()) - 1 mutations = inputCreator.createMutations() ctr = 0 for m in mutations: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) ctr += 1 self.assertEqual(ctr, numMutsInput, "Gaf data source altered mutation count.")
def testNoUnknownAnnotations(self): """ Make sure that the gaf 3.0 datasource does not annotate anything with source set to Unknown """ inputCreator = MafliteInputMutationCreator( 'testdata/maflite/Patient0.snp.maf.txt') gafDatasource = TestUtils.createTranscriptProviderDatasource( self.config) mutations = inputCreator.createMutations() for m in mutations: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) unknownAnnotations = MutUtils.getUnknownAnnotations(m) self.assertTrue( len(unknownAnnotations) == 0, "Unknown annotations exist in mutation: " + str(unknownAnnotations))
def testChrGLs(self): """ Test that mutations on unaligned transcripts can be annotated properly. I.e. when chromosome = GL.....""" inputCreator = MafliteInputMutationCreator( 'testdata/maflite/chrGLs.maf.tsv', "configs/maflite_input.config") gafDatasource = TestUtils.createTranscriptProviderDatasource( self.config) mutations = inputCreator.createMutations() for m in mutations: try: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) except Exception as e: # Fail this test because an exception was thrown self.assertTrue( False, "Erroneous exception was thrown: " + str(e) + "\n" + traceback.format_exc()) self.assertTrue(m['gene'] != '')
def testNoLostMutations(self): """ Does a simple gaf datasource annotation run and makes sure that no mutations were lost """ inputFilename = 'testdata/maflite/Patient0.snp.maf.txt' inputCreator = MafliteInputMutationCreator( inputFilename, "configs/maflite_input.config") gafDatasource = TestUtils.createTranscriptProviderDatasource( self.config) numMutsInput = len(file(inputFilename, 'r').readlines()) - 1 mutations = inputCreator.createMutations() ctr = 0 for m in mutations: m = gafDatasource.annotate_mutation(m) MutUtils.validateMutation(m) ctr += 1 self.assertEqual(ctr, numMutsInput, "Gaf data source altered mutation count.")