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
dbman
Commits
57002a0c
Commit
57002a0c
authored
Jun 04, 2020
by
Lukas Jelonek
Browse files
Add ghostx db creation
parent
be780604
Changes
2
Hide whitespace changes
Inline
Side-by-side
dbman/main.py
View file @
57002a0c
...
...
@@ -141,7 +141,8 @@ def _rename_directory_after_metadata(path):
logging
.
debug
(
"Renaming '%s' to '%s'"
,
oldpath
,
newpath
)
oldpath
.
rename
(
newpath
)
metadata
[
'location'
]
=
str
(
newpath
.
absolute
())
return
metadata
return
metadata
return
None
def
run_in_tempdir
(
func
=
None
,
success
=
None
,
fail
=
None
):
dbtmpdir
=
os
.
path
.
join
(
_databases_dir
(),
"tmp"
)
...
...
@@ -166,10 +167,12 @@ def _recipes(args):
'card'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_card.py'
)},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_dbs.py'
)},
},
'swissprot'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_uniprotkb.py'
),
'params'
:
[
'--database'
,
'swissprot'
,
'--type'
,
'fasta'
]},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_dbs.py'
)},
}
}
return
recipes
...
...
dbman/recipes/create_ghostx_dbs.py
0 → 100755
View file @
57002a0c
#!/usr/bin/env python
import
dbman.helper
as
h
import
subprocess
import
sys
import
os
import
json
from
pathlib
import
Path
metadata
=
h
.
load_metadata
(
'./.source_metadata.json'
)
fasta_parts
=
[
p
for
p
in
metadata
[
'parts'
]
if
'fasta'
in
p
[
'tags'
]]
new_parts
=
[]
for
part
in
fasta_parts
:
type
=
None
for
file
in
part
[
'files'
]:
name
=
Path
(
file
).
stem
command
=
'ghostx db -o {} -i {}'
.
format
(
name
,
file
)
cp
=
subprocess
.
run
(
command
,
shell
=
True
)
if
(
cp
.
returncode
!=
0
):
sys
.
exit
(
cp
)
files
=
[
f
.
name
for
f
in
os
.
scandir
(
'.'
)
if
f
.
name
.
startswith
(
name
)
and
not
f
.
name
.
endswith
(
'.fasta'
)]
tags
=
[
'ghostx_db'
]
tags
.
extend
(
part
[
'tags'
])
tags
.
remove
(
'fasta'
)
new_parts
.
append
({
'files'
:
files
,
'tags'
:
tags
})
h
.
create_metadata
(
metadata
[
'name'
],
'ghostx'
,
metadata
[
'description'
],
metadata
[
'version'
],
other
=
{
'parts'
:
new_parts
})
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