Skip to content

Commit

Permalink
Compile E-MEM and MUMmer during installation
Browse files Browse the repository at this point in the history
  • Loading branch information
almiheenko committed Nov 8, 2016
1 parent 197b5b1 commit c0b6f1c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
8 changes: 6 additions & 2 deletions quast_libs/ca_utils/align_contigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

from quast_libs import options_parser
from quast_libs import qconfig, qutils
from quast_libs.ca_utils.misc import bin_fpath, is_emem_aligner, compile_aligner, e_mem_failed_compilation_flag
from quast_libs.ca_utils.misc import bin_fpath, is_emem_aligner, compile_aligner, e_mem_failed_compilation_flag, \
create_nucmer_output_dir, clean_tmp_files

from quast_libs.log import get_logger
from quast_libs.qutils import is_python_2
Expand Down Expand Up @@ -52,11 +53,14 @@ def check_emem_functionality(logger):
if not is_emem_aligner():
return True
logger.debug('Checking correctness of E-MEM compilation...')
return_code = run_nucmer(qconfig.output_dirpath, options_parser.test_reference, options_parser.test_contigs_fpaths[0],
nucmer_output_dirpath = create_nucmer_output_dir(qconfig.output_dirpath)
nucmer_fpath = join(nucmer_output_dirpath, 'test')
return_code = run_nucmer(nucmer_fpath, options_parser.test_contigs_fpaths[0], options_parser.test_contigs_fpaths[1],
'/dev/null', '/dev/null', 0, emem_threads=1)
if return_code != 0:
logger.main_info('E-MEM does not work properly. QUAST will try to recompile contig aligner software.')
open(e_mem_failed_compilation_flag, 'w').close()
clean_tmp_files(nucmer_fpath)
return compile_aligner(logger)


Expand Down
23 changes: 14 additions & 9 deletions quast_libs/ca_utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ def is_emem_aligner():
return contig_aligner == 'E-MEM'


def compile_aligner(logger, only_clean=False):
def compile_aligner(logger, only_clean=False, compile_all_aligners=False):
global contig_aligner
global contig_aligner_dirpath

if contig_aligner_dirpath is not None and not check_prev_compilation_failed(contig_aligner, join(contig_aligner_dirpath, 'make.failed'),
just_notice=True, logger=logger):
return True
if not compile_all_aligners:
if contig_aligner_dirpath is not None and not \
check_prev_compilation_failed(contig_aligner, join(contig_aligner_dirpath, 'make.failed'), just_notice=True, logger=logger):
return True

if not contig_aligner_dirpath and qconfig.platform_name == 'macosx' and not \
check_prev_compilation_failed('E-MEM', e_mem_failed_compilation_flag, just_notice=True, logger=logger):
contig_aligner = 'E-MEM'
contig_aligner_dirpath = join(qconfig.LIBS_LOCATION, 'E-MEM-osx')
return True
if not contig_aligner_dirpath and qconfig.platform_name == 'macosx' and not \
check_prev_compilation_failed('E-MEM', e_mem_failed_compilation_flag, just_notice=True, logger=logger):
contig_aligner = 'E-MEM'
contig_aligner_dirpath = join(qconfig.LIBS_LOCATION, 'E-MEM-osx')
return True

default_requirements = ['nucmer', 'delta-filter', 'show-coords', 'show-snps', 'mummer', 'mgaps']

Expand All @@ -65,6 +66,10 @@ def compile_aligner(logger, only_clean=False):
continue
contig_aligner = name
contig_aligner_dirpath = dirpath # successfully compiled
if not compile_all_aligners:
return True

if compile_all_aligners and contig_aligner and contig_aligner_dirpath:
return True
logger.error("Compilation of contig aligner software was unsuccessful! QUAST functionality will be limited.")
return False
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ def find_package_files(dirpath, package=quast_package):

if cmd_in(['install', 'develop', 'build', 'build_ext']):
logger.info('* Compiling aligner *')
compile_aligner(logger)
check_emem_functionality(logger)
compile_aligner(logger, compile_all_aligners=True)
logger.info('* Compiling Glimmer *')
compile_glimmer()
logger.info('* Compiling GAGE *')
Expand Down

0 comments on commit c0b6f1c

Please sign in to comment.