Skip to content

Commit

Permalink
Added more descriptive missing dependency errors
Browse files Browse the repository at this point in the history
  • Loading branch information
niemasd committed Dec 12, 2022
1 parent d8e1433 commit 3d7a9e9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
7 changes: 6 additions & 1 deletion plugins/contact_network/ngg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ def ngg(exe, params, out_fn, config, verbose=True):
error("Invalid NiemaGraphGen exe: %s" % exe)
if verbose:
print_log("Command: %s" % ' '.join(command))
f = open(out_fn['contact_network'], 'w'); call(command, stdout=f); f.close()
f = open(out_fn['contact_network'], 'w')
try:
call(command, stdout=f)
except FileNotFoundError as e:
error("Unable to run NiemaGraphGen. Make sure all ngg_* executables are in your PATH (e.g. /usr/local/bin)")
f.close()
if verbose:
print_log("Contact Network written to: %s" % out_fn['contact_network'])
def ngg_barabasi_albert(params, out_fn, config, verbose=True):
Expand Down
7 changes: 6 additions & 1 deletion plugins/sequence_evolution/seqgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def seqgen(mode, params, out_fn, config, verbose=True):
command += [seqgen_tree_fn]
if verbose:
print_log("Command: %s" % ' '.join(command))
out_f = open(out_fn['sequences'], 'w'); log_f = open(seqgen_log_fn, 'w'); call(command, stdout=out_f, stderr=log_f); log_f.close(); out_f.close()
out_f = open(out_fn['sequences'], 'w'); log_f = open(seqgen_log_fn, 'w')
try:
call(command, stdout=out_f, stderr=log_f)
except FileNotFoundError as e:
error("Unable to run seq-gen. Make sure seq-gen executable is in your PATH (e.g. /usr/local/bin)")
log_f.close(); out_f.close()
if stat(out_fn['sequences']).st_size < 2:
error("Seq-Gen crashed. See log file: %s" % seqgen_log_fn)
if verbose:
Expand Down
5 changes: 4 additions & 1 deletion plugins/transmission_network/gemf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def gemf_favites(model, params, out_fn, config, verbose=True):
]
if verbose:
print_log("Command: %s" % ' '.join(command))
call(command)
try:
call(command)
except FileNotFoundError as e:
error("Unable to run GEMF_FAVITES. Make sure GEMF_FAVITES.py and GEMF executables are in your PATH (e.g. /usr/local/bin)")
move('%s/transmission_network.txt' % gemf_out, out_fn['transmission_network'])
if verbose:
print_log("Transmission Network written to: %s" % out_fn['transmission_network'])
Expand Down
7 changes: 6 additions & 1 deletion plugins/viral_phylogeny_trans/coatran.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ def coatran(exe, params, out_fn, config, verbose=True):
error("Invalid CoaTran exe: %s" % exe)
if verbose:
print_log("Command: %s" % ' '.join(command))
f = open(out_fn['viral_phylogeny_all_chains_time'], 'w'); call(command, stdout=f); f.close()
f = open(out_fn['viral_phylogeny_all_chains_time'], 'w')
try:
call(command, stdout=f)
except FileNotFoundError as e:
error("Unable to run CoaTran. Make sure all coatran_* executables are in your PATH (e.g. /usr/local/bin)")
f.close()
if stat(out_fn['viral_phylogeny_all_chains_time']).st_size < 2:
error("CoaTran crashed")
if verbose:
Expand Down

0 comments on commit 3d7a9e9

Please sign in to comment.