Commit 4bf2e699 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add resfinder download

parent 40b87b90
...@@ -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
......
#!/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})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment