From 819760d1fdc611993b944533c680640859621081 Mon Sep 17 00:00:00 2001 From: Kyle Moad Date: Thu, 9 May 2024 13:36:20 -0400 Subject: [PATCH] optional biopython in vcfanno --- cravat/vcfanno.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cravat/vcfanno.py b/cravat/vcfanno.py index b1e58567..da06002f 100644 --- a/cravat/vcfanno.py +++ b/cravat/vcfanno.py @@ -14,8 +14,12 @@ import cravat import vcf import json -from Bio import bgzf from cravat.inout import AllMappingsParser +try: + from Bio import bgzf +except ModuleNotFoundError: + bgzf = None + pass # from vcf_line_processor import VCFLineProcessor @@ -396,6 +400,10 @@ def process(self): self.merge_output() def vcfanno(args): + try: + from Bio import bgzf + except ModuleNotFoundError: + raise ModuleNotFoundError('vcfanno requires biopython. Try running "pip install biopython".') input_path = pathlib.Path(args.input_path) if args.output_path is not None: output_path = args.output_path