Mercurial > repos > iuc > data_manager_build_kraken2_database
changeset 3:19b6a2f0dbe2 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author | iuc |
---|---|
date | Sun, 22 Nov 2020 12:45:56 +0000 |
parents | edacc4bcd3cb |
children | 0eebe086fd58 |
files | data_manager/kraken2_build_database.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/kraken2_build_database.py Sun Dec 22 11:57:46 2019 -0500 +++ b/data_manager/kraken2_build_database.py Sun Nov 22 12:45:56 2020 +0000 @@ -292,14 +292,15 @@ parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files') args = parser.parse_args() - data_manager_input = json.loads(open(args.data_manager_json).read()) + with open(args.data_manager_json) as fh: + data_manager_input = json.load(fh) target_directory = data_manager_input['output_data'][0]['extra_files_path'] try: - os.mkdir( target_directory ) + os.mkdir(target_directory) except OSError as exc: - if exc.errno == errno.EEXIST and os.path.isdir( target_directory ): + if exc.errno == errno.EEXIST and os.path.isdir(target_directory): pass else: raise @@ -354,7 +355,8 @@ else: sys.exit("Invalid database type") - open(args.data_manager_json, 'w').write(json.dumps(data_manager_output, sort_keys=True)) + with open(args.data_manager_json, 'w') as fh: + json.dump(data_manager_output, fh, sort_keys=True) if __name__ == "__main__":