当前位置: 首页>>代码示例>>Python>>正文


Python TestUtils.createTranscriptProviderDatasource方法代码示例

本文整理汇总了Python中TestUtils.TestUtils.createTranscriptProviderDatasource方法的典型用法代码示例。如果您正苦于以下问题:Python TestUtils.createTranscriptProviderDatasource方法的具体用法?Python TestUtils.createTranscriptProviderDatasource怎么用?Python TestUtils.createTranscriptProviderDatasource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestUtils.TestUtils的用法示例。


在下文中一共展示了TestUtils.createTranscriptProviderDatasource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testCreationAndAnnotation

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testCreationAndAnnotation(self):
        """ Test the datasource creation and then do a simple annotation
        """
        outputFilename = 'out/genericGeneProteinPositionTest.out.tsv'

        gafDS = TestUtils.createTranscriptProviderDatasource(self.config)
        gppDS = DatasourceFactory.createDatasource("testdata/simple_uniprot_natvar/simple_uniprot_natvar.config", "testdata/simple_uniprot_natvar/")

        annotator = Annotator()
        annotator.setInputCreator(MafliteInputMutationCreator('testdata/maflite/tiny_maflite_natvar.maf.tsv'))
        annotator.setOutputRenderer(SimpleOutputRenderer(outputFilename))
        annotator.addDatasource(gafDS)
        annotator.addDatasource(gppDS)
        testFilename = annotator.annotate()

        # Make sure that some values were populated
        self.assertTrue(os.path.exists(testFilename))
        tsvReader = GenericTsvReader(testFilename)

        ctr = 0
        for lineDict in tsvReader:
            colName = "UniProt_NatVar_natural_variations"
            self.assertTrue(sorted(lineDict[colName].split("|")) == sorted("R -> RR (in EDMD2).|R -> Q (in EDMD2).".split("|")), "Annotation value did not match: " + lineDict[colName])
            ctr += 1

        self.assertTrue(ctr == 1, "Number of mutations incorrect (1): " + str(ctr) )
开发者ID:alexramos,项目名称:oncotator,代码行数:28,代码来源:GenericGeneProteinPositionDatasourceTest.py

示例2: testSpliceSiteWithinNBases

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testSpliceSiteWithinNBases(self):
        """Test that a silent mutation is changed to splice site w/in 10 bases of a splice site """
        # chr21:10,998,326-10,998,346
        # 10,998,336 is a splice site.  (Junction between 10998335 and 336)
        # AGTTCTCCTT C TGGAAAAAAG
        refs = 'AGTTCTCCTTCTGGAAAAAAG'
        alts = 'TCAGACTGAAAATACCCCCCT'
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
        vcs = []
        for s in range(10998326, 10998347):
            m = MutationDataFactory.default_create()
            m.start = str(s)
            m.end = str(s)
            m.chr = "21"
            m.ref_allele = refs[s - 10998326]
            m.alt_allele = alts[s - 10998326]

            m = gafDatasource.annotate_mutation(m)

            distanceFromSpliceSite = abs(10998336 - int(m.start))
            vc = m['variant_classification']
            self.assertTrue(vc != 'Silent', 'Silent mutation found when it should be a splice site.')

            vcs.append(vc)
            print vc + "  " + m.start

        self.assertTrue(all([tmp == "Splice_Site" for tmp in vcs[8:12]]), "Not all vcs within 2 bases were splice site: " + str(vcs[8:12]))
        self.assertTrue(all([tmp != "Splice_Site" for tmp in vcs[0:8]]), "No splice sites should be seen: " + str(vcs[0:8]))
        self.assertTrue(all([tmp != "Splice_Site" for tmp in vcs[12:20]]), "No splice sites should be seen: " + str(vcs[12:20]))
开发者ID:Tmacme,项目名称:oncotator,代码行数:31,代码来源:GafDatasourceTest.py

示例3: testSilentMutationGoingToSpliceSite

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testSilentMutationGoingToSpliceSite(self):
        """Test that a silent mutation within 10 bp of a splice junction should become a splice site"""
        #chr1:28,233,780-28,233,805 Junction is at chr1:28,233,793 & 94
        #

        refs = "TGGGCTCGGGCTCTCTGAAAAGAAAA"
        alts = "TGGGCTCAGGCTCGCTGAAAAGAAAA"
        vcs = []
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
        numSpliceSites = 0
        numSilent = 0
        startWindow = 28233780
        for s in range(startWindow, 28233806):
            m = MutationDataFactory.default_create()
            m.start = str(s)
            m.end = str(s)
            m.chr = "1"
            m.ref_allele = refs[s - startWindow]
            m.alt_allele = alts[s - startWindow]

            m = gafDatasource.annotate_mutation(m)

            distanceFromSpliceSite = abs(28233793 - int(m.start))
            vc = m['variant_classification']
            vcs.append(vc)
            # self.assertTrue(vc <> 'Silent', 'Silent mutation found when it should be a splice site.')

            if vc.lower() == "splice_site":
                numSpliceSites += 1
            if vc.lower() == "silent":
                numSilent += 1
            print vc + "  " + m.start + "  " + str(distanceFromSpliceSite)

        self.assertTrue(numSpliceSites == 4, "Should have seen 4 splice site mutations, but saw: " + str(numSpliceSites))
        self.assertTrue(numSilent == 11, "Should have seen 11 Silent mutations, but saw: " + str(numSilent))
开发者ID:Tmacme,项目名称:oncotator,代码行数:37,代码来源:GafDatasourceTest.py

示例4: testRealWorld

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testRealWorld(self):
        """Test that the full COSMIC datasource can retrieve entries by both gp and gpp."""
        gafDS = TestUtils.createTranscriptProviderDatasource(self.config)
        cosmicDS = TestUtils.createCosmicDatasource(self.config)

        # These values are not taken from a real world scenario, but are cooked for this test.

        m = MutationData()
        m.chr = '1'
        m.start = '12941796'
        m.end = '12941796'
        m.ref_allele = "G"
        m.alt_allele = "T"
        m = gafDS.annotate_mutation(m)
        m = cosmicDS.annotate_mutation(m)

        self.assertTrue(m['COSMIC_n_overlapping_mutations'] == '0')

        #1	150483621	150483621
        m = MutationData()
        m.chr = '1'
        m.start = '150483621'
        m.end = '150483621'
        m.ref_allele = "G"
        m.alt_allele = "T"
        m = gafDS.annotate_mutation(m)
        m = cosmicDS.annotate_mutation(m)
开发者ID:alexramos,项目名称:oncotator,代码行数:29,代码来源:CosmicDatasourceTest.py

示例5: test_denovo

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def test_denovo(self):
        """GAF de novo test """
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)

        m = MutationDataFactory.default_create()
        m.start = str(22221735)
        m.end = str(22221737)
        m.chr="22"
        m.ref_allele = ''
        m.alt_allele = 'CAT'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['variant_classification'] == 'De_novo_Start_OutOfFrame')

        m = MutationDataFactory.default_create()
        m.start = str(22221735)
        m.end = str(22221740)
        m.chr="22"
        m.ref_allele = ''
        m.alt_allele = 'AACATAA'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['variant_classification'] == 'De_novo_Start_OutOfFrame')

        m = MutationDataFactory.default_create()
        m.start = str(22221735)
        m.end = str(22221739)
        m.chr="22"
        m.ref_allele = ''
        m.alt_allele = 'ACATAA'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['variant_classification'] == 'De_novo_Start_InFrame')
开发者ID:Tmacme,项目名称:oncotator,代码行数:32,代码来源:GafDatasourceTest.py

示例6: testFlank

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testFlank(self):
        """Test that we can see a Flank mutation."""
        #chr1:28,233,780-28,233,805 Junction is at chr1:28,233,793 & 94
        #

        refs = "TGGGCTCGGGCTCTCTGAAAAGAAAA"
        alts = "TGGGCTCAGGCTCTCTGAAAAGAAAA"
        vcs = []
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
        numSpliceSites = 0
        numSilent = 0
        startWindow = 11042200
        for s in range(startWindow, startWindow+len(refs)):
            m = MutationDataFactory.default_create()
            m.start = str(s)
            m.end = str(s)
            m.chr="1"
            m.ref_allele = refs[s-startWindow]
            m.alt_allele = alts[s-startWindow]

            m = gafDatasource.annotate_mutation(m)

            vc = m['variant_classification']
            vcs.append(vc)

            print vc + "  " + m.start

        pass
开发者ID:Tmacme,项目名称:oncotator,代码行数:30,代码来源:GafDatasourceTest.py

示例7: test_effect_tx_mode

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def test_effect_tx_mode(self):
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
        gafDatasource.set_tx_mode(TranscriptProvider.TX_MODE_BEST_EFFECT)

        # Canonical mutation was Intron
        m = MutationDataFactory.default_create()
        m.chr = '2'
        m.start = '219137340'
        m.end = '219137340'
        m.ref_allele = 'G'
        m.alt_allele = 'T'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['gene'] == "PNKD")
        self.assertTrue(m['variant_classification'] == "Missense_Mutation")

        gafDatasource.set_tx_mode(TranscriptProvider.TX_MODE_CANONICAL)
        m = MutationDataFactory.default_create()
        m.chr = '2'
        m.start = '219137340'
        m.end = '219137340'
        m.ref_allele = 'G'
        m.alt_allele = 'T'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['gene'] == "PNKD")
        self.assertTrue(m['variant_classification'] == "Intron", "Canonical no longer is Intron.  This test is no longer valid.  This failure can come up when changing the GAF datasource.")
开发者ID:Tmacme,项目名称:oncotator,代码行数:27,代码来源:GafDatasourceTest.py

示例8: testExonRetrievalForGene

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
 def testExonRetrievalForGene(self):
     """Make sure that the GAF datasource can retrieve exons, given a gene"""
     testGeneList = ['CEBPA', 'BRCA1', 'PIK3CA']
     gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
     for gene in testGeneList:
         exons = gafDatasource.retrieveExons(gene, isCodingOnly=True)
         self.assertTrue(exons is not None)
         print(str(exons))
开发者ID:Tmacme,项目名称:oncotator,代码行数:10,代码来源:GafDatasourceTest.py

示例9: testChangeInTxModeChangesHashcode

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testChangeInTxModeChangesHashcode(self):
        """Test that a change in the tx-mode will change the hashcode"""
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)

        gafDatasource.set_tx_mode(TranscriptProvider.TX_MODE_BEST_EFFECT)
        old_hashcode = gafDatasource.get_hashcode()
        gafDatasource.set_tx_mode(TranscriptProvider.TX_MODE_CANONICAL)
        new_hashcode = gafDatasource.get_hashcode()
        self.assertTrue(old_hashcode != new_hashcode)
开发者ID:Tmacme,项目名称:oncotator,代码行数:11,代码来源:GafDatasourceTest.py

示例10: testNoUnknownAnnotations

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
 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))
开发者ID:Tmacme,项目名称:oncotator,代码行数:12,代码来源:GafDatasourceTest.py

示例11: testBasicDatasourceSorting

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def testBasicDatasourceSorting(self):
        """Test that the GAF datasource is sorted before a gene-based datasource"""

        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
        geneDS = DatasourceFactory.createDatasource("testdata/small_tsv_ds/small_tsv_ds.config", "testdata/small_tsv_ds/")
        
        incorrectSortList = [geneDS, gafDatasource]
        guessSortList =  DatasourceFactory.sortDatasources(incorrectSortList)
        self.assertTrue(guessSortList[1] == geneDS, "Sorting is incorrect.")
        self.assertTrue(len(guessSortList) == 2, "Sorting altered number of datasources (gt: 2): " + str(len(guessSortList)))
开发者ID:Tmacme,项目名称:oncotator,代码行数:12,代码来源:DatasourceFactoryTest.py

示例12: testVersionHeader

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
 def testVersionHeader(self):
     """ This method simply tests that the version string returned by the annotator does not cause an exception.
         Minimal checking that the returned sting is actually correct.
         Does not attempt to initialize input or output.  Only a gaf datasource.
      """
     annotator = Annotator()
     annotator.addDatasource(TestUtils.createTranscriptProviderDatasource(self.config))
     tmp = annotator.createHeaderString()
     self.assertTrue(tmp.find("Gaf ") != -1 or tmp.find("GENCODE") != -1, "Could not find Gaf or GENCODE version in header string.")
     self.assertTrue(tmp.find("Oncotator") != -1, "Could not find the word Oncotator in header string.")
开发者ID:alexramos,项目名称:oncotator,代码行数:12,代码来源:AnnotatorTest.py

示例13: testAKT1

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
 def testAKT1(self):
     """ Test that this version of the GAF produces the up to date gene for a position given from a website user.
     """
     m = MutationDataFactory.default_create()
     m.chr = '14'
     m.start = '105246407'
     m.end = '105246407'
     m.ref_allele = 'G'
     m.alt_allele = 'A'
     gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
     m = gafDatasource.annotate_mutation(m)
     self.assertTrue(m['gene'] == "AKT1", "Incorrect gene found: " + m['gene'] + "  If updating GAF, this may not be an error, but should be confirmed manually.")
开发者ID:Tmacme,项目名称:oncotator,代码行数:14,代码来源:GafDatasourceTest.py

示例14: test_start_codon

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
    def test_start_codon(self):
        """Test a start codon hit in a GAF datasource"""
        gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)

        m = MutationDataFactory.default_create()
        m.start = str(22221729)
        m.end = str(22221729)
        m.chr="22"
        m.ref_allele = 'A'
        m.alt_allele = 'T'
        m = gafDatasource.annotate_mutation(m)
        self.assertTrue(m['variant_classification'] == VariantClassification.MISSENSE)
开发者ID:Tmacme,项目名称:oncotator,代码行数:14,代码来源:GafDatasourceTest.py

示例15: testExonRetrievalForGenesFromFile

# 需要导入模块: from TestUtils import TestUtils [as 别名]
# 或者: from TestUtils.TestUtils import createTranscriptProviderDatasource [as 别名]
 def testExonRetrievalForGenesFromFile(self):
     """Make sure that the GAF datasource can retrieve exons, given a list of genes from a simple file"""
     inputGeneList = file('testdata/testGeneList.txt', 'r')
     outputFileFP = file("out/testGeneListExons.txt", 'w')
     errorFileFP = file("out/testGeneListExons.err.txt", 'w')
     gafDatasource = TestUtils.createTranscriptProviderDatasource(self.config)
     for line in inputGeneList:
         gene = line.strip()
         exons = gafDatasource.retrieveExons(gene, isCodingOnly=True)
         if len(exons) == 0:
             errorFileFP.write("Could not locate " + gene + "\n")
         for e in exons:
             outputFileFP.write('%s\t%s\t%s\t%s\n' % (e[0], e[1], e[2], e[3]))
开发者ID:Tmacme,项目名称:oncotator,代码行数:15,代码来源:GafDatasourceTest.py


注:本文中的TestUtils.TestUtils.createTranscriptProviderDatasource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。