本文整理汇总了Python中puzzle.plugins.GeminiPlugin类的典型用法代码示例。如果您正苦于以下问题:Python GeminiPlugin类的具体用法?Python GeminiPlugin怎么用?Python GeminiPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GeminiPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_genotypes
def test_add_genotypes(self, variant):
adapter = GeminiPlugin()
gemini_variant = {
'gts': ['G/A', 'G/A', './.', './.', './.'],
'gt_depths': [17, 19, -1, -1, -1],
'gt_ref_depths': [10, 13, -1, -1, -1],
'gt_alt_depths': [7, 6, -1, -1, -1],
'gt_quals': [99, 99, -1, -1, -1],
}
ind = DotDict()
ind.ind_index = 0
ind.ind_id = '1'
ind.case_id = 'Case_1'
ind.phenotype = 2
ind_objs = [ind]
adapter._add_genotypes(variant, gemini_variant, ind_objs)
genotype = variant.individuals[0]
assert genotype.sample_id == ind.ind_id
assert genotype.sample_id == ind.ind_id
assert genotype.genotype == 'G/A'
assert genotype.case_id == ind.case_id
assert genotype.phenotype == ind.phenotype
assert genotype.ref_depth == 10
assert genotype.alt_depth == 7
assert genotype.depth == 17
assert genotype.genotype_quality == 99
示例2: test_filters_impact_severities
def test_filters_impact_severities(self, gemini_path):
adapter = GeminiPlugin(db=gemini_path)
filters = {'impact_severities':['HIGH']}
variants = []
for variant in adapter.variants('643594', filters=filters):
variants.append(variant)
assert len(variants) == 2
示例3: test_add_exac
def test_add_exac(self, variant):
adapter = GeminiPlugin()
gemini_variant = {'aaf_exac_all':0.01}
adapter._add_exac(variant, gemini_variant)
assert variant.thousand_g == None
assert len(variant.frequencies) == 1
示例4: test_filters_cadd
def test_filters_cadd(self, gemini_path):
adapter = GeminiPlugin(db=gemini_path)
filters = {'cadd':'20'}
variants = []
for variant in adapter.variants('643594', filters=filters):
variants.append(variant)
assert len(variants) == 4
示例5: test_is_variant
def test_is_variant(case_obj):
adapter = GeminiPlugin()
genotypes = ['G/A', 'G/A', 'G/G', 'G/G', './.']
ind_objs = [
Individual(ind_id=0, ind_index=0),
Individual(ind_id=1, ind_index=1),
]
#Mock a gemini variant
gemini_variant = {
'gts':genotypes,
'alt':'A'
}
assert adapter._is_variant(gemini_variant, ind_objs)
#Check with individuals that are hom ref
ind_objs = [
Individual(ind_id=0, ind_index=2),
Individual(ind_id=1, ind_index=3),
]
assert not adapter._is_variant(gemini_variant, ind_objs)
#Check with individual that has no call
ind_objs = [
Individual(ind_id=0, ind_index=4),
]
assert not adapter._is_variant(gemini_variant, ind_objs)
示例6: test_filters_gene_ids
def test_filters_gene_ids(self, gemini_path):
adapter = GeminiPlugin(db=gemini_path)
filters = {'gene_ids':['HLA-DRB5']}
variants = []
for variant in adapter.variants('643594', filters=filters):
variants.append(variant)
assert len(variants) == 5
示例7: test_filters_consequence
def test_filters_consequence(self, gemini_path):
adapter = GeminiPlugin(db=gemini_path)
filters = {'consequence':['stop_gained']}
variants = []
for variant in adapter.variants('643594', filters=filters):
variants.append(variant)
assert len(variants) == 2
示例8: test_add_thousand_g
def test_add_thousand_g(self, variant):
adapter = GeminiPlugin()
gemini_variant = {'aaf_1kg_all':0.01}
adapter._add_thousand_g(variant, gemini_variant)
assert variant.thousand_g == 0.01
assert len(variant.frequencies) == 1
示例9: test_filters_frequency
def test_filters_frequency(self, gemini_path):
adapter = GeminiPlugin(db=gemini_path)
filters = {'frequency':'0.01'}
variants = []
for variant in adapter.variants('643594', filters=filters):
variants.append(variant)
assert len(variants) == 13
示例10: test_add_gmaf_no_frequency
def test_add_gmaf_no_frequency(self, variant):
adapter = GeminiPlugin()
gemini_variant = {'max_aaf_all':None}
adapter._add_gmaf(variant, gemini_variant)
assert len(variant.frequencies) == 0
assert variant.max_freq == None
示例11: test_get_all_variants
def test_get_all_variants(gemini_path):
"""Test to get some variants from the gemini adapter"""
adapter = GeminiPlugin(db=gemini_path)
variants = []
for variant in adapter.variants('643594'):
variants.append(variant)
assert len(variants) == 14
示例12: test_filters_no_filters
def test_filters_no_filters(self, gemini_case_obj):
plugin = GeminiPlugin()
plugin.add_case(gemini_case_obj)
filters = {}
result = plugin.variants('643594', filters=filters, count=1000)
variants = result.variants
nr_of_variants = result.nr_of_variants
assert nr_of_variants == 14
示例13: test_no_filters_sv
def test_no_filters_sv(self, gemini_sv_case_obj):
plugin = GeminiPlugin()
plugin.add_case(gemini_sv_case_obj)
filters = {}
result = plugin.variants('hapmap', filters=filters, count=1000)
variants = result.variants
nr_of_variants = result.nr_of_variants
assert nr_of_variants == 513
示例14: test_build_gemini_query
def test_build_gemini_query():
adapter = GeminiPlugin()
query = "SELECT * from variants"
extra_info = "max_aaf_all < 0.01"
new_query = adapter.build_gemini_query(query, extra_info)
assert new_query == "SELECT * from variants WHERE max_aaf_all < 0.01"
extra_info = "cadd_score > 10"
new_query = adapter.build_gemini_query(new_query, extra_info)
assert new_query == "SELECT * from variants WHERE max_aaf_all < 0.01 AND cadd_score > 10"
示例15: test_variant
def test_variant(gemini_path):
"""Test to get one variant"""
adapter = GeminiPlugin(db=gemini_path)
variant = adapter.variant(
case_id='643594',
variant_id=4
)
assert variant['CHROM'] == '6'
assert variant['POS'] == '32487163'
assert type(variant['genes']) == type([])