def runtbl2asn(folder, template, discrepency, organism, isolate, strain, parameters, version): ''' function to run NCBI tbl2asn ''' #get funannotate version fun_version = lib.get_version() #input should be a folder if not os.path.isdir(folder): log.error("tbl2asn error: %s is not a directory, exiting" % folder) sys.exit(1) #based on organism, isolate, strain, construct meta info for -j flag if not organism: log.error("tbl2asn error: organism not specified") sys.exit(1) meta = "[organism=" + organism + "]" if isolate: isolate_meta = "[isolate=" + isolate + "]" meta = meta + " " + isolate_meta if strain: strain_meta = "[strain=" + strain + "]" meta = meta + " " + strain_meta cmd = [ 'tbl2asn', '-y', '"Annotated using ' + fun_version + '"', '-N', str(version), '-p', folder, '-t', template, '-M', 'n', '-Z', discrepency, '-j', '"' + meta + '"', '-V', 'b', '-c', 'fx', '-T', '-a', 'r10u' ] #check for custom parameters if parameters: params = parameters.split(' ') cmd = cmd + params runSubprocess(cmd, '.') return ' '.join(cmd)
#create log file log_name = os.path.join(args.out, 'logfiles', 'funannotate-train.log') if os.path.isfile(log_name): os.remove(log_name) #initialize script, log system info and cmd issue at runtime lib.setupLogging(log_name) FNULL = open(os.devnull, 'w') cmd_args = " ".join(sys.argv) + '\n' lib.log.debug(cmd_args) print "-------------------------------------------------------" lib.SystemInfo() #get version of funannotate version = lib.get_version() lib.log.info("Running %s" % version) #do some checks and balances if not args.PASAHOME: try: PASA = os.environ["PASAHOME"] except KeyError: lib.log.error( "$PASAHOME environmental variable not found, PASA is not properly configured. You can use the --PASAHOME argument to specifiy a path at runtime" ) sys.exit(1) else: PASA = args.PASAHOME #try to autodetect different PASA distributions
'psutil': '4.0.0', 'natsort': '4.0.0', 'goatools': '0.6.4', 'seaborn': '0.7.0', 'biopython': '1.65' } PyVers = sys.version.split(' ')[0] PerlVers = perlVersion() PyDeps = {} PerlDeps = {} ExtDeps = {} #loop through lists and build dictionary of results so you can print out later print("-------------------------------------------------------") print("Checking dependencies for %s" % lib.get_version()) print("-------------------------------------------------------") show = False if len(sys.argv) > 1: if sys.argv[1] == '--show-versions': show = True else: print( "To print all dependencies and versions: funannotate check --show-versions\n" ) print('You are running Python v %s. Now checking python packages...' % PyVers) for mod in funannotate_python: if not mod in PyDeps: PyDeps[mod] = checkPyModule(mod)
#create log file log_name = os.path.join(args.out, 'funnannotate-compare.log') if os.path.isfile(log_name): os.remove(log_name) #initialize script, log system info and cmd issue at runtime lib.setupLogging(log_name) FNULL = open(os.devnull, 'w') cmd_args = " ".join(sys.argv)+'\n' lib.log.debug(cmd_args) print "-------------------------------------------------------" lib.SystemInfo() #get version of funannotate version = lib.get_version() lib.log.info("Running %s" % version) if args.outgroup: if not os.path.isdir(os.path.join(parentdir, 'DB', 'outgroups')): lib.log.error("Outgroup folder is not properly configured") os._exit(1) files = [f for f in os.listdir(os.path.join(parentdir, 'DB', 'outgroups'))] files = [ x.replace('_buscos.fa', '') for x in files ] files = [ x for x in files if not x.startswith('.') ] if not args.outgroup in files: lib.log.error("%s is not found in outgroups" % args.outgroup) print natsorted(files) else: outgroup = True outgroup_species = os.path.join(parentdir, 'DB', 'outgroups', args.outgroup+'_buscos.fa')