Esempio n. 1
0
def do(ref_fpath,
       contigs_fpaths,
       reads_fpaths,
       meta_ref_fpaths,
       output_dir,
       external_logger=None,
       sam_fpath=None,
       bam_fpath=None,
       bed_fpath=None):
    if external_logger:
        global logger
        logger = external_logger
    logger.print_timestamp()
    logger.main_info('Running Reads analyzer...')

    if not os.path.isdir(output_dir):
        os.makedirs(output_dir)
    if not compile_reads_analyzer_tools(logger, bed_fpath):
        logger.main_info('Failed searching structural variations')
        return None, None, None

    temp_output_dir = os.path.join(output_dir, 'temp_output')

    if not os.path.isdir(temp_output_dir):
        os.mkdir(temp_output_dir)

    log_path = os.path.join(output_dir, 'sv_calling.log')
    err_path = os.path.join(output_dir, 'sv_calling.err')
    open(log_path, 'w').close()
    open(err_path, 'w').close()
    logger.info('  ' + 'Logging to files %s and %s...' % (log_path, err_path))
    try:
        bed_fpath, cov_fpath, physical_cov_fpath = run_processing_reads(
            ref_fpath,
            meta_ref_fpaths,
            ca_utils.misc.ref_labels_by_chromosomes,
            reads_fpaths,
            temp_output_dir,
            output_dir,
            log_path,
            err_path,
            bed_fpath=bed_fpath,
            sam_fpath=sam_fpath,
            bam_fpath=bam_fpath)
    except:
        bed_fpath, cov_fpath, physical_cov_fpath = None, None, None
        logger.error(
            'Failed searching structural variations! This function is experimental and may work improperly. Sorry for the inconvenience.'
        )
    if not qconfig.debug:
        shutil.rmtree(temp_output_dir, ignore_errors=True)

    logger.info('Done.')
    return bed_fpath, cov_fpath, physical_cov_fpath
Esempio n. 2
0
def do(ref_fpath, contigs_fpaths, reads_fpaths, meta_ref_fpaths, output_dir, external_logger=None, sam_fpath=None, bam_fpath=None, bed_fpath=None):
    if external_logger:
        global logger
        logger = external_logger
    logger.print_timestamp()
    logger.main_info('Running Reads analyzer...')

    if not os.path.isdir(output_dir):
        os.makedirs(output_dir)
    if not compile_reads_analyzer_tools(logger, bed_fpath):
        logger.main_info('Failed searching structural variations')
        return None, None, None

    temp_output_dir = os.path.join(output_dir, 'temp_output')

    if not os.path.isdir(temp_output_dir):
        os.mkdir(temp_output_dir)

    log_path = os.path.join(output_dir, 'sv_calling.log')
    err_path = os.path.join(output_dir, 'sv_calling.err')
    open(log_path, 'w').close()
    open(err_path, 'w').close()
    logger.info('  ' + 'Logging to files %s and %s...' % (log_path, err_path))
    try:
        bed_fpath, cov_fpath, physical_cov_fpath = run_processing_reads(ref_fpath, meta_ref_fpaths, ref_labels_by_chromosomes,
                                                                        reads_fpaths, temp_output_dir, output_dir, log_path, err_path,
                                                                        bed_fpath=bed_fpath, sam_fpath=sam_fpath, bam_fpath=bam_fpath)
    except:
        bed_fpath, cov_fpath, physical_cov_fpath = None, None, None
        logger.error('Failed searching structural variations! This function is experimental and may work improperly. Sorry for the inconvenience.')

    if not qconfig.debug:
        shutil.rmtree(temp_output_dir, ignore_errors=True)

    logger.info('Done.')
    return bed_fpath, cov_fpath, physical_cov_fpath
Esempio n. 3
0
        if a_ == 'install_full':
            args2.append('install')
        else:
            args2.append(a_)
    args = args2

if cmd_in(['install', 'develop', 'build', 'build_ext']):
    logger.info('* Compiling aligner *')
    compile_aligner(logger)
    logger.info('* Compiling Glimmer *')
    compile_glimmer()
    logger.info('* Compiling GAGE *')
    compile_gage()
    if install_full:
        logger.info('* Compiling read analisis tools *')
        compile_reads_analyzer_tools(logger)
        logger.info('* Downloading SILVA 16S rRNA gene database and BLAST *')
        download_all_blast_binaries(logger)
        download_blastdb(logger)

    logger.info('')

if qconfig.platform_name == 'macosx':
    nucmer_files = find_package_files('E-MEM-osx')
    sambamba_files = [join('sambamba', 'sambamba_osx')]
else:
    nucmer_files = find_package_files('MUMmer3.23-linux') + find_package_files(
        'E-MEM-linux')
    sambamba_files = [join('sambamba', 'sambamba_linux')]

bwa_files = [
Esempio n. 4
0
        import matplotlib
    except ImportError:
        try:
            pip.main(['install', 'matplotlib'])
        except:
            logger.warning('Cannot install matplotlib. Static plots will not be drawn (however, HTML will be)')

    logger.info('* Compiling aligner *')
    if not compile_aligner(logger, compile_all_aligners=True):
        modules_failed_to_install.append('Contigs aligners for reference-based evaluation (affects -R and many other options)')
    logger.info('* Compiling Glimmer *')
    if not compile_glimmer(logger):
        modules_failed_to_install.append('Glimmer gene-finding tool (affects --glimmer option)')
    if install_full:
        logger.info('* Compiling read analysis tools *')
        if not compile_reads_analyzer_tools(logger):
            modules_failed_to_install.append('Read analysis tools (affects -1/--reads1 and -2/--reads2 options)')
        logger.info('* Downloading SILVA 16S rRNA gene database and BLAST *')
        if not download_all_blast_binaries(logger) or not download_blastdb(logger):
            modules_failed_to_install.append('SILVA 16S rRNA gene database and BLAST (affects metaquast.py in without references mode)')
        logger.info('* Compiling GAGE *')
        if not compile_gage():
            modules_failed_to_install.append('GAGE scripts (affects --gage option [will be deprecated soon])')
    logger.info('')


if qconfig.platform_name == 'macosx':
    nucmer_files = find_package_files('E-MEM-osx')
    sambamba_files = [join('sambamba', 'sambamba_osx')]
else:
    nucmer_files = find_package_files('MUMmer3.23-linux') + find_package_files('E-MEM-linux')