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
a32b61fc
Commit
a32b61fc
authored
Jun 08, 2020
by
Lukas Jelonek
Browse files
Add vfdb download
parent
4bf2e699
Changes
3
Show whitespace changes
Inline
Side-by-side
dbman/main.py
View file @
a32b61fc
...
...
@@ -164,6 +164,12 @@ def run_in_tempdir(func=None, success=None, fail=None):
def
_recipes
(
args
):
recipes
=
{
'vfdb'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_vfdb.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'
)},
},
'resfinder'
:
{
'download'
:
{
'script'
:
_pkgres
(
'recipes/download_resfinder.py'
)},
'blast'
:
{
'script'
:
_pkgres
(
'recipes/create_blast_dbs.py'
)},
...
...
dbman/recipes/download_vfdb.py
0 → 100755
View file @
a32b61fc
#!/usr/bin/env python3
import
dbman.helper
as
h
import
json
import
os
import
gzip
import
urllib.request
from
bs4
import
BeautifulSoup
import
datetime
import
logging
logging
.
basicConfig
(
level
=
logging
.
INFO
)
dbname
=
"vfdb"
dbdescription
=
"The virulence factor database"
url
=
"http://www.mgc.ac.cn/VFs/"
# get version
data
=
urllib
.
request
.
urlopen
(
url
+
"download.htm"
).
read
()
bs
=
BeautifulSoup
(
data
)
version
=
[
s
.
getText
()
for
s
in
bs
.
find_all
(
'i'
)
if
'Last update'
in
s
.
getText
()][
0
]
version
=
version
.
replace
(
'Last update: '
,
""
)
version
=
datetime
.
datetime
.
strptime
(
version
,
"%a %b %d %H:%M:%S %Y"
).
date
().
isoformat
()
# download archives
files
=
[
{
'file'
:
'Down/VFs.xls.gz'
,
'tags'
:[
'excel'
,
'gzip'
,
'compressed'
]},
{
'file'
:
'Down/Comparative_tables_from_VFDB.tar.gz'
,
'tags'
:[
'excel'
,
'tar'
,
'gzip'
,
'compressed'
]},
{
'file'
:
'Down/VFDB_setA_nt.fas.gz'
,
'tags'
:[
'core'
,
'fasta'
,
'nucleotide'
,
'gzip'
,
'compressed'
]},
{
'file'
:
'Down/VFDB_setA_pro.fas.gz'
,
'tags'
:[
'core'
,
'fasta'
,
'protein'
,
'gzip'
,
'compressed'
]},
{
'file'
:
'Down/VFDB_setB_nt.fas.gz'
,
'tags'
:[
'full'
,
'fasta'
,
'nucleotide'
,
'gzip'
,
'compressed'
]},
{
'file'
:
'Down/VFDB_setB_pro.fas.gz'
,
'tags'
:[
'full'
,
'fasta'
,
'protein'
,
'gzip'
,
'compressed'
]},
]
parts
=
[]
for
file
in
files
:
fn
=
h
.
download
(
url
+
file
[
'file'
])
part
=
{
'files'
:
[
fn
],
'tags'
:
file
[
'tags'
]}
parts
.
append
(
part
)
# write metadata file
h
.
create_metadata
(
dbname
,
"download"
,
dbdescription
,
version
=
version
,
other
=
{
'parts'
:
parts
})
requirements.txt
View file @
a32b61fc
...
...
@@ -2,3 +2,4 @@ wget
sphinx
s3cmd
prettytable
beautifulsoup4
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