Commit ae957d21 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix check of alignment file format

parent 38710b45
......@@ -15,7 +15,8 @@ import dgenies.lib.validators as validators
ALLOWED_EXTENSIONS = {"fasta": ['fa', 'fasta', 'fna', 'fa.gz', 'fasta.gz', 'fna.gz'],
"idx": ['idx',],
"map": [o[0] for o in getmembers(validators) if isfunction(o[1]) and not o[0].startswith("_")],
"map": [o[0] for o in getmembers(validators) if isfunction(o[1]) and not o[0].startswith("_") and
not o[0].startswith("v_")],
"backup": ['tar']}
# map: all functions of validators which does not starts with an underscore.
......
......@@ -868,7 +868,7 @@ class JobManager:
return False, True, None
elif input_type != "backup":
if my_input.get_path().endswith(".idx"):
if not validators.idx(my_input.get_path()):
if not validators.v_idx(my_input.get_path()):
self.set_job_status("fail",
"%s index file is invalid. Please check your file." %
input_type.capitalize())
......@@ -1474,7 +1474,7 @@ class JobManager:
return False
target_path = os.path.join(self.output_dir, "target.idx")
query_path = os.path.join(self.output_dir, "query.idx")
if not validators.idx(target_path) or not validators.idx(query_path):
if not validators.v_idx(target_path) or not validators.v_idx(query_path):
return False
self.align = Fasta(name="map", path=self.paf_raw, type_f="local")
self.aln_format = "paf"
......
......@@ -7,6 +7,8 @@ Only 1 argument to this function:
Secondary functions must start with _
Validators for non-mapping files must start with "v_"
Returns True if file is valid, else False
"""
......@@ -82,7 +84,7 @@ def maf(in_file):
return True
def idx(in_file):
def v_idx(in_file):
"""
Index file validator
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment