本文整理汇总了Python中puzzle.plugins.VcfPlugin.cases方法的典型用法代码示例。如果您正苦于以下问题:Python VcfPlugin.cases方法的具体用法?Python VcfPlugin.cases怎么用?Python VcfPlugin.cases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类puzzle.plugins.VcfPlugin
的用法示例。
在下文中一共展示了VcfPlugin.cases方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from puzzle.plugins import VcfPlugin [as 别名]
# 或者: from puzzle.plugins.VcfPlugin import cases [as 别名]
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)
示例2: load
# 需要导入模块: from puzzle.plugins import VcfPlugin [as 别名]
# 或者: from puzzle.plugins.VcfPlugin import cases [as 别名]
def load(ctx, variant_source, family_file, family_type, root, mode,
variant_type):
"""
Load a variant source into the database.
If no database was found run puzzle init first.
1. VCF: If a vcf file is used it can be loaded with a ped file
2. GEMINI: Ped information will be retreived from the gemini db
"""
if root is None:
#This is the default puzzle folder
root = os.path.expanduser("~/.puzzle")
if os.path.isfile(root):
logger.error("'root' can't be a file")
ctx.abort()
logger.info("Root directory is: {}".format(root))
db_path = os.path.join(root, 'puzzle_db.sqlite3')
logger.info("db path is: {}".format(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(mode))
logger.debug('Set variant type to {0}'.format(variant_type))
if mode == 'vcf':
logger.info("Initialzing VCF plugin")
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("{} 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():
if store.case(case_id=case_obj.case_id).case_id == case_obj.case_id:
logger.warn("{} already exists in the database"
.format(case_obj.case_id))
continue
# extract case information
logger.debug("adding case: {}".format(case_obj.case_id))
store.add_case(case_obj, vtype=variant_type, mode=mode)
示例3: test_cases
# 需要导入模块: from puzzle.plugins import VcfPlugin [as 别名]
# 或者: from puzzle.plugins.VcfPlugin import cases [as 别名]
def test_cases(case_obj):
adapter=VcfPlugin()
adapter.add_case(case_obj)
case_id = "636808"
case_obj = adapter.cases()[0]
assert case_obj.name == "636808"