def usage_from_genbank_or_usage_file(self, method, **kwargs): genbank_file = kwargs.get('genbank_file', None) usage_file = kwargs.get('usage_file', None) if usage_file != None: usage = json.loads("\n".join(open(usage_file, 'r').readlines())) return usage elif genbank_file != None: ua = UsageAnalyzer(genbank_file) return ua.get_usage_with_method(method, **kwargs) else: raise "Neither usage nor genbank file specified. Cannot get usage from nothin."
if o == '-m': method = a if o == '-a': get_absolute_values = True if o == '-x': exclude = a if o == '-c': cutoff = int(a) if o == '-h': show_help = True if (genbank_file == None) or (method == None) or (show_help == True): usage() ua = UsageAnalyzer(genbank_file) output = ua.get_usage_with_method(method, absolute_values=get_absolute_values, exclude=exclude, cutoff=cutoff) if output == None: print "Unknown method" usage() if output_file == None: print str(output) else: f = open(output_file, 'w') f.write(json.dumps(output)) f.close() exit(0)