comparison gbk2fa.py @ 15:479c4f2f4826 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/snpeff commit 999eca8a05f17ae567f99b8ca3394f2105491173
author iuc
date Mon, 09 Jul 2018 13:22:58 -0400
parents 5b4ac70948d2
children cfcf33df7fc0
comparison
equal deleted inserted replaced
14:85ca751407c3 15:479c4f2f4826
20 @contextlib.contextmanager 20 @contextlib.contextmanager
21 def get_file_handle(gbk_filename): 21 def get_file_handle(gbk_filename):
22 f_type = magic.from_file(args.genbank_file, mime=True) 22 f_type = magic.from_file(args.genbank_file, mime=True)
23 if f_type == 'text/plain': 23 if f_type == 'text/plain':
24 input_handle = open(gbk_filename, "r") 24 input_handle = open(gbk_filename, "r")
25 elif f_type == 'application/gzip': 25 elif f_type == 'application/gzip' or f_type == 'application/x-gzip':
26 input_handle = gzip.open(gbk_filename, "rt") 26 input_handle = gzip.open(gbk_filename, "rt")
27 elif f_type == 'application/x-bzip2': 27 elif f_type == 'application/x-bzip2':
28 input_handle = bz2.open(gbk_filename, "rt") 28 input_handle = bz2.open(gbk_filename, "rt")
29 else: 29 else:
30 sys.exit("Cannot process file of type {}. Only plain, gzip'ed, and bzip2'ed genbank files are accepted ".format(f_type)) 30 sys.exit("Cannot process file of type {}. Only plain, gzip'ed, and bzip2'ed genbank files are accepted ".format(f_type))