예제 #1
0
def main():
    insertions_bed = snakemake.input.insertions_bed
    deletions_bed = snakemake.input.deletions_bed
    insertions_support = snakemake.input.insertions_support
    deletions_support = snakemake.input.deletions_support
    te_gff = snakemake.input.te_gff
    te_taxonomy = snakemake.input.te_taxonomy
    chromosomes = snakemake.params.chromosomes.split(",")

    sample_name = snakemake.params.sample_name
    out_dir = snakemake.params.out_dir

    mccutils.log("tepid", "running TEPID post processing")
    te_to_family = get_te_family_map(te_taxonomy)
    te_pos_to_family = get_te_pos_family_map(te_gff, te_to_family)
    insertions = read_insertions(insertions_bed,
                                 te_to_family,
                                 sample_name,
                                 te_pos_to_family,
                                 chromosomes,
                                 reference=False)
    insertions = add_support(insertions,
                             insertions_support,
                             threshold=config.READ_SUPPORT_THRESHOLD)

    deletions = read_insertions(deletions_bed,
                                te_to_family,
                                sample_name,
                                te_pos_to_family,
                                chromosomes,
                                reference=True)
    deletions = add_support(deletions,
                            deletions_support,
                            threshold=config.READ_SUPPORT_THRESHOLD)
    non_abs_ref_insertions = get_non_absent_ref_tes(deletions, te_gff,
                                                    te_to_family, sample_name)

    insertions += non_abs_ref_insertions
    if len(insertions) > 0:
        mccutils.make_redundant_bed(insertions,
                                    sample_name,
                                    out_dir,
                                    method="tepid")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="tepid")
    else:
        mccutils.run_command(
            ["touch", out_dir + "/" + sample_name + "_tepid_redundant.bed"])
        mccutils.run_command(
            ["touch", out_dir + "/" + sample_name + "_tepid_nonredundant.bed"])

    mccutils.log("tepid", "TEPID post processing complete")
예제 #2
0
def main():
    mccutils.log("popoolationte", "processing PopoolationTE results")
    popoolationte_out = snakemake.input.popoolationte_out

    out_dir = snakemake.params.out_dir
    sample_name = snakemake.params.sample_name
    log = snakemake.params.log
    chromosomes = snakemake.params.chromosomes.split(",")

    insertions = read_insertions(
        popoolationte_out,
        sample_name,
        chromosomes,
        require_both_end_support=config.REQUIRE_BOTH_END_SUPPORT,
        percent_read_support_threshold=config.PERCENT_READ_SUPPORT_THRESHOLD)
    if len(insertions) >= 1:
        insertions = mccutils.make_redundant_bed(insertions,
                                                 sample_name,
                                                 out_dir,
                                                 method="popoolationte")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="popoolationte")
    else:
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_popoolationte_redundant.bed"
        ])
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_popoolationte_nonredundant.bed"
        ])
    mccutils.log("popoolationte", "PopoolationTE postprocessing complete")
예제 #3
0
def main():
    mccutils.log("retroseq", "processing RetroSeq results")
    retroseq_out = snakemake.input.retroseq_out

    out_dir = snakemake.params.out_dir
    ref_name = snakemake.params.ref_name
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")

    insertions = read_insertions(
        retroseq_out,
        sample_name,
        chromosomes,
        support_threshold=config.READ_SUPPORT_THRESHOLD,
        breakpoint_threshold=config.BREAKPOINT_CONFIDENCE_THRESHOLD)
    if len(insertions) >= 1:
        insertions = mccutils.make_redundant_bed(insertions,
                                                 sample_name,
                                                 out_dir,
                                                 method="retroseq")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="retroseq")
    else:
        mccutils.run_command(
            ["touch", out_dir + "/" + sample_name + "_retroseq_redundant.bed"])
        mccutils.run_command([
            "touch", out_dir + "/" + sample_name + "_retroseq_nonredundant.bed"
        ])
    mccutils.log("retroseq", "RetroSeq post processing complete")
예제 #4
0
def main():
    nonref_gff = snakemake.input.nonref_gff
    ref_gff = snakemake.input.ref_gff
    rm_out = snakemake.input.rm_out

    log = snakemake.params.log
    out_dir = snakemake.params.out_dir
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")

    mccutils.log("relocate2", "processing RelocaTE2 results")

    ref_insertions = get_insertions(
        ref_gff,
        sample_name,
        chromosomes,
        insert_type="ref",
        l_support_threshold=config.REF_LEFT_SUPPORT_THRESHOLD,
        r_support_threshold=config.REF_RIGHT_SUPPORT_THRESHOLD,
        l_junction_threshold=config.REF_LEFT_JUNCTION_THRESHOLD,
        r_junction_threshold=config.REF_RIGHT_JUNCTION_THRESHOLD)

    nonref_insertions = get_insertions(
        nonref_gff,
        sample_name,
        chromosomes,
        insert_type="nonref",
        l_support_threshold=config.NONREF_LEFT_SUPPORT_THRESHOLD,
        r_support_threshold=config.NONREF_RIGHT_SUPPORT_THRESHOLD,
        l_junction_threshold=config.NONREF_LEFT_JUNCTION_THRESHOLD,
        r_junction_threshold=config.NONREF_RIGHT_JUNCTION_THRESHOLD)

    ref_insertions = fix_ref_te_names(ref_insertions, rm_out, sample_name)

    all_insertions = ref_insertions + nonref_insertions

    if len(all_insertions) >= 1:
        all_insertions = mccutils.make_redundant_bed(all_insertions,
                                                     sample_name,
                                                     out_dir,
                                                     method="relocate2")
        mccutils.make_nonredundant_bed(all_insertions,
                                       sample_name,
                                       out_dir,
                                       method="relocate2")
    else:
        mccutils.run_command([
            "touch", out_dir + "/" + sample_name + "_relocate2_redundant.bed"
        ])
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_relocate2_nonredundant.bed"
        ])

    mccutils.log("relocate2", "RelocaTE2 postprocessing complete")
예제 #5
0
def main():
    mccutils.log("te-locate","processing TE-Locate results")
    telocate_raw = snakemake.input.telocate_raw
    te_gff = snakemake.input.te_gff

    out_dir = snakemake.params.out_dir
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")

    insertions = read_insertions(telocate_raw, sample_name, chromosomes, rp_threshold=config.READ_PAIR_SUPPORT_THRESHOLD)
    insertions = filter_by_reference(insertions, te_gff)
    if len(insertions) > 0:
        insertions = mccutils.make_redundant_bed(insertions, sample_name, out_dir, method="telocate")
        mccutils.make_nonredundant_bed(insertions, sample_name, out_dir,method="telocate")
    else:
        mccutils.run_command(["touch", out_dir+"/"+sample_name+"_telocate_redundant.bed"])
        mccutils.run_command(["touch", out_dir+"/"+sample_name+"_telocate_nonredundant.bed"])
    mccutils.log("te-locate", "TE-Locate post processing complete")
예제 #6
0
def main():
    mccutils.log("jitterbug", "jitterbug postprocessing")

    jitterbug_out = snakemake.input.jitterbug_out
    te_taxonomy = snakemake.input.taxonomy

    out_dir = snakemake.params.out_dir
    log = snakemake.params.log
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")

    out = snakemake.output.out

    insertions = read_insertions(
        jitterbug_out,
        te_taxonomy,
        chromosomes,
        sample_name,
        min_fwd_read_support=config.FILTER['MIN_FWD_READ_SUPPORT'],
        min_rev_read_support=config.FILTER['MIN_REV_READ_SUPPORT'],
        min_sr_support=config.FILTER['MIN_SPLIT_READ_SUPPORT'],
        min_zygosity=config.FILTER['MIN_ZYGOSITY'])

    if len(insertions) >= 1:
        insertions = mccutils.make_redundant_bed(insertions,
                                                 sample_name,
                                                 out_dir,
                                                 method="jitterbug")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="jitterbug")
    else:
        mccutils.run_command([
            "touch", out_dir + "/" + sample_name + "_jitterbug_redundant.bed"
        ])
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_jitterbug_nonredundant.bed"
        ])
예제 #7
0
def main():
    raw_bed = snakemake.input.raw_bed

    threads = snakemake.threads
    log = snakemake.params.log
    sample_name = snakemake.params.sample_name
    out_dir = snakemake.params.out_dir
    chromosomes = snakemake.params.chromosomes.split(",")

    out_bed = snakemake.output[0]

    mccutils.log("ngs_te_mapper", "processing ngs_te_mapper results", log=log)

    insertions = read_insertions(raw_bed,
                                 chromosomes,
                                 sample_name,
                                 out_dir,
                                 min_read_cutoff=config.MIN_READ_SUPPORT)

    if len(insertions) > 0:
        insertions = mccutils.make_redundant_bed(insertions,
                                                 sample_name,
                                                 out_dir,
                                                 method="ngs_te_mapper")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="ngs_te_mapper")
    else:
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_ngs_te_mapper_redundant.bed"
        ])
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_ngs_te_mapper_nonredundant.bed"
        ])

    mccutils.log("ngs_te_mapper", "ngs_te_mapper postprocessing complete")
예제 #8
0
def main():
    mccutils.log("temp","running TEMP post processing")
    insert_summary = snakemake.input.insert_summary
    absence_summary = snakemake.input.absence_summary
    te_gff = snakemake.input.te_gff
    log = snakemake.params.log
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")
    out_dir = snakemake.params.out_dir

    insertions = read_insertion_summary(insert_summary, sample_name)
    absence_bed = make_absence_bed(absence_summary, sample_name, out_dir)
    non_absent_ref_insertions = get_non_absent_ref_tes(te_gff, absence_bed, sample_name, out_dir, log)
    insertions += non_absent_ref_insertions
    insertions = filter_insertions(insertions, chromosomes, acceptable_classes=config.ACCEPTABLE_INSERTION_SUPPORT_CLASSES, frequency_theshold=config.FREQUENCY_THRESHOLD)
    if len(insertions) > 0:
        insertions = mccutils.make_redundant_bed(insertions, sample_name, out_dir, method="temp")
        mccutils.make_nonredundant_bed(insertions, sample_name, out_dir, method="temp")
    else:
        mccutils.run_command(["touch", out_dir+"/"+sample_name+"_temp_redundant.bed"])
        mccutils.run_command(["touch", out_dir+"/"+sample_name+"_temp_nonredundant.bed"])
    mccutils.log("temp","TEMP postprocessing complete")
예제 #9
0
def main():
    mccutils.log("popoolationte2", "processing PopoolationTE2 results")
    te_predictions = snakemake.input.popoolationte2_out
    te_gff = snakemake.input.te_gff
    taxonomy = snakemake.input.taxonomy
    out_dir = snakemake.params.out_dir
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")
    log = snakemake.params.log

    ref_tes = get_ref_tes(te_gff, taxonomy, chromosomes)
    insertions = read_insertions(
        te_predictions,
        ref_tes,
        chromosomes,
        sample_name,
        both_end_support_needed=config.REQUIRE_BOTH_END_SUPPORT,
        support_threshold=config.FREQUENCY_THRESHOLD)
    if len(insertions) >= 1:
        insertions = mccutils.make_redundant_bed(insertions,
                                                 sample_name,
                                                 out_dir,
                                                 method="popoolationte2")
        mccutils.make_nonredundant_bed(insertions,
                                       sample_name,
                                       out_dir,
                                       method="popoolationte2")
    else:
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_popoolationte2_redundant.bed"
        ])
        mccutils.run_command([
            "touch",
            out_dir + "/" + sample_name + "_popoolationte2_nonredundant.bed"
        ])

    mccutils.log("popoolationte2", "PopoolationTE2 postprocessing complete")
예제 #10
0
def main():
    relocate_gff = snakemake.input.relocate_gff
    te_gff = snakemake.input.te_gff

    out_dir = snakemake.params.out_dir
    log = snakemake.params.log
    sample_name = snakemake.params.sample_name
    chromosomes = snakemake.params.chromosomes.split(",")

    mccutils.log("relocate","processing RelocaTE results")

    insertions = get_insertions(relocate_gff, sample_name, chromosomes, ref_l_threshold=config.REF_LEFT_THRESHOLD, ref_r_threshold=config.REF_RIGHT_THRESHOLD, nonref_l_threshold=config.NONREF_LEFT_THRESHOLD, nonref_r_threshold=config.NONREF_RIGHT_THRESHOLD)

    insertions = set_ref_orientations(insertions, te_gff)

    if len(insertions) >= 1:
        insertions = mccutils.make_redundant_bed(insertions, sample_name, out_dir, method="relocate")
        mccutils.make_nonredundant_bed(insertions, sample_name, out_dir, method="relocate")
    else:
        mccutils.run_command(["touch",out_dir+"/"+sample_name+"_relocate_redundant.bed"])
        mccutils.run_command(["touch",out_dir+"/"+sample_name+"_relocate_nonredundant.bed"])

    mccutils.log("relocate","RelocaTE postprocessing complete")