diff --git a/bin/funannotate-functional.py b/bin/funannotate-functional.py index 11220366..980dd8c8 100755 --- a/bin/funannotate-functional.py +++ b/bin/funannotate-functional.py @@ -217,8 +217,8 @@ def runIPRpython(Input): Transcripts = os.path.join(outputdir, 'annotate_misc', 'genome.transcripts.fasta') lib.gb2output(genbank, Proteins, Transcripts, Scaffolds) -#get absolute path for all input so there are no problems later -Scaffolds, Proteins, Transcripts, GFF = [os.path.abspath(i) for i in [Scaffolds, Proteins, Transcripts, GFF]] #suggestion via GitHub +#get absolute path for all input so there are no problems later, not using Transcripts yet could be error? so take out here +Scaffolds, Proteins, GFF = [os.path.abspath(i) for i in [Scaffolds, Proteins, GFF]] #suggestion via GitHub ''' for i in Scaffolds, Proteins, Transcripts, GFF: i = os.path.abspath(i) diff --git a/bin/funannotate-p2g.py b/bin/funannotate-p2g.py index 4f302bf8..476e1201 100755 --- a/bin/funannotate-p2g.py +++ b/bin/funannotate-p2g.py @@ -25,10 +25,13 @@ def tblastnFilter(input, query, cpus, output): if not os.path.exists(output): os.makedirs(output) #start by formatting blast db/dustmasker filtered format - subprocess.call(['dustmasker', '-in', input, '-infmt', 'fasta', '-parse_seqids', '-outfmt', 'maskinfo_asn1_bin', '-out', 'genome_dust.asnb'], cwd = output, stdout = FNULL, stderr = FNULL) - subprocess.call(['makeblastdb', '-in', input, '-dbtype', 'nucl', '-parse_seqids', '-mask_data', 'genome_dust.asnb', '-out', 'genome'], cwd = output, stdout = FNULL, stderr = FNULL) - #okay, now run tblastn using uniprot proteins - subprocess.call(['tblastn', '-num_threads', str(cpus), '-db', 'genome', '-query', query, '-max_target_seqs', '1', '-db_soft_mask', '11', '-threshold', '999', '-max_intron_length', MaxIntron, '-evalue', '1e-10', '-outfmt', '6', '-out', 'filter.tblastn.tab'], cwd = output, stdout = FNULL, stderr = FNULL) + cmd = ['dustmasker', '-in', input, '-infmt', 'fasta', '-parse_seqids', '-outfmt', 'maskinfo_asn1_bin', '-out', 'genome_dust.asnb'] + lib.runSubprocess(cmd, output, lib.log) + cmd = ['makeblastdb', '-in', input, '-dbtype', 'nucl', '-parse_seqids', '-mask_data', 'genome_dust.asnb', '-out', 'genome'] + lib.runSubprocess(cmd, output, lib.log) + cmd = ['tblastn', '-num_threads', str(cpus), '-db', 'genome', '-query', query, '-max_target_seqs', '1', '-db_soft_mask', '11', '-threshold', '999', '-max_intron_length', MaxIntron, '-evalue', '1e-10', '-outfmt', '6', '-out', 'filter.tblastn.tab'] + lib.runSubprocess(cmd, output, lib.log) + #now parse through results, generating a list for exonerate function with open(os.path.join(output, 'filter.tblastn.tab')) as input: reader = csv.reader(input, delimiter='\t') diff --git a/bin/funannotate-predict.py b/bin/funannotate-predict.py index 5abf3bb9..3032cded 100755 --- a/bin/funannotate-predict.py +++ b/bin/funannotate-predict.py @@ -887,10 +887,14 @@ def __init__(self, prog): #parse entire EVM command to script if Exonerate and Transcripts: + Transcripts = os.path.abspath(Transcripts) + Exonerate = os.path.abspath(Exonerate) evm_cmd = [sys.executable, EVM_script, os.path.join(args.out, 'logfiles', 'funannotate-EVM.log'), str(args.cpus), '--genome', MaskGenome, '--gene_predictions', Predictions, '--protein_alignments', Exonerate, '--transcript_alignments', Transcripts, '--weights', Weights, '--min_intron_length', str(args.min_intronlen), EVM_out] elif not Exonerate and Transcripts: + Transcripts = os.path.abspath(Transcripts) evm_cmd = [sys.executable, EVM_script, os.path.join(args.out, 'logfiles', 'funannotate-EVM.log'),str(args.cpus), '--genome', MaskGenome, '--gene_predictions', Predictions, '--transcript_alignments', Transcripts, '--weights', Weights, '--min_intron_length', str(args.min_intronlen), EVM_out] elif not Transcripts and Exonerate: + Exonerate = os.path.abspath(Exonerate) evm_cmd = [sys.executable, EVM_script, os.path.join(args.out, 'logfiles', 'funannotate-EVM.log'), str(args.cpus), '--genome', MaskGenome, '--gene_predictions', Predictions, '--protein_alignments', Exonerate, '--weights', Weights, '--min_intron_length', str(args.min_intronlen), EVM_out] elif not any([Transcripts,Exonerate]): evm_cmd = [sys.executable, EVM_script, os.path.join(args.out, 'logfiles', 'funannotate-EVM.log'), str(args.cpus), '--genome', MaskGenome, '--gene_predictions', Predictions, '--weights', Weights, '--min_intron_length', str(args.min_intronlen), EVM_out] diff --git a/bin/funannotate-runEVM.py b/bin/funannotate-runEVM.py index b1b1fa55..d786b7ae 100755 --- a/bin/funannotate-runEVM.py +++ b/bin/funannotate-runEVM.py @@ -76,7 +76,8 @@ def safe_run(*args, **kwargs): #split partitions lib.log.info("Setting up EVM partitions") -subprocess.call(cmd1, cwd = tmpdir, stdout = FNULL, stderr = FNULL) +lib.runSubprocess(cmd1, tmpdir, lib.log) +#subprocess.call(cmd1, cwd = tmpdir, stdout = FNULL, stderr = FNULL) #check output lib.checkinputs(os.path.join(tmpdir, 'partitions_list.out')) @@ -118,11 +119,14 @@ def safe_run(*args, **kwargs): #now combine the paritions lib.log.info("Combining partitioned EVM outputs") -subprocess.call([perl, Combine, '--partitions', 'partitions_list.out', '--output_file_name', 'evm.out'], cwd = tmpdir, stdout = FNULL, stderr = FNULL) +partitioncmd = [perl, Combine, '--partitions', 'partitions_list.out', '--output_file_name', 'evm.out'] +lib.runSubprocess(partitioncmd, tmpdir, lib.log) +#subprocess.call([perl, Combine, '--partitions', 'partitions_list.out', '--output_file_name', 'evm.out'], cwd = tmpdir, stdout = FNULL, stderr = FNULL) #now convert to GFF3 lib.log.info("Converting EVM output to GFF3") -subprocess.call(cmd5, cwd = tmpdir, stdout = FNULL, stderr = FNULL) +lib.runSubprocess(cmd5, tmpdir, lib.log) +#subprocess.call(cmd5, cwd = tmpdir, stdout = FNULL, stderr = FNULL) #now concatenate all GFF3 files together for a genome then lib.log.info("Collecting all EVM results") diff --git a/funannotate.py b/funannotate.py index 54c2bb00..f4ff188d 100755 --- a/funannotate.py +++ b/funannotate.py @@ -31,7 +31,7 @@ def fmtcols(mylist, cols): for i in range(0,num_lines)) return "\n".join(lines) -version = '0.3.11' +version = '0.3.12' default_help = """ Usage: funannotate diff --git a/lib/library.py b/lib/library.py index 444990a9..3f3c8b39 100644 --- a/lib/library.py +++ b/lib/library.py @@ -55,7 +55,16 @@ class colr: GRN = '\033[92m' END = '\033[0m' WARN = '\033[93m' - + +def runSubprocess(cmd, dir, logfile): + logfile.debug(' '.join(cmd)) + proc = subprocess.Popen(cmd, cwd=dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = proc.communicate() + if stdout: + logfile.debug(stdout) + if stderr: + logfile.debug(stderr) + def hashfile(afile, hasher, blocksize=65536): buf = afile.read(blocksize) while len(buf) > 0: