Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
psot.repository
Commits
458a3c11
Commit
458a3c11
authored
Dec 12, 2017
by
lmueller
Browse files
added resolve_dbxrefs.py to nextflow.py (not working yet)
parent
57eb76c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
psot/nextflow.py
View file @
458a3c11
...
...
@@ -74,6 +74,21 @@ process convert_${id}_to_json {
"""
}
'''
)
fetch_template
=
Template
(
'''
process fetch_dbxrefs {
input:
file result from ${id}_fetch_json
output:
file "$${result}_fetched.json" into ${id}_json
script:
"""
resolve_dbxrefs.py --input $$result --retreiver ../dbxref/scripts --output $${result}_fetched.json
"""
}
'''
)
input_template
=
Template
(
''' file ${id}_result from ${id}_json'''
)
join_jsons_template
=
Template
(
'''
process join_documents {
...
...
@@ -153,8 +168,9 @@ Channel.fromPath(params.fasta).set{fasta}''')
for
m
in
modules
:
json_inputs
.
append
(
input_template
.
substitute
(
m
))
# fragments.append(fetch_template.substitute(flatten(m)))
fragments
.
append
(
join_jsons_template
.
substitute
({
'inputs'
:
'
\n
'
.
join
(
json_inputs
)}))
fragments
.
append
(
split_jsons_template
.
substitute
(
execution
))
nextflow_script
=
'
\n
'
.
join
(
fragments
)
return
nextflow_script
scripts/resolve_dbxrefs.py
View file @
458a3c11
...
...
@@ -7,6 +7,7 @@ import sys
parser
=
argparse
.
ArgumentParser
(
description
=
'Resolve dbxrefs from json file'
)
parser
.
add_argument
(
'--input'
,
'-i'
,
required
=
True
,
help
=
'The json input document'
)
parser
.
add_argument
(
'--retriever'
,
'-s'
,
required
=
True
,
help
=
'Location of retriever'
)
parser
.
add_argument
(
'--output'
,
'-o'
,
required
=
True
,
help
=
'The json output document'
)
args
=
parser
.
parse_args
()
basename
=
args
.
retriever
.
replace
(
'scripts/'
,
''
)
...
...
@@ -30,6 +31,7 @@ for c in j['computations']:
if
'target'
in
r
and
'dbxref'
in
r
[
'target'
]:
r
[
'target'
][
'dbxref'
]
=
{
'dbxref'
:
r
[
'target'
][
'dbxref'
],
'informations'
:
next
(
entry
for
entry
in
entries
if
entry
[
'id'
]
==
r
[
'target'
][
'dbxref'
])}
with
open
(
args
.
input
,
'w'
)
as
o
:
#with open(args.input, 'w') as o:
with
open
(
args
.
output
,
'w'
)
as
o
:
json
.
dump
(
j
,
o
)
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