def _get_chosen_tx_and_transcript_ds(self, chrom, loc): config = TestUtils.createUnitTestConfig() transcript_ds = TestUtils.createTranscriptProviderDatasource(config) transcript_ds.set_tx_mode(TranscriptProvider.TX_MODE_CANONICAL) start_txs = transcript_ds.get_transcripts_by_pos(chr=chrom, start=str(loc), end=str(loc)) chosen_tx = transcript_ds._choose_transcript(start_txs, transcript_ds.get_tx_mode(), VariantClassification.VT_SNP, "", "", str(loc), str(loc)) return chosen_tx, transcript_ds
def test_retrieve_transcripts_from_region(self): """Test that we can retrieve a large number of transcripts. Requires a full gencode datasource.""" config = TestUtils.createUnitTestConfig() transcript_ds = TestUtils.createTranscriptProviderDatasource(config) filtered_txs = transcript_ds.get_transcripts_by_pos(chr="1", start="1", end="100000000") self.assertTrue(len(filtered_txs) > 4000) gene_set = set([tx.get_gene() for tx in filtered_txs]) self.assertTrue(len(gene_set) > 1500)
def test_single_sample_onp_combiner(self): """test that we can create an onp combined TCGA maf without crashing""" input_filename = 'testdata/maflite/onp.singlesample.maf.txt' output_filename = 'out/testSingleSampleOnpCombiner.maf' config = TestUtils.createUnitTestConfig() defaultdb = config.get('DEFAULT',"dbDir") spec = RunSpecificationFactory.create_run_spec("MAFLITE","TCGAMAF", input_filename, output_filename,datasourceDir=defaultdb, other_opts={OptionConstants.INFER_ONPS: True}) annotator = Annotator() annotator.initialize(spec) annotator.annotate()
def test_single_sample_onp_combiner(self): """test that we can create an onp combined TCGA maf without crashing""" input_filename = 'testdata/maflite/onp.singlesample.maf.txt' output_filename = 'out/testSingleSampleOnpCombiner.maf' config = TestUtils.createUnitTestConfig() defaultdb = config.get('DEFAULT',"dbDir") spec = RunSpecificationFactory.create_run_spec("MAFLITE","TCGAMAF", input_filename, output_filename, datasource_dir=defaultdb, other_opts={OptionConstants.INFER_ONPS: True}) annotator = Annotator() annotator.initialize(spec) annotator.annotate()
def test_protein_position_off_by_one(self, chrom, start, end, ref, alt, gt_prot_change): config = TestUtils.createUnitTestConfig() transcript_ds = TestUtils.createTranscriptProviderDatasource(config) cc_txs_fp = file("testdata/tx_exact_uniprot_matches.txt", 'r') cc_txs = [tx.rsplit(".", 1)[0] for tx in cc_txs_fp] cc_txs.append("ENST00000338368") # Add a transcript that is not exactly the same, but close cc_txs_fp.close() transcript_ds.set_custom_canonical_txs(cc_txs) m = MutationData() m.chr = chrom m.start = start m.end = end m.ref_allele = ref m.alt_allele = alt m2 = transcript_ds.annotate_mutation(m) self.assertEqual(m2['protein_change'], gt_prot_change)
def test_protein_position_off_by_one(self, chrom, start, end, ref, alt, gt_prot_change): config = TestUtils.createUnitTestConfig() transcript_ds = TestUtils.createTranscriptProviderDatasource(config) cc_txs_fp = file("testdata/tx_exact_uniprot_matches.txt", 'r') cc_txs = [tx.rsplit(".", 1)[0] for tx in cc_txs_fp] cc_txs.append("ENST00000338368") # Add a transcript that is not exactly the same, but close cc_txs_fp.close() transcript_ds.set_custom_canonical_txs(cc_txs) m = MutationDataFactory.default_create() m.chr = chrom m.start = start m.end = end m.ref_allele = ref m.alt_allele = alt m2 = transcript_ds.annotate_mutation(m) self.assertEqual(m2['protein_change'], gt_prot_change)
def test_onp_combiner_snp_then_multiallelic(self): """test that we can handle reading a SNP then multiallelic from a VCF without crashing""" input_filename = 'testdata/vcf/infer_onp_fail_snp_then_multiallelic.vcf' output_filename = 'out/testSNPThenMultiallelic.maf.annotated' config = TestUtils.createUnitTestConfig() default_db = config.get('DEFAULT', "dbDir") spec = RunSpecificationFactory.create_run_spec( "VCF", "TCGAMAF", input_filename, output_filename, datasource_dir=default_db, is_skip_no_alts=True, other_opts={ OptionConstants.INFER_ONPS: True, OptionConstants.COLLAPSE_NUMBER_ANNOTATIONS: True }) annotator = Annotator() annotator.initialize(spec) annotator.annotate()
def setUp(self): self.config = TestUtils.createUnitTestConfig() pass
def setUp(self): self.config = TestUtils.createUnitTestConfig()