ngless-toolkit / ngless

NGLess: NGS with less work
https://ngless.embl.de
Other
142 stars 24 forks source link

Argument not checked prior to execution #33

Closed unode closed 5 years ago

unode commented 7 years ago

According to the FAQ ngless is supposed to check all input files prior to execution.

In the case below it doesn't check if the fafile or the folder containing it exists before executing. Instead it executes up to that point and then fails when it can't create indexes.

ngless "0.0"
import "parallel" version "0.0"
import "samtools" version "0.0"
import "mocat" version "0.0"

TMPDIR = ARGV[2]
DB = TMPDIR + '/db.fna'
DATADIR = 'data/'

sample = ARGV[1]
input = load_mocat_sample(DATADIR + sample)

preprocess(input, keep_singles=True) using |read|:
    read = substrim(read, min_quality=25)
    if len(read) < 45:
        discard

hits = map(input, fafile=DB)

write(hits, ofile='outputs/' + sample + '_db.bam')

Called with ngless --trace map.ngl sample /tmp/non_existing_dir

luispedro commented 7 years ago

Thanks. This may not be specific to fafile, but the logic may not detect that it can check the existence of the file earlier as it is not a literal, but specified through a variable (a constant in this case, which may or may not be the relevant issue).