Skip to content

Commit

Permalink
Add check for viral database
Browse files Browse the repository at this point in the history
  • Loading branch information
Cengoni committed Apr 29, 2024
1 parent 2fa9e42 commit 3080d94
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions metaphlan/metaphlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,16 @@ def set_mapping_arguments(index, bowtie2_db):


def set_vsc_parameters(index, bowtie2_db):
vsc_fna = os.path.join(bowtie2_db, "{}_VSG.fna".format(index))
vsc_vinfo = os.path.join(bowtie2_db, "{}_VINFO.csv".format(index))

if os.path.isfile(os.path.join(bowtie2_db, "{}_VSG.fna".format(index))):
vsc_fna = os.path.join(bowtie2_db, "{}_VSG.fna".format(index))
if not os.path.isfile(vsc_fna):
sys.stderr.write("Error:\n {} file not found in bowtie2db folder ({}). Re-download MetaPhlAn database.".format("{}_VSG.fna".format(index, bowtie2_db)))
sys.exit(1)

if os.path.isfile(os.path.join(bowtie2_db, "{}_VINFO.csv".format(index))):
vsc_vinfo = os.path.join(bowtie2_db, "{}_VINFO.csv".format(index))
if not os.path.isfile(vsc_vinfo):
sys.stderr.write("Error:\n {} file not found in bowtie2db folder ({}). Re-download MetaPhlAn database.".format("{}_VINFO.csv".format(index, bowtie2_db)))
sys.exit(1)

return(vsc_fna, vsc_vinfo)

Expand Down

0 comments on commit 3080d94

Please sign in to comment.