Skip to content

Commit faafdc4

Browse files
author
Jon Palmer
committed
make BUSCO flexible to conda augustus install
1 parent 3af6ebf commit faafdc4

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

bin/funannotate-test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def runPredictTest():
160160
#run predict
161161
runCMD(['funannotate', 'predict', '-i', inputFasta,
162162
'--protein_evidence', protEvidence,
163-
'-o', 'annotate', '--augustus_species', 'yeast',
163+
'-o', 'annotate', '--augustus_species', 'saccharomyces',
164164
'--cpus', str(args.cpus), '--species', "Awesome testicus"], tmpdir)
165165
print("#########################################################")
166166
#check results

util/funannotate-BUSCO2.py

+26-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@
4949
except ImportError:
5050
import Queue # Python 2
5151

52+
53+
def which_path(file_name):
54+
for path in os.environ["PATH"].split(os.pathsep):
55+
full_path = os.path.join(path, file_name)
56+
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
57+
return full_path
58+
return None
59+
5260
#get AUGUSTUS path from the required ENV AUGUSTUS_CONFIG_PATH
5361
try:
5462
AUGUSTUS = os.environ["AUGUSTUS_CONFIG_PATH"]
@@ -61,9 +69,24 @@
6169
elif AUGUSTUS.endswith('config'+os.sep):
6270
AUGUSTUS_BASE = AUGUSTUS.replace('config'+os.sep, '')
6371
#location of scripts
64-
NEWSPECIES = os.path.join(AUGUSTUS_BASE, 'scripts', 'new_species.pl')
65-
GB2SMALL = os.path.join(AUGUSTUS_BASE, 'scripts', 'gff2gbSmallDNA.pl')
66-
OPTIMIZE = os.path.join(AUGUSTUS_BASE, 'scripts', 'optimize_augustus.pl')
72+
#check if they are in PATH first, if not then try:
73+
if which_path('new_species.pl'):
74+
NEWSPECIES = 'new_species.pl'
75+
else:
76+
NEWSPECIES = os.path.join(AUGUSTUS_BASE, 'scripts', 'new_species.pl')
77+
if which_path('gff2gbSmallDNA.pl'):
78+
GB2SMALL = 'gff2gbSmallDNA.pl'
79+
else:
80+
GB2SMALL = os.path.join(AUGUSTUS_BASE, 'scripts', 'gff2gbSmallDNA.pl')
81+
if which_path('optimize_augustus.pl'):
82+
OPTIMIZE = 'optimize_augustus.pl'
83+
else:
84+
OPTIMIZE = os.path.join(AUGUSTUS_BASE, 'scripts', 'optimize_augustus.pl')
85+
86+
for x in [NEWSPECIES, GB2SMALL, OPTIMIZE]:
87+
if not which_path(x):
88+
print('Error: {:} is not in PATH, exiting'.format(x))
89+
sys.exit(1)
6790

6891

6992
class BUSCOLogger(logging.getLoggerClass()):

0 commit comments

Comments
 (0)