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


Python MutationDataFactory.create方法代码示例

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


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

示例1: initializeMutFromAttributes

# 需要导入模块: from oncotator.MutationDataFactory import MutationDataFactory [as 别名]
# 或者: from oncotator.MutationDataFactory.MutationDataFactory import create [as 别名]
    def initializeMutFromAttributes(chr, start, end, ref_allele, alt_allele, build, mutation_data_factory=None):
        mutation_data_factory = MutationDataFactory() if mutation_data_factory is None else mutation_data_factory
        mut = mutation_data_factory.create(str(chr), str(start), str(end), ref_allele, alt_allele, str(build))
        varType = TranscriptProviderUtils.infer_variant_type(mut.ref_allele, mut.alt_allele)

        if TranscriptProviderUtils.is_xnp(varType):  # Snps and other xNPs
            mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME, annotationValue="")
        if varType == VariantClassification.VT_DEL:  # deletion
            preceding_bases, updated_ref_allele, updated_start, updated_end =\
                MutUtils.retrievePrecedingBasesForDeletions(mut)
            mut.ref_allele = updated_ref_allele
            mut["ref_allele"] = updated_ref_allele
            mut.alt_allele = "-"
            mut["alt_allele"] = "-"
            mut.start = updated_start
            mut["start"] = updated_start
            mut.end = updated_end
            mut["end"] = updated_end
            mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
                                 annotationValue=preceding_bases)
        elif varType == VariantClassification.VT_INS:  # insertion
            preceding_bases, updated_alt_allele, updated_start, updated_end = \
                MutUtils.retrievePrecedingBasesForInsertions(mut)
            mut.ref_allele = "-"
            mut["ref_allele"] = "-"
            mut.alt_allele = updated_alt_allele
            mut["alt_allele"] = updated_alt_allele
            mut.start = updated_start
            mut["start"] = updated_start
            mut.end = updated_end
            mut["end"] = updated_end
            mut.createAnnotation(annotationName=MutUtils.PRECEDING_BASES_ANNOTATION_NAME,
                                 annotationValue=preceding_bases)

        return mut
开发者ID:Tmacme,项目名称:oncotator,代码行数:37,代码来源:MutUtils.py

示例2: test_annotation_overwriting_on

# 需要导入模块: from oncotator.MutationDataFactory import MutationDataFactory [as 别名]
# 或者: from oncotator.MutationDataFactory.MutationDataFactory import create [as 别名]
    def test_annotation_overwriting_on(self):
        """Test that the factory can produce a mutation that allows overwriting.  Just need to make sure no exception thrown."""
        mdf = MutationDataFactory(allow_overwriting=True)
        mut = mdf.create()

        mut.createAnnotation("blah", "123")
        self.assertTrue(mut['blah'] == "123")

        mut.createAnnotation("blah", "456")
        self.assertTrue(mut['blah'] == "456")
开发者ID:Tmacme,项目名称:oncotator,代码行数:12,代码来源:MutationDataFactoryTest.py

示例3: test_annotation_overwriting_off

# 需要导入模块: from oncotator.MutationDataFactory import MutationDataFactory [as 别名]
# 或者: from oncotator.MutationDataFactory.MutationDataFactory import create [as 别名]
    def test_annotation_overwriting_off(self):
        """Test that the factory can produce a mutation that does not allow overwriting.  Make sure DuplicateAnnotationException is thrown."""
        mdf = MutationDataFactory(allow_overwriting=False)
        mut = mdf.create()

        mut.createAnnotation("blah", "123")
        self.assertTrue(mut['blah'] == "123")

        is_exception_raised = False
        try:
            mut.createAnnotation("blah", "456")
        except DuplicateAnnotationException as dae:
            is_exception_raised = True

        self.assertTrue(is_exception_raised, "DuplicateAnnotationException should have been seen, but wasn't")
开发者ID:Tmacme,项目名称:oncotator,代码行数:17,代码来源:MutationDataFactoryTest.py


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