Skip to content

Commit

Permalink
make BUSCO flexible to conda augustus install
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Palmer committed Feb 24, 2019
1 parent 3af6ebf commit faafdc4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/funannotate-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def runPredictTest():
#run predict
runCMD(['funannotate', 'predict', '-i', inputFasta,
'--protein_evidence', protEvidence,
'-o', 'annotate', '--augustus_species', 'yeast',
'-o', 'annotate', '--augustus_species', 'saccharomyces',
'--cpus', str(args.cpus), '--species', "Awesome testicus"], tmpdir)
print("#########################################################")
#check results
Expand Down
29 changes: 26 additions & 3 deletions util/funannotate-BUSCO2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
except ImportError:
import Queue # Python 2


def which_path(file_name):
for path in os.environ["PATH"].split(os.pathsep):
full_path = os.path.join(path, file_name)
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
return full_path
return None

#get AUGUSTUS path from the required ENV AUGUSTUS_CONFIG_PATH
try:
AUGUSTUS = os.environ["AUGUSTUS_CONFIG_PATH"]
Expand All @@ -61,9 +69,24 @@
elif AUGUSTUS.endswith('config'+os.sep):
AUGUSTUS_BASE = AUGUSTUS.replace('config'+os.sep, '')
#location of scripts
NEWSPECIES = os.path.join(AUGUSTUS_BASE, 'scripts', 'new_species.pl')
GB2SMALL = os.path.join(AUGUSTUS_BASE, 'scripts', 'gff2gbSmallDNA.pl')
OPTIMIZE = os.path.join(AUGUSTUS_BASE, 'scripts', 'optimize_augustus.pl')
#check if they are in PATH first, if not then try:
if which_path('new_species.pl'):
NEWSPECIES = 'new_species.pl'
else:
NEWSPECIES = os.path.join(AUGUSTUS_BASE, 'scripts', 'new_species.pl')
if which_path('gff2gbSmallDNA.pl'):
GB2SMALL = 'gff2gbSmallDNA.pl'
else:
GB2SMALL = os.path.join(AUGUSTUS_BASE, 'scripts', 'gff2gbSmallDNA.pl')
if which_path('optimize_augustus.pl'):
OPTIMIZE = 'optimize_augustus.pl'
else:
OPTIMIZE = os.path.join(AUGUSTUS_BASE, 'scripts', 'optimize_augustus.pl')

for x in [NEWSPECIES, GB2SMALL, OPTIMIZE]:
if not which_path(x):
print('Error: {:} is not in PATH, exiting'.format(x))
sys.exit(1)


class BUSCOLogger(logging.getLoggerClass()):
Expand Down

0 comments on commit faafdc4

Please sign in to comment.