Skip to content
Snippets Groups Projects
Commit 57002a0c authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add ghostx db creation

parent be780604
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,8 @@ def _rename_directory_after_metadata(path): ...@@ -141,7 +141,8 @@ def _rename_directory_after_metadata(path):
logging.debug("Renaming '%s' to '%s'", oldpath, newpath) logging.debug("Renaming '%s' to '%s'", oldpath, newpath)
oldpath.rename(newpath) oldpath.rename(newpath)
metadata['location'] = str(newpath.absolute()) metadata['location'] = str(newpath.absolute())
return metadata return metadata
return None
def run_in_tempdir(func=None, success=None, fail=None): def run_in_tempdir(func=None, success=None, fail=None):
dbtmpdir = os.path.join(_databases_dir(), "tmp") dbtmpdir = os.path.join(_databases_dir(), "tmp")
...@@ -166,10 +167,12 @@ def _recipes(args): ...@@ -166,10 +167,12 @@ def _recipes(args):
'card': {'download': {'script': _pkgres('recipes/download_card.py')}, 'card': {'download': {'script': _pkgres('recipes/download_card.py')},
'blast': {'script': _pkgres('recipes/create_blast_dbs.py')}, 'blast': {'script': _pkgres('recipes/create_blast_dbs.py')},
'diamond': {'script': _pkgres('recipes/create_diamond_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')}, 'blast': {'script': _pkgres('recipes/create_blast_dbs.py')},
'diamond': {'script': _pkgres('recipes/create_diamond_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 python
import dbman.helper as h
import subprocess
import sys
import os
import json
from pathlib import Path
metadata = h.load_metadata('./.source_metadata.json')
fasta_parts = [p for p in metadata['parts'] if 'fasta' in p['tags']]
new_parts = []
for part in fasta_parts:
type = None
for file in part['files']:
name = Path(file).stem
command = 'ghostx db -o {} -i {}'.format(name, file)
cp = subprocess.run(command, shell=True)
if (cp.returncode != 0):
sys.exit(cp)
files = [f.name for f in os.scandir('.') if f.name.startswith(name) and not f.name.endswith('.fasta')]
tags = ['ghostx_db']
tags.extend(part['tags'])
tags.remove('fasta')
new_parts.append({'files': files, 'tags': tags})
h.create_metadata(metadata['name'], 'ghostx', metadata['description'], metadata['version'], other={'parts': new_parts})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment