Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UNLOCK
MGnify
Commits
4665c7c5
Commit
4665c7c5
authored
Jun 08, 2021
by
Koehorst, Jasper
Browse files
gzip in place
parent
773f6a44
Changes
1
Hide whitespace changes
Inline
Side-by-side
run.py
View file @
4665c7c5
...
...
@@ -3,6 +3,7 @@ import multiprocessing
import
os
import
sys
import
shlex
import
gzip
curl
=
"""curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'result=sample&query=secondary_sample_accession%3D%22XXXXXX%22&format=tsv' "https://www.ebi.ac.uk/ena/portal/api/search
\"
"""
xml
=
"https://www.ebi.ac.uk/ena/browser/api/xml/"
...
...
@@ -46,24 +47,36 @@ def run_command(command):
return
result
.
stdout
.
decode
(
'ascii'
)
def
conversion
(
identifier
):
if
os
.
path
.
isfile
(
"./genome/"
+
identifier
+
"/"
+
identifier
+
".conversion.ttl"
):
return
output_file
=
"./genome/"
+
identifier
+
"/"
+
identifier
+
".conversion.ttl"
if
os
.
path
.
isfile
(
output_file
+
".gz"
):
return
# "-tool", "conversion", "-f", fasta.getAbsolutePath(), "-gff2rdf", "-i", gff.getAbsolutePath(), "-o", output.getAbsolutePath(), "-id", "MGYG-HGUT-00001", "-codon", "11", "-topology", "linear"
command
=
"java -jar ./MGnifyParser.jar -tool conversion -f ./genome/"
+
identifier
+
"/"
+
identifier
+
".fna -gff2rdf -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".gff -id "
+
identifier
+
" -codon 11 -topology linear -o
./genome/"
+
identifier
+
"/"
+
identifier
+
".conversion.ttl"
command
=
"java -jar ./MGnifyParser.jar -tool conversion -f ./genome/"
+
identifier
+
"/"
+
identifier
+
".fna -gff2rdf -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".gff -id "
+
identifier
+
" -codon 11 -topology linear -o
"
+
output_file
print
(
command
)
os
.
system
(
command
)
gzip
(
output_file
)
def
interproscan
(
identifier
):
if
os
.
path
.
isfile
(
"./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.ttl"
):
return
command
=
"java -jar ./MGnifyParser.jar -tool interpro -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".conversion.ttl -o ./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.ttl -tsv ./genome/"
+
identifier
+
"/"
+
identifier
+
"_InterProScan.tsv -version InterProScan-v5_35-74_0"
output_file
=
"./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.ttl"
if
os
.
path
.
isfile
(
output_file
+
".gz"
):
return
command
=
"java -jar ./MGnifyParser.jar -tool interpro -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".conversion.ttl -o "
+
output_file
+
" -tsv ./genome/"
+
identifier
+
"/"
+
identifier
+
"_InterProScan.tsv -version InterProScan-v5_35-74_0"
print
(
command
)
os
.
system
(
command
)
gzip
(
output_file
)
def
eggnog
(
identifier
):
if
os
.
path
.
isfile
(
"./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.eggnog.ttl"
):
return
command
=
"java -jar ./MGnifyParser.jar -tool eggnog -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.ttl -o ./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.eggnog.ttl -tsv ./genome/"
+
identifier
+
"/"
+
identifier
+
"_eggNOG.tsv -v v2-db5.0"
output_file
=
"./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.eggnog.ttl"
if
os
.
path
.
isfile
(
output_file
+
".gz"
):
return
command
=
"java -jar ./MGnifyParser.jar -tool eggnog -i ./genome/"
+
identifier
+
"/"
+
identifier
+
".interproscan.ttl -o "
+
output_file
+
" -tsv ./genome/"
+
identifier
+
"/"
+
identifier
+
"_eggNOG.tsv -v v2-db5.0"
print
(
command
)
os
.
system
(
command
)
gzip
(
output_file
)
def
gzip
(
file
):
f_in
=
open
(
file
)
f_out
=
gzip
.
open
(
file
+
'.gz'
,
'wb'
)
f_out
.
writelines
(
f_in
)
f_out
.
close
()
f_in
.
close
()
def
conversion_stage
(
identifier
):
conversion
(
identifier
)
...
...
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