def convert(pheno):
# suppress Exceptions so that we can report back on which phenotypes succeeded and which didn't.
try:
with VariantFileWriter(common_filepaths['parsed'](pheno['phenocode'])) as writer:
pheno_reader = PhenoReader(pheno, minimum_maf=conf.assoc_min_maf)
variants = pheno_reader.get_variants()
if conf.quick: variants = itertools.islice(variants, 0, 10000)
writer.write_all(variants)
except Exception as exc:
import traceback
yield {
'type': 'warning', # TODO: make PerPhenoParallelizer print this.
'warning_str':
'Exception:\n' + indent(str(exc)) +
'\nTraceback:\n' + indent(traceback.format_exc()) +
'\nFiles:\n' + indent('\n'.join(pheno['assoc_files']))
}
yield {"succeeded": False, "exception_str": str(exc), "exception_tb": traceback.format_exc()}
else:
yield {"succeeded": True}
评论列表
文章目录