Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
genotoul-bioinfo
D-GENIES
Commits
b1f4b92d
Commit
b1f4b92d
authored
Apr 11, 2018
by
Floreal Cabanettes
Browse files
Add validator for index files, Implements
#130
parent
549430ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/dgenies/lib/job_manager.py
View file @
b1f4b92d
...
...
@@ -627,6 +627,12 @@ class JobManager:
self
.
set_job_status
(
"fail"
,
"Alignment file is invalid. Please check your file."
)
return
False
,
True
,
None
elif
input_type
!=
"backup"
:
if
my_input
.
get_path
().
endswith
(
".idx"
):
if
not
validators
.
idx
(
my_input
.
get_path
()):
self
.
set_job_status
(
"fail"
,
"%s index file is invalid. Please check your file."
%
input_type
.
capitalize
())
return
False
,
True
,
None
if
self
.
config
.
batch_system_type
!=
"local"
and
file_size
>=
getattr
(
self
.
config
,
"min_%s_size"
%
input_type
):
should_be_local
=
False
...
...
@@ -1125,15 +1131,17 @@ class JobManager:
shutil
.
move
(
self
.
paf
,
self
.
paf_raw
)
if
not
validators
.
paf
(
self
.
paf_raw
):
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
):
return
False
self
.
align
=
Fasta
(
name
=
"map"
,
path
=
self
.
paf_raw
,
type_f
=
"local"
)
self
.
aln_format
=
"paf"
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
".align"
),
"w"
)
as
aln
:
aln
.
write
(
self
.
paf_raw
)
target_path
=
os
.
path
.
join
(
self
.
output_dir
,
"target.idx"
)
self
.
target
=
Fasta
(
name
=
"target"
,
path
=
target_path
,
type_f
=
"local"
)
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
".target"
),
"w"
)
as
trgt
:
trgt
.
write
(
target_path
)
query_path
=
os
.
path
.
join
(
self
.
output_dir
,
"query.idx"
)
self
.
query
=
Fasta
(
name
=
"query"
,
path
=
query_path
,
type_f
=
"local"
)
with
open
(
os
.
path
.
join
(
self
.
output_dir
,
".query"
),
"w"
)
as
qr
:
qr
.
write
(
query_path
)
...
...
@@ -1185,7 +1193,7 @@ class JobManager:
self
.
_after_start
(
success
,
error_set
)
except
Exception
:
print
(
traceback
.
print_exc
()
)
traceback
.
print_exc
()
error
=
"<p>An unexpected error has occurred. Please contact the support to report the bug.</p>"
if
MODE
==
"webserver"
:
with
Job
.
connect
():
...
...
src/dgenies/lib/validators.py
View file @
b1f4b92d
...
...
@@ -56,4 +56,29 @@ def maf(in_file):
except
:
return
False
else
:
return
True
\ No newline at end of file
return
True
def
idx
(
in_file
):
try
:
with
open
(
in_file
,
"r"
)
as
inf
:
first_line
=
inf
.
readline
()
if
"
\t
"
in
first_line
:
return
False
must_be_last
=
False
for
line
in
inf
:
if
must_be_last
:
return
False
line
=
line
.
rstrip
()
if
line
==
""
:
must_be_last
=
True
else
:
cols
=
line
.
split
(
"
\t
"
)
if
len
(
cols
)
!=
2
:
return
False
if
not
cols
[
1
].
isdigit
():
return
False
except
:
return
False
else
:
return
True
src/dgenies/views.py
View file @
b1f4b92d
...
...
@@ -391,7 +391,6 @@ def install():
latest
=
json
.
loads
(
call
.
content
.
decode
(
"utf-8"
))
if
"tag_name"
in
latest
:
latest
=
latest
[
"tag_name"
][
1
:]
print
(
latest
)
with
open
(
os
.
path
.
join
(
app_folder
,
"md"
,
"INSTALL.md"
),
"r"
,
encoding
=
'utf-8'
)
as
install_instr
:
content
=
install_instr
.
read
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment