Skip to content

Commit

Permalink
Tiny fixes regarding BUSCO downloading and running (better error mess…
Browse files Browse the repository at this point in the history
…ages; do not run on Python 2.6 and earlier)
  • Loading branch information
alexeigurevich committed Nov 21, 2018
1 parent 6726475 commit 3807272
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions quast.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def main(args):
if qconfig.platform_name == 'macosx':
logger.main_info("")
logger.warning("BUSCO can be run on Linux only")
elif sys.version[0:3] == '2.5':
elif sys.version[0:3] < '2.7':
logger.main_info("")
logger.warning("BUSCO does not support Python versions earlier than 2.6.")
logger.warning("BUSCO does not support Python versions earlier than 2.7.")
else:
from quast_libs import run_busco
run_busco.do(contigs_fpaths, os.path.join(output_dirpath, qconfig.busco_dirname), logger)
Expand Down
4 changes: 3 additions & 1 deletion quast_libs/qutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,9 @@ def download_file(url, fpath, tool_name, move_file=True):
_, exc_value, _ = sys.exc_info()
logger.error(
'Failed downloading %s (url: %s), QUAST functionality will be limited! '
'Exception caught: %s' % (tool_name, url, exc_value))
'Exception caught: %s\n'
'You can try to download the file manually, place it in %s and restart QUAST'
% (tool_name, url, exc_value, fpath))
return None
if move_file:
shutil.move(fpath + '.download', fpath)
Expand Down
10 changes: 4 additions & 6 deletions quast_libs/ra_utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@ def get_gridss_fpath():


def download_unpack_compressed_tar(name, download_url, downloaded_fpath, final_dirpath, logger, ext='gz'):
if download_file(download_url, downloaded_fpath, name, move_file=False):
unpack_tar(downloaded_fpath + '.download', final_dirpath, ext=ext)
if download_file(download_url, downloaded_fpath, name, move_file=True):
unpack_tar(downloaded_fpath, final_dirpath, ext=ext)
logger.main_info(' Done')
else:
logger.main_info(' Failed downloading %s from %s!' % (name, download_url))
return False
return True
return False


def unpack_tar(fpath, dst_dirpath, ext='bz2'):
shutil.move(fpath, fpath)
import tarfile
tar = tarfile.open(fpath, "r:" + ext)
tar.extractall(dst_dirpath)
Expand Down
4 changes: 4 additions & 0 deletions tc_tests/test_busco.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
print('Busco can be run on Linux only')
sys.exit(0)

if sys.version[:3] < '2.7':
print('BUSCO does not support Python versions earlier than 2.7')
sys.exit(0)

name = os.path.basename(__file__)[5:-3]
contigs = [meta_contigs_1, meta_contigs_2]

Expand Down

0 comments on commit 3807272

Please sign in to comment.