• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python plugins.VcfPlugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中puzzle.plugins.VcfPlugin的典型用法代码示例。如果您正苦于以下问题:Python VcfPlugin类的具体用法?Python VcfPlugin怎么用?Python VcfPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_add_most_severe

def test_add_most_severe(variant):
    plugin = VcfPlugin()
    
    variant.consequences = ['downstream_gene_variant', 'stop_gained']
    plugin._add_most_severe_consequence(variant)
    
    assert variant.most_severe_consequence == 'stop_gained'
开发者ID:J35P312,项目名称:puzzle,代码行数:7,代码来源:test_consequence_extras.py


示例2: test_individual

def test_individual(case_obj):
    adapter=VcfPlugin()
    adapter.add_case(case_obj)
    
    ind_id = "ADM1059A1"
    ind_obj = adapter.individual(ind_id)
    assert ind_obj.ind_id == ind_id
开发者ID:J35P312,项目名称:puzzle,代码行数:7,代码来源:test_vcf_case_mixin.py


示例3: test_add_impact_severity

def test_add_impact_severity(variant):
    plugin = VcfPlugin()
    
    variant.most_severe_consequence = 'stop_gained'
    plugin._add_impact_severity(variant)
    
    assert variant.impact_severity == 'HIGH'
开发者ID:J35P312,项目名称:puzzle,代码行数:7,代码来源:test_consequence_extras.py


示例4: test_variant

def test_variant():
    vcf_plugin = VcfPlugin(root_path=vcf)
    variant = vcf_plugin.variant('hapmap.vcf', 'X_155239821_G_A')
    assert variant['CHROM'] == 'X'
    assert variant['POS'] == '155239821'

    # get 10th variant
    variant = vcf_plugin.variant('hapmap.vcf', '3_124998098_C_A')
    assert variant['index'] == 10
开发者ID:brainstorm,项目名称:puzzle,代码行数:9,代码来源:test_vcf.py


示例5: test_filters_no_filter

    def test_filters_no_filter(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {}
        result = plugin.variants(case_id, filters=filters, count=1000)
        
        assert result.nr_of_variants == 108
开发者ID:J35P312,项目名称:puzzle,代码行数:9,代码来源:test_vcf_variant_mixin.py


示例6: test_add_compounds

def test_add_compounds(variant):
    plugin = VcfPlugin()
    info_dict = {
        'Compounds': "643594:11_120999413_G_A>24|11_120988038_T_G>23|11_120991571_G_A>10|11_121028581_C_G>36"
    }
    plugin._add_compounds(variant, info_dict)
    compounds = variant.compounds
    highest_scored_compound = compounds[0]
    assert int(highest_scored_compound.combined_score) == 36
开发者ID:J35P312,项目名称:puzzle,代码行数:9,代码来源:test_annotations_mixin.py


示例7: test_variant

def test_variant(case_obj):
    vcf_plugin = VcfPlugin()
    vcf_plugin.add_case(case_obj)

    variant = vcf_plugin.variant(case_obj.case_id, 'X_155239821_G_A')
    assert variant['CHROM'] == 'X'
    assert int(variant['POS']) == 155239821

    # get 10th variant
    variant = vcf_plugin.variant(case_obj.case_id, '3_124998098_C_A')
    assert variant['index'] == 10
开发者ID:J35P312,项目名称:puzzle,代码行数:11,代码来源:test_vcf_variant_mixin.py


示例8: test_format_variants

def test_format_variants(cyvcf_variant, case_obj, header):
    vcf_plugin = VcfPlugin()
    vcf_plugin.head = header
    vcf_plugin.vep_header = header.vep_columns
    vcf_plugin.snpeff_header = header.snpeff_columns

    variant_obj = vcf_plugin._format_variants(cyvcf_variant, index=1,
                             case_obj=case_obj, add_all_info=False)

    assert variant_obj.CHROM == cyvcf_variant.CHROM
    assert variant_obj.start == cyvcf_variant.start
开发者ID:J35P312,项目名称:puzzle,代码行数:11,代码来源:test_vcf_variant_mixin.py


示例9: test_variants_case_no_ped

def test_variants_case_no_ped():
    vcf_plugin = VcfPlugin(root_path=vcf)
    variants = vcf_plugin.variants(case_id='hapmap.vcf')
    variant = next(variants)
    assert variant['CHROM'] == 'X'
    assert int(variant['POS']) == 84563218
    assert variant['index'] == 1

    variant = next(variants)
    assert variant['CHROM'] == '2'
    assert int(variant['POS']) == 233349186
    assert variant['index'] == 2
开发者ID:brainstorm,项目名称:puzzle,代码行数:12,代码来源:test_vcf.py


示例10: test_variants_case_with_ped

def test_variants_case_with_ped():
    vcf_plugin = VcfPlugin(root_path=vcf, case_lines=individuals, case_type='ped')
    variants = vcf_plugin.variants(case_id='636808')
    variant = next(variants)
    assert variant['CHROM'] == 'X'
    assert int(variant['POS']) == 84563218
    assert variant['index'] == 1

    variant = next(variants)
    assert variant['CHROM'] == '2'
    assert int(variant['POS']) == 233349186
    assert variant['index'] == 2
开发者ID:brainstorm,项目名称:puzzle,代码行数:12,代码来源:test_vcf.py


示例11: load

def load(ctx, variant_source, family_file, family_type):
    """
    Load a case into the database.

    This can be done with a config file or from command line.
    If no database was found run puzzle init first.
    """
    db_path = ctx.obj['db_path']
    if not os.path.exists(db_path):
        logger.warn("database not initialized, run 'puzzle init'")
        ctx.abort()

    logger.debug('Set puzzle backend to {0}'.format(ctx.obj['mode']))
    mode = ctx.obj['mode']
    logger.debug('Set puzzle mode to {0}'.format(ctx.obj['variant_type']))
    variant_type = ctx.obj['variant_type']

    if mode == 'vcf':
        logger.info("Initialzing VCF plugin")
        if not family_file:
            logger.error("Please provide a ped like file")
            ctx.abort()
        try:
            plugin = VcfPlugin(
                root_path=variant_source,
                case_lines=family_file,
                case_type=family_type,
                vtype=variant_type
            )
        except SyntaxError as e:
            logger.error(e.message)
            ctx.abort()

    elif mode == 'gemini':
        logger.debug("Initialzing GEMINI plugin")
        try:
            plugin = GeminiPlugin(db=variant_source, vtype=variant_type)
        except NameError:
            logger.error("Need to have gemini installed to use gemini plugin")
            ctx.abort()
        except DatabaseError as e:
            logger.error("{0} is not a valid gemini db".format(variant_source))
            logger.info("variant-source has to point to a gemini database")
            ctx.abort()

    logger.debug("Plugin setup was succesfull")
    # from gemini can create multiple cases
    store = SqlStore(db_path)

    for case_obj in plugin.cases():
        # extract case information
        logger.debug("adding case: {}".format(case_obj['case_id']))
        store.add_case(case_obj, vtype=variant_type, mode=mode)
开发者ID:brainstorm,项目名称:puzzle,代码行数:53,代码来源:cli.py


示例12: test_filters_frequency

    def test_filters_frequency(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {'frequency':'0.001'}
        result = plugin.variants(case_id, filters=filters, count=1000)
        variants = result.variants
        nr_of_variants = result.nr_of_variants
        for variant_obj in variants:
            assert variant_obj.max_freq <= 0.001
        
        assert nr_of_variants == 88
开发者ID:J35P312,项目名称:puzzle,代码行数:13,代码来源:test_vcf_variant_mixin.py


示例13: test_filters_consequence

    def test_filters_consequence(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {'consequence':['frameshift_variant']}
        result = plugin.variants(case_id, filters=filters, count=1000)
        variants = result.variants
        nr_of_variants = result.nr_of_variants
        
        for variant_obj in variants:
            assert 'frameshift_variant' in variant_obj.consequences
        
        assert nr_of_variants == 4
开发者ID:J35P312,项目名称:puzzle,代码行数:14,代码来源:test_vcf_variant_mixin.py


示例14: test_filters_gene_ids

    def test_filters_gene_ids(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {'gene_ids':['POF1B']}
        result = plugin.variants(case_id, filters=filters, count=1000)
        variants = result.variants
        nr_of_variants = result.nr_of_variants
        
        for variant_obj in variants:
            assert 'POF1B' in variant_obj.gene_symbols
        
        assert nr_of_variants == 1
开发者ID:J35P312,项目名称:puzzle,代码行数:14,代码来源:test_vcf_variant_mixin.py


示例15: test_filters_cadd

    def test_filters_cadd(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {'cadd':'20'}
        result = plugin.variants(case_id, filters=filters, count=1000)
        variants = result.variants
        nr_of_variants = result.nr_of_variants
        
        for variant_obj in variants:
            variant_obj.cadd_score >= 20
        
        assert nr_of_variants == 50
开发者ID:J35P312,项目名称:puzzle,代码行数:14,代码来源:test_vcf_variant_mixin.py


示例16: test_filters_impact_severities_high

    def test_filters_impact_severities_high(self, case_obj):
        plugin = VcfPlugin()
        plugin.add_case(case_obj)
        case_id = case_obj.case_id

        filters = {'impact_severities':['HIGH']}
        result = plugin.variants(case_id, filters=filters, count=1000)
        variants = result.variants
        nr_of_variants = result.nr_of_variants
        
        for variant_obj in variants:
            assert variant_obj.impact_severity == 'HIGH'
        
        assert nr_of_variants == 7
开发者ID:J35P312,项目名称:puzzle,代码行数:14,代码来源:test_vcf_variant_mixin.py


示例17: select_plugin

def select_plugin(case_obj):
    """Select and initialize the correct plugin for the case."""
    if case_obj.variant_mode == 'vcf':
        logger.debug("Using vcf plugin")
        plugin = VcfPlugin(root_path=case_obj.variant_source,
                           vtype=case_obj.variant_type)
        plugin.case_objs = [case_obj]
    elif case_obj.variant_mode == 'gemini':
        logger.debug("Using gemini plugin")
        plugin = GeminiPlugin(db=case_obj.variant_source,
                              vtype=case_obj.variant_type)

    case_id = case_obj.case_id
    return plugin, case_id
开发者ID:brainstorm,项目名称:puzzle,代码行数:14,代码来源:store.py


示例18: test_variants_case

def test_variants_case(case_obj):
    vcf_plugin = VcfPlugin()
    vcf_plugin.add_case(case_obj)
    #case_id is 'hapmap.vcf' since no ped file is given
    result = vcf_plugin.variants(case_id=case_obj.case_id)
    variants = result.variants
    variant = variants[0]
    assert variant['CHROM'] == 'X'
    assert int(variant['POS']) == 84563218
    assert variant['index'] == 1

    variant = variants[1]
    assert variant['CHROM'] == '2'
    assert int(variant['POS']) == 233349186
    assert variant['index'] == 2
开发者ID:J35P312,项目名称:puzzle,代码行数:15,代码来源:test_vcf_variant_mixin.py


示例19: select_plugin

    def select_plugin(self, case_obj):
        """Select and initialize the correct plugin for the case."""
        if case_obj.variant_mode == "vcf":
            logger.debug("Using vcf plugin")
            plugin = VcfPlugin(case_obj.variant_type)
        elif case_obj.variant_mode == "gemini":
            logger.debug("Using gemini plugin")
            plugin = GeminiPlugin(case_obj.variant_type)

        # Add case to plugin
        plugin.add_case(case_obj)

        self.variant_type = case_obj.variant_type

        case_id = case_obj.case_id
        return plugin, case_id
开发者ID:robinandeer,项目名称:puzzle,代码行数:16,代码来源:store.py


示例20: test_add_consequences

def test_add_consequences(variant):
    plugin = VcfPlugin()
    # The raw variant line is treated like a string so it does not matter
    # if it is malformed
    raw_variant_line = "7\t98994144\t.\tA\tC\t51.68\tPASS\tAC=1;AF=0.167;AN=6"\
    ";BaseQRankSum=-1.965;CADD=13.51;CSQ=C|downstream_gene_variant|MODIFIER|"\
    "ARPC1B|ENSG00000130429|Transcript|ENST00000491294|retained_intron|||||||"\
    "||||1724|1|HGNC|704||||||||||||||,C|downstream_gene_variant|MODIFIER|"\
    "ARPC1B|ENSG00000130429|Transcript|ENST00000451682|protein_coding||||||||"\
    "|||1745|1|HGNC|704||CCDS5661.1|ENSP00000389631|ARC1B_HUMAN|F8VXW2_HUMAN"\
    "&C9K057_HUMAN&C9JTT6_HUMAN&C9JQM8_HUMAN&C9JM51_HUMAN&C9JFG9_HUMAN&C9JEY1"\
    "_HUMAN&C9JBJ7_HUMAN&C9J6C8_HUMAN&C9J4Z7_HUMAN&A4D275_HUMAN|UPI0000125D33|"
    
    plugin._add_consequences(variant, raw_variant_line)
    
    assert variant.consequences == ["downstream_gene_variant"]
开发者ID:J35P312,项目名称:puzzle,代码行数:16,代码来源:test_consequence_extras.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python puzzler.run函数代码示例发布时间:2022-05-25
下一篇:
Python plugins.GeminiPlugin类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap