示例#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):
        logger.main_info('Failed searching structural variations')
        return None, None, None

    download_manta(logger, bed_fpath)
    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
示例#2
0
def do(ref_fpath, contigs_fpaths, output_dir, meta_ref_fpaths=None, external_logger=None):
    if external_logger:
        global logger
        logger = external_logger
    logger.print_timestamp()
    logger.main_info('Running Reads analyzer...')

    if not compile_reads_analyzer_tools(logger):
        logger.main_info('Failed reads analysis')
        return None, None, None

    if not isdir(output_dir):
        os.makedirs(output_dir)
    download_gridss(logger, qconfig.bed)
    temp_output_dir = join(output_dir, 'temp_output')
    if not isdir(temp_output_dir):
        os.mkdir(temp_output_dir)
    if not qconfig.no_check:
        if qconfig.forward_reads and not \
                all([paired_reads_names_are_equal([read1, read2], temp_output_dir, logger)
                     for read1, read2 in zip(qconfig.forward_reads, qconfig.reverse_reads)]):
            logger.error('  Read names are discordant, skipping reads analysis!')
            return None, None, None

    log_path = join(output_dir, 'reads_stats.log')
    err_fpath = join(output_dir, 'reads_stats.err')
    open(log_path, 'w').close()
    open(err_fpath, 'w').close()
    logger.info('  ' + 'Logging to files %s and %s...' % (log_path, err_fpath))

    bed_fpath, cov_fpath, physical_cov_fpath = run_processing_reads(contigs_fpaths, ref_fpath, meta_ref_fpaths, ref_labels_by_chromosomes,
                                                                    temp_output_dir, output_dir, log_path, err_fpath)

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

    logger.info('Done.')
    return bed_fpath, cov_fpath, physical_cov_fpath
示例#3
0
def do(ref_fpath, contigs_fpaths, output_dir, meta_ref_fpaths=None, external_logger=None):
    if external_logger:
        global logger
        logger = external_logger
    logger.print_timestamp()
    logger.main_info('Running Reads analyzer...')

    if not compile_reads_analyzer_tools(logger):
        logger.main_info('Failed reads analysis')
        return None, None, None

    if not isdir(output_dir):
        os.makedirs(output_dir)
    download_gridss(logger, qconfig.bed)
    temp_output_dir = join(output_dir, 'temp_output')
    if not isdir(temp_output_dir):
        os.mkdir(temp_output_dir)
    if not qconfig.no_check:
        if qconfig.forward_reads and not \
                all([paired_reads_names_are_equal([read1, read2], temp_output_dir, logger)
                     for read1, read2 in zip(qconfig.forward_reads, qconfig.reverse_reads)]):
            logger.error('  Read names are discordant, skipping reads analysis!')
            return None, None, None

    log_path = join(output_dir, 'reads_stats.log')
    err_fpath = join(output_dir, 'reads_stats.err')
    open(log_path, 'w').close()
    open(err_fpath, 'w').close()
    logger.info('  ' + 'Logging to files %s and %s...' % (log_path, err_fpath))

    bed_fpath, cov_fpath, physical_cov_fpath = run_processing_reads(contigs_fpaths, ref_fpath, meta_ref_fpaths, ref_labels_by_chromosomes,
                                                                    temp_output_dir, output_dir, log_path, err_fpath)

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

    logger.info('Done.')
    return bed_fpath, cov_fpath, physical_cov_fpath
示例#4
0
    logger.info('* Compiling aligner *')
    if not compile_aligner(logger):
        modules_failed_to_install.append(
            'Contigs aligners for reference-based evaluation (affects -R and many other options)'
        )
    logger.info('* Compiling gnuplot *')
    if not compile_gnuplot(logger):
        logger.warning(
            'Cannot compile gnuplot. MUMmer plots will not be drawn')
    logger.info('* Compiling Glimmer *')
    if not compile_glimmer(logger):
        modules_failed_to_install.append(
            'Glimmer gene-finding tool (affects --glimmer option)')
    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)'
        )
    if install_full:
        logger.info('* Downloading Manta *')
        if not download_manta(logger):
            modules_failed_to_install.append(
                'Manta (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 *')
示例#5
0
文件: setup.py 项目: student-t/quast
        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):
        modules_failed_to_install.append('Contigs aligners for reference-based evaluation (affects -R and many other options)')
    logger.info('* Compiling gnuplot *')
    if not compile_gnuplot(logger):
        logger.warning('Cannot compile gnuplot. MUMmer plots will not be drawn')
    logger.info('* Compiling Glimmer *')
    if not compile_glimmer(logger):
        modules_failed_to_install.append('Glimmer gene-finding tool (affects --glimmer option)')
    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)')
    if install_full:
        logger.info('* Downloading GRIDSS *')
        if not download_gridss(logger):
            modules_failed_to_install.append('GRIDSS (affects -1/--reads1 and -2/--reads2 options)')
        logger.info('* Downloading BLAST *')
        if not download_blast_binaries(logger):
            modules_failed_to_install.append('BLAST (affects metaquast.py in without references mode and --find-conserved-genes option)')
        logger.info('* Downloading SILVA 16S rRNA gene database *')
        if not download_blastdb(logger):
            modules_failed_to_install.append('SILVA 16S rRNA gene database (affects metaquast.py in without references mode)')
        if qconfig.platform_name != 'macosx':
            logger.info('* Downloading and compiling Augustus *')
            if not download_augustus(logger):
                modules_failed_to_install.append('Augustus (affects --find-conserved-genes option)')