Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Carlos Ribas
rnacentral-webcode
Commits
04983c34
Commit
04983c34
authored
Aug 04, 2021
by
Anton Petrov
Browse files
Remove possible duplicates in FASTA export
parent
9d4fb4de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
rnacentral/export/views.py
rnacentral/export/views.py
+5
-1
No files found.
rnacentral/export/views.py
View file @
04983c34
...
...
@@ -112,15 +112,19 @@ def export_search_results(query, _format, hits):
# make sure that temporary file is saved to disk
temp_file
.
flush
()
os
.
fsync
(
temp_file
.
fileno
())
# remove possible duplicate ids
uniq_ids
=
tempfile
.
NamedTemporaryFile
(
delete
=
True
,
dir
=
EXPORT_RESULTS_DIR
)
os
.
system
(
'sort {} | uniq > {}'
.
format
(
temp_file
.
name
,
uniq_ids
.
name
))
cmd
=
'{esl_binary} -f {fasta_db} {id_list} | gzip > {output}'
.
format
(
esl_binary
=
ESLSFETCH
,
fasta_db
=
FASTA_DB
,
id_list
=
temp_file
.
name
,
id_list
=
uniq_ids
.
name
,
output
=
filename
)
process
=
sub
.
Popen
(
cmd
,
stdout
=
sub
.
PIPE
,
stderr
=
sub
.
PIPE
,
shell
=
True
)
output
,
errors
=
process
.
communicate
()
return_code
=
process
.
returncode
temp_file
.
close
()
uniq_ids
.
close
()
if
return_code
!=
0
:
class
EaselError
(
Exception
):
"""Raise when Easel exits with a non-zero status"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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