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
SOaAS
psot.repository
Commits
a2f733d3
Commit
a2f733d3
authored
Dec 07, 2017
by
hmueller
Browse files
Remove redundant sequence id field from results section of targetp in json output.
parent
7b15f5e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/convert_targetp.py
View file @
a2f733d3
...
...
@@ -4,9 +4,9 @@ import sys
import
json
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'Convert targetp results to json documents'
)
parser
.
add_argument
(
'--result'
,
'-r'
,
required
=
True
,
help
=
'The targetp results directory'
)
parser
.
add_argument
(
'--output'
,
'-o'
,
required
=
True
,
help
=
'The converted results json file'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Convert targetp results to json documents'
)
parser
.
add_argument
(
'--result'
,
'-r'
,
required
=
True
,
help
=
'The targetp results directory'
)
parser
.
add_argument
(
'--output'
,
'-o'
,
required
=
True
,
help
=
'The converted results json file'
)
args
=
parser
.
parse_args
()
loc_dict
=
{
"C"
:
"chloroplast"
,
"M"
:
"mitochondrion"
,
"S"
:
"secretory pathway"
,
"_"
:
"other"
,
"*"
:
"undetermined"
}
...
...
@@ -16,7 +16,7 @@ documents = {}
with
open
(
filename
)
as
f
:
tool
=
None
field_index
=
{
"Name"
:
None
,
"cTP"
:
None
,
"mTP"
:
None
,
"SP"
:
None
,
"Loc"
:
None
}
field_index
=
{
"cTP"
:
None
,
"mTP"
:
None
,
"SP"
:
None
,
"Loc"
:
None
}
is_datasection
=
False
for
line
in
f
:
...
...
@@ -29,12 +29,10 @@ with open(filename) as f:
results
=
documents
[
split
[
0
]][
'computations'
][
0
][
"results"
][
0
]
for
field
in
field_index
:
if
field_index
[
field
]
is
not
None
:
if
field
in
[
"cTP"
,
"mTP"
,
"SP"
]:
results
[
field
.
lower
()]
=
float
(
split
[
field_index
[
field
]])
elif
field
==
"Loc"
:
if
field
==
"Loc"
:
results
[
field
.
lower
()]
=
loc_dict
[
split
[
field_index
[
field
]]]
else
:
results
[
field
.
lower
()]
=
split
[
field_index
[
field
]]
results
[
field
.
lower
()]
=
float
(
split
[
field_index
[
field
]]
)
else
:
if
line
.
startswith
(
'Name '
):
split
=
line
.
split
()
...
...
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