本文整理匯總了Python中criteria.helper.criteria.Criteria.get_available_criterias方法的典型用法代碼示例。如果您正苦於以下問題:Python Criteria.get_available_criterias方法的具體用法?Python Criteria.get_available_criterias怎麽用?Python Criteria.get_available_criterias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類criteria.helper.criteria.Criteria
的用法示例。
在下文中一共展示了Criteria.get_available_criterias方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_available_criterias
# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import get_available_criterias [as 別名]
def test_available_criterias(self):
feature = 'gene'
available_criterias = Criteria.get_available_criterias(feature, INI_CONFIG)
expected_dict = {'gene': ['cand_gene_in_study', 'gene_in_region', 'is_gene_in_mhc', 'cand_gene_in_region']}
self.assertIsNotNone(available_criterias, 'Criterias as not none')
self.assertIn('cand_gene_in_study', available_criterias['gene'])
self.assertEqual(available_criterias.keys(), expected_dict.keys(), 'Dic keys equal')
available_criterias = Criteria.get_available_criterias(feature=None, config=INI_CONFIG)
self.assertIn('gene', available_criterias)
self.assertIn('marker', available_criterias)
示例2: test_gene_criteria_types
# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import get_available_criterias [as 別名]
def test_gene_criteria_types(self):
"""Test if the indexes have records"""
idx_key = "GENE_CRITERIA"
feature_type = "gene"
idx = ElasticSettings.idx(idx_key)
idx_types = CriteriaDataIntegrityUtils.get_criteria_index_types(idx_key)
gene_criterias = Criteria.get_available_criterias(feature_type)
CriteriaDataIntegrityTestUtils().test_criteria_types(idx, idx_types, gene_criterias["gene"])
CriteriaDataIntegrityTestUtils().test_criteria_mappings(idx, idx_types)
# get random doc for each type ['gene_in_region', 'cand_gene_in_region', 'cand_gene_in_study', 'is_gene_in_mhc']
idx_type = "gene_in_region"
doc_by_idx_type = ElasticUtils.get_rdm_docs(idx, idx_type, size=1)
self.assertTrue(len(doc_by_idx_type) == 1, "got back one document")
gene_in_region_doc = doc_by_idx_type[0]
# {'score': 10, 'CRO': [{'fname': '4p11', 'fid': '4p11_005'}],
# '_meta': {'_type': 'gene_in_region', '_score': 0.9997835,
# '_index': 'pydgin_imb_criteria_gene', '_id': 'ENSG00000250753'},
# 'disease_tags': ['CRO'], 'qid': 'ENSG00000250753'}
qid = getattr(gene_in_region_doc, "qid")
print(qid)
disease_tags = getattr(gene_in_region_doc, "disease_tags")
# ENSG00000248482
# ['IBD', 'UC']
# [{'fid': '5q31.1_013', 'fname': '5q31.1'}]
# [{'fid': '5q31.1_013', 'fname': '5q31.1'}]
fnotes = getattr(gene_in_region_doc, disease_tags[0])
region_id = fnotes[0]["fid"]
print(region_id)
示例3: get_available_criterias
# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import get_available_criterias [as 別名]
def get_available_criterias(cls, feature=None, config=None):
'Function to get available criterias for region'
if config is None:
config = CriteriaManager.get_criteria_config()
if feature is None:
feature = cls.FEATURE_TYPE
available_criterias = Criteria.get_available_criterias(feature, config)
return available_criterias
示例4: process_criterias
# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import get_available_criterias [as 別名]
def process_criterias(cls, feature, criteria=None, config=None, show=False, test=False):
'''function to delegate the call to the right criteria class and build the criteria for that class
'''
from criteria.helper.criteria import Criteria
from criteria.helper.gene_criteria import GeneCriteria
from criteria.helper.marker_criteria import MarkerCriteria
from criteria.helper.region_criteria import RegionCriteria
from criteria.helper.study_criteria import StudyCriteria
if config is None:
if test:
config = cls.get_criteria_config(ini_file='test_criteria.ini')
else:
config = cls.get_criteria_config(ini_file='criteria.ini')
available_criterias = Criteria.get_available_criterias(feature, config=config, test=test)[feature]
criterias_to_process = []
if criteria is None:
criterias_to_process = available_criterias
else:
criterias_list = criteria.split(',')
criterias_to_process = [criteria.strip() for criteria in criterias_list
if criteria.strip() in available_criterias]
if show:
print(criterias_to_process)
return criterias_to_process
logger.debug(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
for section in criterias_to_process:
if feature == 'gene':
print('Call to build criteria gene index')
Criteria.process_criteria(feature, section, config, GeneCriteria, test=test)
elif feature == 'marker':
print('Call to build criteria marker index')
Criteria.process_criteria(feature, section, config, MarkerCriteria, test=test)
elif feature == 'region':
print('Call to build criteria region index')
Criteria.process_criteria(feature, section, config, RegionCriteria, test=test)
elif feature == 'study':
print('Call to build criteria study index')
Criteria.process_criteria(feature, section, config, StudyCriteria, test=test)
else:
logger.critical('Unsupported feature ... please check the inputs')
logger.debug(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S'))
logger.debug('========DONE==========')
示例5: test_marker_criteria_types
# 需要導入模塊: from criteria.helper.criteria import Criteria [as 別名]
# 或者: from criteria.helper.criteria.Criteria import get_available_criterias [as 別名]
def test_marker_criteria_types(self):
'''Test if the indexes have records'''
idx_key = 'MARKER_CRITERIA'
feature_type = 'marker'
idx = ElasticSettings.idx(idx_key)
idx_types = CriteriaDataIntegrityUtils.get_criteria_index_types(idx_key)
gene_criterias = Criteria.get_available_criterias(feature_type)
CriteriaDataIntegrityTestUtils().test_criteria_types(idx, idx_types, gene_criterias['gene'])
CriteriaDataIntegrityTestUtils().test_criteria_mappings(idx, idx_types)
# get random doc for each type ['gene_in_region', 'cand_gene_in_region', 'cand_gene_in_study', 'is_gene_in_mhc']
idx_type = 'rsq_with_index_snp'
doc_by_idx_type = ElasticUtils.get_rdm_docs(idx, idx_type, size=1)
self.assertTrue(len(doc_by_idx_type) == 1, 'got back one document')