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

Add resfinder download

parent 40b87b90
......@@ -164,20 +164,30 @@ def run_in_tempdir(func=None, success=None, fail=None):
def _recipes(args):
recipes = {
'pfam': {'download': {'script': _pkgres('recipes/download_pfam.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')},
'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']},
'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']},
'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')},
......
#!/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