# HG changeset patch # User galaxyp # Date 1573490956 18000 # Node ID 6d8144eef202b284315c6b52b90e7f509ac68673 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/eggnog_mapper/eggnog_mapper_data_manager commit ba81f4bfe31157aa6b986e81d5e4405ae1372b3b" diff -r 000000000000 -r 6d8144eef202 data_manager/data_manager_eggnog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/data_manager_eggnog.py Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import argparse +import json +import os.path +import sqlite3 +import sys +from sqlite3 import OperationalError + + +def _get_db_version(sqlitedb_path): + version = '4.5' + try: + query = 'select version from version' + conn = sqlite3.connect(sqlitedb_path) + cur = conn.cursor() + cur.execute(query) + version = cur.fetchone()[0] + except OperationalError as e: + print('Assuming eggnog version %s because %s %s' % + (version, sqlitedb_path, e), file=sys.stderr) + return version + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--config_file') + parser.add_argument('--install_path') + parser.add_argument('--dbs', default='') + args = parser.parse_args() + + eggnog_db_path = os.path.join(args.install_path, 'eggnog.db') + if not os.path.exists(eggnog_db_path): + print('Can not open: %s' % eggnog_db_path, file=sys.stderr) + exit(1) + db_version = _get_db_version(eggnog_db_path) + + # params = json.loads(open(args.config_file).read()) + dm_dict = {} + dm_dict['data_tables'] = dm_dict.get('data_tables', {}) + data_table = 'eggnog_mapper_db' + dm_dict['data_tables'][data_table]\ + = dm_dict['data_tables'].get(data_table, []) + data_table_entry = dict(value=db_version, name=db_version, + path=args.install_path) + dm_dict['data_tables'][data_table].append(data_table_entry) + data_table = 'eggnog_mapper_hmm_dbs' + dm_dict['data_tables'][data_table]\ + = dm_dict['data_tables'].get(data_table, []) + if args.dbs: + dbs = [x.strip() for x in args.dbs.split(',')] + for db in dbs: + key = '%s_%s' % (db_version, db) + data_table_entry = dict(key=key, db_version=db_version, + value=db, name=db, path=db) + dm_dict['data_tables'][data_table].append(data_table_entry) + + # save info to json file + open(args.config_file, 'wb').write(json.dumps(dm_dict)) + + +if __name__ == "__main__": + main() diff -r 000000000000 -r 6d8144eef202 data_manager/data_manager_eggnog.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/data_manager_eggnog.xml Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,33 @@ + + eggnog data + + eggnog_macros.xml + + + + + + + + + + + + /. +The eggnog version is queried from the downloaded SQlite eggnog.db from table version. + ]]> + + diff -r 000000000000 -r 6d8144eef202 data_manager/eggnog_macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/eggnog_macros.xml Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,173 @@ + + + 1.0.3 + + + 10.1093/nar/gkv1248 + + + + + eggnog-mapper + + + + emapper.py --version + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6d8144eef202 data_manager_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager_conf.xml Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,27 @@ + + + + + + + + + + eggnog_data/${value} + + ${GALAXY_DATA_MANAGER_DATA_PATH}/eggnog_data/${value} + abspath + + + + + + + + + + + + + + diff -r 000000000000 -r 6d8144eef202 test-data/cached_locally/eggnog.db Binary file test-data/cached_locally/eggnog.db has changed diff -r 000000000000 -r 6d8144eef202 test-data/cached_locally/eggnog_mapper_db.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/cached_locally/eggnog_mapper_db.loc Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,2 @@ +#value name path +4.5 eggNOG_4.5 ${__HERE__} diff -r 000000000000 -r 6d8144eef202 test-data/cached_locally/eggnog_mapper_hmm_dbs.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/cached_locally/eggnog_mapper_hmm_dbs.loc Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,2 @@ +#key db_version value name path +4.5_ENOG411CB2I 4.5 ENOG411CB2I ENOG411CB2I ${__HERE__}/hmmdb_levels/ENOG411CB2I/ENOG411CB2I diff -r 000000000000 -r 6d8144eef202 tool-data/eggnog_mapper_db.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/eggnog_mapper_db.loc.sample Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,25 @@ +#This is a sample file distributed with Galaxy that enables tools +#to use a directory of eggnog_mapper data files. +# +# eggnog-mapper requires the following files to be installed in the data directory: +# https://github.com/jhcepas/eggnog-mapper/blob/master/data/og2level.tsv.gz +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/eggnog.db.gz +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/OG_fasta.tar.gz +# In addition individual HMM DBs can be installed from: +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/hmmdb_levels/ +# A complete diamond database is available from: +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/eggnog_proteins.dmnd.gz +# +# The python script download_eggnog_data.py, +# included with eggnog_mapper, can be used to download the files to the correct directory +# +# The near-equivalence of columns "value" and "db" is needed for the tests to work, +# and for the setting of --data_dir to the parent directory of eggnog.db +# The complicated eggNOG database structure makes passing custom HMM databases somewhat tricky. +# See test-data/cached_locally/eggnog_mapper.loc for how this was done with the included test databases +# In all other cases, when the appropriate HMM database (for example, "thaNOG") was downloaded from eggnogdb.embl.de, +# value and db should be the same (in the example, both should be "thaNOG") +# +# +#db_version name path +#4.5.1 eggnog_4.5.1 /path/to/directory/that/contains/eggnog.db diff -r 000000000000 -r 6d8144eef202 tool-data/eggnog_mapper_hmm_dbs.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/eggnog_mapper_hmm_dbs.loc.sample Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,28 @@ +#This is a sample file distributed with Galaxy that enables tools +#to use a directory of eggnog_mapper data files. +# +# eggnog-mapper requires the following files to be installed in the data directory: +# https://github.com/jhcepas/eggnog-mapper/blob/master/data/og2level.tsv.gz +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/eggnog.db.gz +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/OG_fasta.tar.gz +# In addition individual HMM DBs can be installed from: +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/hmmdb_levels/ +# A complete diamond database is available from: +# http://eggnogdb.embl.de/download/eggnog_4.5/eggnog-mapper-data/eggnog_proteins.dmnd.gz +# +# The python script download_eggnog_data.py, +# included with eggnog_mapper, can be used to download the files to the correct directory +# +# The near-equivalence of columns "value" and "db" is needed for the tests to work, +# and for the setting of --data_dir to the parent directory of eggnog.db +# The complicated eggNOG database structure makes passing custom HMM databases somewhat tricky. +# See test-data/cached_locally/eggnog_mapper.loc for how this was done with the included test databases +# In all other cases, when the appropriate HMM database (for example, "thaNOG") was downloaded from eggnogdb.embl.de, +# value and db should be the same (in the example, both should be "thaNOG") +# +# +#key db_version value name path +#4.5.1_NOG 4.5.1 NOG Full eggNOG database (NOG) +#4.5.1_euk 4.5.1 euk Eukaryotes (euk) +#4.5.1_aproNOG 4.5.1 aproNOG Proteobacteria_alpha (aproNOG) +#4.5.1_aproNOG 4.5.1 ENOG411CB2I ENOG411CB2I (custom) /path/to/custom/hmmdb/ENOG411CB2I diff -r 000000000000 -r 6d8144eef202 tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,11 @@ + + + + value,name,path + +
+ + key,db_version,value,name,path + +
+
diff -r 000000000000 -r 6d8144eef202 tool_data_table_conf.xml.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Mon Nov 11 11:49:16 2019 -0500 @@ -0,0 +1,11 @@ + + + + value,name,path + +
+ + key,db_version,value,name,path + +
+