當前位置: 首頁>>代碼示例>>Python>>正文


Python plugins.VcfPlugin類代碼示例

本文整理匯總了Python中puzzle.plugins.VcfPlugin的典型用法代碼示例。如果您正苦於以下問題:Python VcfPlugin類的具體用法?Python VcfPlugin怎麽用?Python VcfPlugin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了VcfPlugin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的puzzle.plugins.VcfPlugin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。