Skip to content

Commit

Permalink
Update parallel-virfinder.py
Browse files Browse the repository at this point in the history
  • Loading branch information
telatin authored Aug 19, 2022
1 parent c79662d commit 4d8f796
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/parallel-virfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging
import tempfile

__VERSION__="0.2.0"
__VERSION__="0.3.0"
# parse csv
import csv
def parse_csv(filename):
Expand Down Expand Up @@ -46,7 +46,10 @@ def has_r():
try:
subprocess.call(['Rscript', '--version'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return True
except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e:
return False
except Exception as e:
print("Unexpected error when checking Rscript: %s" % e, file=sys.stderr)
return False

def has_virfinder():
Expand Down Expand Up @@ -92,6 +95,7 @@ def run_virfinder(fasta, output):
vf.add_argument("-p", "--max-p-value", help="Maximum p-value [default: %(default)s]", default=0.05, type=float)
# Miscallaneous arguments group
misc_group = args.add_argument_group("Miscallaneous arguments")
misc_group.add_argument("--no-check", help="Do not check dependencies at startup", action="store_true")
misc_group.add_argument("-v", "--verbose", help="Verbose output", action="store_true")
misc_group.add_argument("-d", "--debug", help="Debug output", action="store_true")
args = args.parse_args()
Expand All @@ -114,11 +118,11 @@ def run_virfinder(fasta, output):
logging.error("Number of parallel processes must be at least 2")
sys.exit(1)

if not has_r():
if not args.no_check and not has_r():
logging.error("R is not installed")
sys.exit(1)

if not has_virfinder():
if not args.no_check and not has_virfinder():
logging.error("VirFinder is not installed")
sys.exit(1)

Expand Down

0 comments on commit 4d8f796

Please sign in to comment.