6372bff538de67595fda0183964a8df4b9b105fb,cnvlib/antitarget.py,,get_background,#Any#Any#Any#Any#,13

Before Change


            max_tgt_chr_name_len = max(map(len, target_chroms))
            chroms_to_skip = [c for c in untgt_chroms
                              if len(c) > max_tgt_chr_name_len]
        for untgt_chr in chroms_to_skip:
            logging.info("Skipping untargeted chromosome %s", untgt_chr)
            del access_chroms[untgt_chr]
    else:
        // Chromosome accessible sequence regions not known -- use heuristics
        // (chromosome length is endpoint of last probe; skip initial
        // <magic number> of bases that are probably telomeric)

After Change


    if access_bed:
        // Chromosomes" accessible sequence regions are given -- use them
        accessible = tabio.read_auto(access_bed)
        access_chroms = set(accessible.chromosome.unique())
        if access_chroms and access_chroms.isdisjoint(target_chroms):
            raise ValueError("Chromosome names in the accessible regions file "
                             "%s %r do not match those in targets %s %r"
                             % (access_bed, tuple(sorted(access_chroms)[:3]),
                                target_bed, tuple(sorted(target_chroms)[:3])))
        // But filter out untargeted alternative contigs and mitochondria
        untgt_chroms = access_chroms - target_chroms
        // Autosomes typically have numeric names, allosomes are X and Y
        is_canonical = re.compile(r"(chr)?(\d+|[XYxy])$")
        if any(is_canonical.match(c) for c in target_chroms):
            chroms_to_skip = [c for c in untgt_chroms
                              if not is_canonical.match(c)]
        else:
            // Alternative contigs have longer names -- skip them
            max_tgt_chr_name_len = max(map(len, target_chroms))
            chroms_to_skip = [c for c in untgt_chroms
                              if len(c) > max_tgt_chr_name_len]
        if chroms_to_skip:
            logging.info("Skipping untargeted chromosomes %s",
                         " ".join(sorted(chroms_to_skip)))
            skip_idx = accessible.chromosome.isin(chroms_to_skip)
            accessible = accessible[~skip_idx]
    else:
        // Chromosome accessible sequence regions not known -- use heuristics
        // (chromosome length is endpoint of last probe; skip initial
        // <magic number> of bases that are probably telomeric)
        TELOMERE_SIZE = 150000
        accessible = guess_chromosome_regions(targets, TELOMERE_SIZE)

    pad_size = 2 * INSERT_SIZE
    bg_arr = (accessible.resize_ranges(-pad_size)
              .subtract(targets.resize_ranges(pad_size)))
    bg_arr = bg_arr.subdivide(avg_bin_size, min_bin_size)
    bg_arr["gene"] = "Background"
    return bg_arr
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: etal/cnvkit
Commit Name: 6372bff538de67595fda0183964a8df4b9b105fb
Time: 2016-12-08
Author: eric.talevich@gmail.com
File Name: cnvlib/antitarget.py
Class Name:
Method Name: get_background


Project Name: allenai/allennlp
Commit Name: 40ec35876d38c4797ad3ee9bf911b019faa5a61d
Time: 2017-08-25
Author: mattg@allenai.org
File Name: allennlp/nn/initializers.py
Class Name: InitializerApplicator
Method Name: __call__


Project Name: allenai/allennlp
Commit Name: 4e97ea190ad48674052e4cf5343617d17c219f73
Time: 2018-01-22
Author: markn@allenai.org
File Name: allennlp/training/trainer.py
Class Name: Trainer
Method Name: _metrics_to_console