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


            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: dit/dit
Commit Name: af57895b84ab9180c17380dd9641f8f9bf909f1d
Time: 2015-06-05
Author: marc.harper@gmail.com
File Name: dit/divergences/generalized_divergences.py
Class Name:
Method Name: renyi_divergence


Project Name: librosa/librosa
Commit Name: 2925b68c1cd97b10d0b89cc6fb593d7e84ff36b5
Time: 2016-05-12
Author: brian.mcfee@nyu.edu
File Name: librosa/beat.py
Class Name:
Method Name: estimate_tempo