Mercurial > repos > iuc > data_manager_gemini_database_downloader
diff data_manager/data_manager_gemini_download.py @ 4:fe5a9a7d95b0 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_gemini_database_downloader commit 283362494058ed64143b1f27afb447b8a1cb4313
author | iuc |
---|---|
date | Fri, 14 Dec 2018 12:40:15 -0500 |
parents | 172815da3d41 |
children | b4b2b284230a |
line wrap: on
line diff
--- a/data_manager/data_manager_gemini_download.py Tue Apr 04 18:09:05 2017 -0400 +++ b/data_manager/data_manager_gemini_download.py Fri Dec 14 12:40:15 2018 -0500 @@ -6,18 +6,51 @@ import subprocess import sys +import yaml + def main(): today = datetime.date.today() params = json.loads( open( sys.argv[1] ).read() ) target_directory = params[ 'output_data' ][0]['extra_files_path'] os.mkdir( target_directory ) - cmd = "gemini --annotation-dir %s update --dataonly %s %s" % (target_directory, params['param_dict']['gerp_bp'], params['param_dict']['cadd'] ) - subprocess.check_call( cmd, shell=True ) + # The target_directory needs to be specified twice for the following + # invocation of gemini. + # In essence, the GEMINI_CONFIG environment variable makes gemini store + # its yaml configuration file in that directory, while the + # --annotation-dir argument makes it write the same path into the yaml + # file, which is then used for determining where the actual annotation + # files should be stored. + gemini_env = os.environ.copy() + gemini_env['GEMINI_CONFIG'] = target_directory + cmd = "gemini --annotation-dir %s update --dataonly %s %s" % ( + target_directory, + params['param_dict']['gerp_bp'], + params['param_dict']['cadd'] + ) + subprocess.check_call( cmd, shell=True, env=gemini_env ) + + # modify the newly created gemini config file to contain a relative + # annotation dir path, which will be interpreted as relative to + # the job working directory at runtime by any gemini tool + config_file = os.path.join(target_directory, 'gemini-config.yaml') + with open(config_file) as fi: + config = yaml.load(fi) + config['annotation_dir'] = 'gemini/data' + with open(config_file, 'w') as fo: + yaml.dump(config, fo, allow_unicode=False, default_flow_style=False) + data_manager_dict = { 'data_tables': { - 'gemini_databases': [ - {'value': today.isoformat(), 'dbkey': 'hg19', 'name': 'GEMINI annotations (%s)' % today.isoformat(), 'path': './%s' % today.isoformat() } + 'gemini_versioned_databases': [ + { + 'value': today.isoformat(), + 'dbkey': 'hg19', + 'version': params['param_dict']['gemini_db_version'], + 'name': + 'GEMINI annotations (%s snapshot)' % today.isoformat(), + 'path': './%s' % today.isoformat() + } ] } }