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
dbxref
Commits
64e60242
Commit
64e60242
authored
Nov 09, 2017
by
lmueller
Browse files
restructured options of enzyme, GO and SO retriever and edited tags.txt accordingly
parent
fd5f86b2
Changes
5
Hide whitespace changes
Inline
Side-by-side
providers.yaml
View file @
64e60242
...
...
@@ -59,6 +59,9 @@
xml
:
[
"
http://pfam.xfam.org/family/%i?output=xml"
]
# does not work
# check_existence: "http://pfam.xfam.org/family/%i?content-type=text%2Fxml"
retriever
:
type
:
'
external'
location
:
'
scripts/retrieve_pfam.py'
-
name
:
PDB
prefixes
:
[
"
PDB"
]
resources
:
...
...
scripts/retrieve_enzyme.py
View file @
64e60242
...
...
@@ -84,8 +84,7 @@ def main():
l
[
1
]
=
l
[
1
].
replace
(
' '
,
''
)
l
[
1
]
=
l
[
1
].
replace
(
';'
,
''
)
refs
.
append
(
l
[
0
])
if
len
(
refs
)
>
0
:
output
[
'uniprot'
]
=
refs
output
[
'uniprot'
]
=
refs
if
len
(
reaction
)
>
0
:
if
'reaction_catalysed'
in
output
:
output
[
'reaction_catalysed'
].
append
(
reaction
)
...
...
@@ -99,25 +98,33 @@ def main():
documents
.
append
(
format_output
(
output
,
args
))
print
(
json
.
dumps
(
documents
))
def
read_basic
(
d
):
out
=
{}
definition
=
{}
if
'name'
in
d
:
out
[
'name'
]
=
d
[
'name'
]
if
'alternative_names'
in
d
:
out
[
'synonyms'
]
=
d
.
pop
(
'alternative_names'
)
if
'reaction_catalysed'
in
d
:
definition
[
'reaction_catalysed'
]
=
d
[
'reaction_catalysed'
]
if
'cofactors'
in
d
:
definition
[
'cofactors'
]
=
d
[
'cofactors'
]
if
'comments'
in
d
:
definition
[
'comments'
]
=
d
[
'comments'
]
if
len
(
definition
)
==
1
:
out
[
'deifinition'
]
=
definition
[
0
]
elif
len
(
definition
)
>
1
:
out
[
'deifinition'
]
=
definition
return
(
out
)
def
format_output
(
d
,
args
):
out
=
{
'dbxref'
:
d
[
'dbxref'
]}
definition
=
{}
if
args
.
basic
:
if
'name'
in
d
:
out
[
'name'
]
=
d
[
'name'
]
if
'alternative_names'
in
d
:
out
[
'synonyms'
]
=
d
.
pop
(
'alternative_names'
)
if
'reaction_catalysed'
in
d
:
definition
[
'reaction_catalysed'
]
=
d
[
'reaction_catalysed'
]
if
'cofactors'
in
d
:
definition
[
'cofactors'
]
=
d
[
'cofactors'
]
if
'comments'
in
d
:
definition
[
'comments'
]
=
d
[
'comments'
]
if
len
(
definition
)
==
1
:
out
[
'deifinition'
]
=
definition
[
0
]
elif
len
(
definition
)
>
1
:
out
[
'deifinition'
]
=
definition
if
'uniprot'
in
d
and
args
.
references
:
out
.
update
(
read_basic
(
d
))
if
args
.
references
:
out
[
'uniprot'
]
=
d
[
'uniprot'
]
if
not
args
.
basic
and
not
args
.
references
:
out
.
update
(
read_basic
(
d
))
out
[
'uniprot'
]
=
d
[
'uniprot'
]
return
(
out
)
...
...
scripts/retrieve_gene_ontology.py
View file @
64e60242
...
...
@@ -26,17 +26,28 @@ def main():
d
=
json
.
loads
(
r
.
text
)
output
=
{
'dbxref'
:
entry
[
'dbxref'
]}
if
args
.
basic
:
output
[
'definition'
]
=
d
[
'results'
][
0
][
'definition'
][
'text'
]
output
[
'name'
]
=
d
[
'results'
][
0
][
'name'
]
output
[
'synonyms'
]
=
d
[
'results'
][
0
][
'synonyms'
]
output
.
update
(
read_basic
(
d
))
if
args
.
relations
:
output
[
'relations'
]
=
{
'children'
:
d
[
'results'
][
0
][
'children'
]}
for
child
in
output
[
'relations'
][
'children'
]
:
child
[
'type'
]
=
child
.
pop
(
'relation'
)
output
[
'relations'
][
'parent'
]
=
parse_history
(
d
[
'results'
][
0
][
'history'
]
)
output
.
update
(
read_relations
(
d
))
if
not
args
.
basic
and
not
args
.
relations
:
output
.
update
(
read_basic
(
d
)
)
output
.
update
(
read_relations
(
d
)
)
documents
.
append
(
output
)
print
(
json
.
dumps
(
documents
))
def
read_basic
(
d
):
out
=
{
'definition'
:
d
[
'results'
][
0
][
'definition'
][
'text'
]}
out
[
'name'
]
=
d
[
'results'
][
0
][
'name'
]
out
[
'synonyms'
]
=
d
[
'results'
][
0
][
'synonyms'
]
return
(
out
)
def
read_relations
(
d
):
out
=
{
'relations'
:
{
'children'
:
d
[
'results'
][
0
][
'children'
]}}
for
child
in
out
[
'relations'
][
'children'
]:
child
[
'type'
]
=
child
.
pop
(
'relation'
)
out
[
'relations'
][
'parents'
]
=
parse_history
(
d
[
'results'
][
0
][
'history'
])
return
(
out
)
def
parse_history
(
h
):
out
=
[]
for
history
in
reversed
(
h
):
...
...
scripts/retrieve_sequence_ontology.py
View file @
64e60242
...
...
@@ -44,6 +44,9 @@ def main():
output
.
update
(
format_output
(
d
))
if
args
.
relations
:
output
[
'relations'
]
=
resolve_relations
(
entry
)
if
'id'
in
d
and
d
[
'id'
]
==
entry
[
'dbxref'
]
and
not
args
.
basic
and
not
args
.
relations
:
output
.
update
(
format_output
(
d
))
output
[
'relations'
]
=
resolve_relations
(
entry
)
documents
.
append
(
output
)
print
(
json
.
dumps
(
documents
))
...
...
@@ -53,9 +56,9 @@ def resolve_relations(entry):
lines
=
r
.
text
.
strip
().
split
(
'
\n
'
)
lines
[
0
]
=
lines
[
0
].
split
(
'
\t
'
)
lines
[
1
]
=
lines
[
1
].
split
(
'
\t
'
)
dic
=
{
'parent'
:
[]}
dic
=
{
'parent
s
'
:
[]}
if
lines
[
1
][
3
]
!=
''
:
dic
[
'parent'
]
=
lines
[
1
][
3
].
split
(
','
)
dic
[
'parent
s
'
]
=
lines
[
1
][
3
].
split
(
','
)
if
len
(
lines
[
1
])
==
5
:
dic
[
'children'
]
=
lines
[
1
][
4
].
split
(
','
)
else
:
...
...
scripts/tags.txt
View file @
64e60242
enzyme:
"UniProtKB/Swiss-Prot": [["", ""], ...]
"d
bxref
":
""
"definition": {"cofactors": ["", ...], "comments": ["", ...], "reaction_catalysed": ["", ...]}
"name": ""
"synonyms":
["", ...]
"dbxref": ""
"d
efinition
":
{"cofactors": ["", ...], "comments": ["", ...], "reaction_catalysed": ["", ...]}
"name": ""
"synonyms": ["", ...]
"uniprot":
["", ...]
--basic:
"dbxref": ""
"definition": {"cofactors": ["", ...], "comments": ["", ...], "reaction_catalysed": ["", ...]}
"name": ""
"synonyms": ["", ...]
--references:
"dbxref": ""
"uniprot": ["", ...]
gene ontology:
"children": [{"id": "", "relation": ""}, ...]
"dbxref": ""
"definition": ""
"name": ""
"synonyms": [{"name": "", "type": ""}, ...]
"dbxref": ""
"definition": ""
"name": ""
"relations": {"children": [{"id": "", "type": ""}, ...], "parents": [{"id": "", "type": ""}, ...]}
"synonyms": [{"name": "", "type": ""}, ...]
--basic:
"dbxref": ""
"definition": ""
"name": ""
"synonyms": [{"name": "", "type": ""}, ...]
--relations:
"dbxref": ""
"relations": {"children": [{"id": "", "type": ""}, ...], "parents": [{"id": "", "type": ""}, ...]}
pfam:
"dbxref": ""
--basic:
"dbxref": ""
--annotation:
"dbxref": ""
sequence ontology:
"dbxref": ""
"definition": ""
"name": ""
"namespace": ""
"parent": ""
"synonyms": [{"name": "", "type": ""}, ...]
"dbxref": ""
"definition": ""
"name": ""
"namespace": ""
"relations: {"children": ["", ...], "parents": ["", ...]}
"synonyms": [{"name": "", "type": ""}, ...]
--basic:
"dbxref": ""
"definition": ""
"name": ""
"namespace": ""
"synonyms": [{"name": "", "type": ""}, ...]
--relations:
"dbxref": ""
"relations: {"children": ["", ...], "parents": ["", ...]}
uniprot:
"acessions": ["", ...]
"alternative_names": ["", ...]
"dbxref": ""
"dbxrefs": ["", ...]
"description": ""
"keywords": ["", ...]
"organism": ""
"recommended_name": {"full": ""}
"sequence": ""
--basic:
"dbxref": ""
"description": ""
--sequence:
"dbxref": ""
"sequence": ""
--organism:
"dbxref": ""
"organism": ""
--annotation:
"acessions": ["", ...]
"alternative_names": ["", ...]
"dbxref": ""
"dbxrefs": ["", ...]
"keywords": ["", ...]
"recommended_name": {"full": ""}
--features:
"dbxref": ""
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