Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dbman
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOaAS
dbman
Commits
4bf2e699
Commit
4bf2e699
authored
4 years ago
by
Lukas Jelonek
Browse files
Options
Downloads
Patches
Plain Diff
Add resfinder download
parent
40b87b90
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dbman/main.py
+28
-18
28 additions, 18 deletions
dbman/main.py
dbman/recipes/download_resfinder.py
+38
-0
38 additions, 0 deletions
dbman/recipes/download_resfinder.py
with
66 additions
and
18 deletions
dbman/main.py
+
28
−
18
View file @
4bf2e699
...
...
@@ -164,24 +164,34 @@ def run_in_tempdir(func=None, success=None, fail=None):
def
_recipes
(
args
):
recipes
=
{
'
pfam
'
:
{
'
download
'
:
{
'
script
'
:
_pkgres
(
'
recipes/download_pfam.py
'
)},
'
hmmer
'
:
{
'
script
'
:
_pkgres
(
'
recipes/create_hmmer_dbs.py
'
)},
},
'
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
'
)},
},
'
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
'
)},
}
'
resfinder
'
:
{
'
download
'
:
{
'
script
'
:
_pkgres
(
'
recipes/download_resfinder.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
'
)},
},
'
pfam
'
:
{
'
download
'
:
{
'
script
'
:
_pkgres
(
'
recipes/download_pfam.py
'
)},
'
hmmer
'
:
{
'
script
'
:
_pkgres
(
'
recipes/create_hmmer_dbs.py
'
)},
},
'
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
'
)},
},
'
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
...
...
This diff is collapsed.
Click to expand it.
dbman/recipes/download_resfinder.py
0 → 100755
+
38
−
0
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
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment