2770b47ebef34c6feae306f62f52e1d65af5e766,cnvlib/coverage.py,,interval_coverages_pileup,#Any#Any#Any#Any#,148

Before Change


    Calculate log2 coverages in the BAM file at each interval.
    logging.info("Processing reads in %s", os.path.basename(bam_fname))
    if procs == 1:
        return bedcov(bed_fname, bam_fname, min_mapq)
    else:
        chunks = []
        with futures.ProcessPoolExecutor(procs) as pool:
            args_iter = ((bed_chunk, bam_fname, min_mapq)

After Change


    Calculate log2 coverages in the BAM file at each interval.
    logging.info("Processing reads in %s", os.path.basename(bam_fname))
    if procs == 1:
        table = bedcov(bed_fname, bam_fname, min_mapq)
    else:
        chunks = []
        with futures.ProcessPoolExecutor(procs) as pool:
            args_iter = ((bed_chunk, bam_fname, min_mapq)
                         for bed_chunk in to_chunks(bed_fname))
            for bed_chunk_fname, table in pool.map(_bedcov, args_iter):
                chunks.append(table)
                rm(bed_chunk_fname)
        table = pd.concat(chunks, ignore_index=True)
    // Fill in CNA required columns
    if "gene" in table:
        table["gene"] = table["gene"].fillna("-")
    else:
        table["gene"] = "-"
    // NB: User-supplied bins might be zero-width or reversed -- skip those
    spans = table.end - table.start
    ok_idx = (spans > 0)
    table = table.assign(depth=0, log2=NULL_LOG2_COVERAGE)
    table.loc[ok_idx, "depth"] = (table.loc[ok_idx, "basecount"]
                                    / spans[ok_idx])
    ok_idx = (table["depth"] > 0)
    table.loc[ok_idx, "log2"] = np.log2(table.loc[ok_idx, "depth"])
    return table


def _bedcov(args):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: etal/cnvkit
Commit Name: 2770b47ebef34c6feae306f62f52e1d65af5e766
Time: 2017-01-02
Author: eric.talevich@gmail.com
File Name: cnvlib/coverage.py
Class Name:
Method Name: interval_coverages_pileup


Project Name: etal/cnvkit
Commit Name: 52796475005cb8828c73dfbb97ba9820667c9d41
Time: 2016-08-28
Author: eric.talevich@gmail.com
File Name: cnvlib/coverage.py
Class Name:
Method Name: interval_coverages_pileup


Project Name: etal/cnvkit
Commit Name: 595b2e87cd6c77b3a95b061fa3678561a4987134
Time: 2017-01-01
Author: eric.talevich@gmail.com
File Name: cnvlib/coverage.py
Class Name:
Method Name: _bedcov