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
dbman
Commits
4bf2e699
Commit
4bf2e699
authored
Jun 08, 2020
by
Lukas Jelonek
Browse files
Add resfinder download
parent
40b87b90
Changes
2
Hide whitespace changes
Inline
Side-by-side
dbman/main.py
View file @
4bf2e699
...
@@ -164,24 +164,34 @@ def run_in_tempdir(func=None, success=None, fail=None):
...
@@ -164,24 +164,34 @@ def run_in_tempdir(func=None, success=None, fail=None):
def
_recipes
(
args
):
def
_recipes
(
args
):
recipes
=
{
recipes
=
{
'pfam'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_pfam.py'
)},
'resfinder'
:
{
'hmmer'
:
{
'script'
:
_pkgres
(
'recipes/create_hmmer_dbs.py'
)},
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_resfinder.py'
)},
},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'card'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_card.py'
)},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_dbs.py'
)},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
},
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_dbs.py'
)},
'pfam'
:
{
},
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_pfam.py'
)},
'swissprot'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_uniprotkb.py'
),
'params'
:
[
'--database'
,
'swissprot'
,
'--type'
,
'fasta'
]},
'hmmer'
:
{
'script'
:
_pkgres
(
'recipes/create_hmmer_dbs.py'
)},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
'card'
:
{
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_dbs.py'
)},
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_card.py'
)},
},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'trembl'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_uniprotkb.py'
),
'params'
:
[
'--database'
,
'trembl'
,
'--type'
,
'fasta'
]},
'diamond'
:
{
'script'
:
_pkgres
(
'recipes/create_diamond_dbs.py'
)},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
'ghostx'
:
{
'script'
:
_pkgres
(
'recipes/create_ghostx_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'
)},
},
'trembl'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_uniprotkb.py'
),
'params'
:
[
'--database'
,
'trembl'
,
'--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
return
recipes
...
...
dbman/recipes/download_resfinder.py
0 → 100755
View file @
4bf2e699
#!/usr/bin/env python3
import
dbman.helper
as
h
import
json
import
os
import
gzip
import
subprocess
import
shutil
from
pathlib
import
Path
import
logging
logging
.
basicConfig
(
level
=
logging
.
INFO
)
dbname
=
"resfinder"
dbdescription
=
"The ResFinder database is a curated database of acquired resistance genes."
url
=
"https://git@bitbucket.org/genomicepidemiology/resfinder_db.git"
# clone git repo
command
=
"git clone {}"
.
format
(
url
)
cp
=
subprocess
.
run
(
command
,
shell
=
True
)
if
cp
.
returncode
!=
0
:
sys
.
exit
(
cp
.
returncode
)
parts
=
[]
fastas
=
Path
(
'resfinder_db'
).
rglob
(
"*.fsa"
)
for
file
in
fastas
:
target
=
file
.
resolve
().
parent
.
parent
.
joinpath
(
file
.
name
)
file
.
rename
(
target
)
parts
.
append
({
'files'
:
[
target
.
name
],
'tags'
:
[
'fasta'
,
'nucleotide'
]})
txts
=
Path
(
'resfinder_db'
).
rglob
(
"*.txt"
)
for
file
in
txts
:
target
=
file
.
resolve
().
parent
.
parent
.
joinpath
(
file
.
name
)
file
.
rename
(
target
)
parts
.
append
({
'files'
:
[
target
.
name
],
'tags'
:
[
'text'
,
'annotation'
]})
shutil
.
rmtree
(
'resfinder_db'
)
# write metadata file
h
.
create_metadata
(
dbname
,
"download"
,
dbdescription
,
other
=
{
'parts'
:
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