Beispiel #1
0
def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args, genome_build,
                     pair_stats, work_dir, dirs, config):
    """Perform the alignment of non-mapped reads from previous tier.
    """
    nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(
        in_bam, "tier{}".format(tier_num), work_dir, config)
    if nomap_fq1 is not None:
        base_name = "{}-tier{}out".format(
            os.path.splitext(os.path.basename(in_bam))[0], tier_num)
        config = copy.deepcopy(config)
        dirs = copy.deepcopy(dirs)
        config["algorithm"]["bam_sort"] = "queryname"
        config["algorithm"]["multiple_mappers"] = multi_mappers
        config["algorithm"]["extra_align_args"] = [
            "-i", int(pair_stats["mean"]),
            int(pair_stats["std"])
        ] + extra_args
        out_bam, ref_file = align_to_sort_bam(
            nomap_fq1,
            nomap_fq2,
            lane.rg_names(base_name, base_name, config),
            genome_build,
            "novoalign",
            dirs,
            config,
            dir_ext=os.path.join("hydra",
                                 os.path.split(nomap_fq1)[0]))
        return out_bam
    else:
        return None
Beispiel #2
0
def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args,
                     genome_build, pair_stats,
                     work_dir, dirs, config):
    """Perform the alignment of non-mapped reads from previous tier.
    """
    nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(in_bam, "tier{}".format(tier_num),
                                                       work_dir, config)
    if nomap_fq1 is not None:
        base_name = "{}-tier{}out".format(os.path.splitext(os.path.basename(in_bam))[0],
                                          tier_num)
        config = copy.deepcopy(config)
        dirs = copy.deepcopy(dirs)
        config["algorithm"]["bam_sort"] = "queryname"
        config["algorithm"]["multiple_mappers"] = multi_mappers
        config["algorithm"]["extra_align_args"] = ["-i", int(pair_stats["mean"]),
                                               int(pair_stats["std"])] + extra_args
        out_bam, ref_file = align_to_sort_bam(nomap_fq1, nomap_fq2,
                                              lane.rg_names(base_name, base_name, config),
                                              genome_build, "novoalign",
                                              dirs, config,
                                              dir_ext=os.path.join("hydra", os.path.split(nomap_fq1)[0]))
        return out_bam
    else:
        return None