Esempio n. 1
0
def summarizePeaksForPooledPseudoreplicates(infiles, outfile):
    outf = IOTools.openFile(outfile, "w")
    outf.write("Sample_id\t"
               "Experiment\t"
               "Tissue\t"
               "Condition\t"
               "Pseudoreplicate\t"
               "n_peaks\n")
    IDR.countPeaks(infiles, outf)
Esempio n. 2
0
def reMergeBamfiles(infiles, sentinal):
    infiles = [P.snip(x, ".sentinal") + ".bam" for x in infiles]
    outfile = P.snip(sentinal, ".sentinal") + ".bam"
    bad_samples = PARAMS["options_to_remove"].split(",")

    to_merge = IDR.filterBadLibraries(infiles, bad_samples)

    IDR.mergeBams(to_merge, outfile)
    P.touch(sentinal)
Esempio n. 3
0
def summarizePeaksForPooledPseudoreplicates(infiles, outfile):
    outf = IOTools.openFile(outfile, "w")
    outf.write("Sample_id\t"
               "Experiment\t"
               "Tissue\t"
               "Condition\t"
               "Pseudoreplicate\t"
               "n_peaks\n")
    IDR.countPeaks(infiles, outf)
Esempio n. 4
0
def reMergeBamfiles(infiles, sentinal):
    infiles = [P.snip(x, ".sentinal") + ".bam" for x in infiles]
    outfile = P.snip(sentinal, ".sentinal") + ".bam"
    bad_samples = PARAMS["options_to_remove"].split(",")

    to_merge = IDR.filterBadLibraries(infiles, bad_samples)

    IDR.mergeBams(to_merge, outfile)
    P.touch(sentinal)
Esempio n. 5
0
def poolSampleBamfiles(infiles, sentinal):
    """
    Merge filtered sample files for each tissue
    """
    infiles = [P.snip(x, ".sentinal") + ".bam" for x in infiles]
    outfile = P.snip(sentinal, ".sentinal") + ".bam"

    IDR.mergeBams(infiles, outfile)

    P.touch(sentinal)
Esempio n. 6
0
def poolSampleBamfiles(infiles, sentinal):
    """
    Merge filtered sample files for each tissue
    """
    infiles = [P.snip(x, ".sentinal") + ".bam" for x in infiles]
    outfile = P.snip(sentinal, ".sentinal") + ".bam"

    IDR.mergeBams(infiles, outfile)

    P.touch(sentinal)
Esempio n. 7
0
def callPeaksOnIndividualReplicates(infile, outfile):
    infile = P.snip(infile, ".sentinel") + ".bam"
    # fetch peak calling parameters
    PARAMS_PEAKCALLER = get_peak_caller_parameters(
        PARAMS["options_peak_caller"])

    # call peaks
    IDR.callIDRPeaks(infile, outfile, PARAMS["options_peak_caller"],
                     PARAMS["options_control_type"], PARAMS_PEAKCALLER)

    P.touch(outfile)
Esempio n. 8
0
def callPeaksOnPseudoreplicates(infile, outfile):
    # fetch peak calling parameters
    PARAMS_PEAKCALLER = get_peak_caller_parameters(
        PARAMS["options_peak_caller"])

    # call peaks on pseudoreplicates
    IDR.callIDRPeaks(infile,
                     outfile,
                     PARAMS["options_peak_caller"],
                     PARAMS["options_control_type"],
                     PARAMS_PEAKCALLER,
                     pseudoreplicate=True)
Esempio n. 9
0
def callPeaksOnPseudoreplicates(infile, outfile):
    # fetch peak calling parameters
    PARAMS_PEAKCALLER = get_peak_caller_parameters(
        PARAMS["options_peak_caller"])

    # call peaks on pseudoreplicates
    IDR.callIDRPeaks(infile,
                     outfile,
                     PARAMS["options_peak_caller"],
                     PARAMS["options_control_type"],
                     PARAMS_PEAKCALLER,
                     pseudoreplicate=True)
Esempio n. 10
0
def poolInputBamfiles(infiles, sentinal):
    """
    Merge filtered input files for each tissue, with the option of excluding
    undesirable libraries.
    """
    infiles = [P.snip(x, ".sentinal") + ".bam" for x in infiles]
    outfile = P.snip(sentinal, ".sentinal") + ".bam"
    bad_samples = PARAMS["filter_remove_inputs"].split(",")

    to_merge = IDR.filterBadLibraries(infiles, bad_samples)

    IDR.mergeBams(to_merge, outfile)
    P.touch(sentinal)
Esempio n. 11
0
def callPeaksOnIndividualReplicates(infile, outfile):
    infile = P.snip(infile, ".sentinal") + ".bam"
    # fetch peak calling parameters
    PARAMS_PEAKCALLER = get_peak_caller_parameters(
        PARAMS["options_peak_caller"])

    # call peaks
    IDR.callIDRPeaks(infile,
                     outfile,
                     PARAMS["options_peak_caller"],
                     PARAMS["options_control_type"],
                     PARAMS_PEAKCALLER)

    P.touch(outfile)
Esempio n. 12
0
def runIDROnIndividualReplicates(infiles, outfile):
    """
    Run IDR consecutively for each pairwise combination of a particular
    EXPERIMENT
    """
    # set IDR parameters (HACK!) WrapperIDR is in /ifs/devel/CGAT
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS_ANNOTATIONS["interface_contigs"])
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")

    # iterate through pairwise combinations of infiles
    for infile1, infile2 in itertools.combinations(infiles, 2):
        # get statement
        statement = IDR.getIDRStatement(infile1,
                                        infile2,
                                        outfile,
                                        PARAMS["idr_options_overlap_ratio"],
                                        PARAMS["idr_options_ranking_measure"],
                                        chr_table,
                                        idr_script)

        # run
        E.info("applyIDR: processing %s and %s" % (infile1, infile2))
        job_options = "-l mem_free=5G"
        P.run()
Esempio n. 13
0
def runIDROnIndividualReplicates(infiles, outfile):
    """
    Run IDR consecutively for each pairwise combination of a particular
    EXPERIMENT
    """
    # set IDR parameters (HACK!) WrapperIDR is in /ifs/devel/CGAT
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS_ANNOTATIONS["interface_contigs"])
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")

    # iterate through pairwise combinations of infiles
    for infile1, infile2 in itertools.combinations(infiles, 2):
        # get statement
        statement = IDR.getIDRStatement(infile1,
                                        infile2,
                                        outfile,
                                        PARAMS["idr_options_overlap_ratio"],
                                        PARAMS["idr_options_ranking_measure"],
                                        chr_table,
                                        idr_script)

        # run
        E.info("applyIDR: processing %s and %s" % (infile1, infile2))
        job_options = "-l mem_free=5G"
        P.run()
Esempio n. 14
0
def poolInputBamfiles(infiles, sentinel):
    """
    Merge filtered input files for each tissue, with the option of excluding
    undesirable libraries.
    """
    infiles = [P.snip(x, ".sentinel") + ".bam" for x in infiles]
    outfile = P.snip(sentinel, ".sentinel") + ".bam"
    bad_samples = PARAMS["filter_remove_inputs"].split(",")

    if len(infiles) > 1:
        to_merge = IDR.filterBadLibraries(infiles, bad_samples)
        IDR.mergeBams(to_merge, outfile)
    else:
        os.symlink(os.path.abspath(infiles[0]), outfile)
        os.symlink(os.path.abspath(infiles[0]) + ".bai", outfile + ".bai")

    P.touch(sentinel)
Esempio n. 15
0
def poolInputBamfiles(infiles, sentinel):
    """
    Merge filtered input files for each tissue, with the option of excluding
    undesirable libraries.
    """
    infiles = [P.snip(x, ".sentinel") + ".bam" for x in infiles]
    outfile = P.snip(sentinel, ".sentinel") + ".bam"
    bad_samples = PARAMS["filter_remove_inputs"].split(",")

    if len(infiles) > 1:
        to_merge = IDR.filterBadLibraries(infiles, bad_samples)
        IDR.mergeBams(to_merge, outfile)
    else:
        os.symlink(os.path.abspath(infiles[0]), outfile)
        os.symlink(os.path.abspath(infiles[0]) + ".bai", outfile + ".bai")

    P.touch(sentinel)
Esempio n. 16
0
def runIDROnPooledPseudoreplicates(infiles, outfile):
    """
    Run IDR analysis on pooled pseudoreplicates for each EXPERIMENT
    """
    # set IDR parameters
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS_ANNOTATIONS["interface_contigs"])

    # get statement
    statement = IDR.getIDRStatement(infiles[0], infiles[1], outfile,
                                    PARAMS["idr_options_overlap_ratio"],
                                    PARAMS["idr_options_ranking_measure"],
                                    chr_table)

    # run
    E.info("applyIDR: processing %s and %s" % (infiles[0], infiles[1]))
    job_memory = "5G"
    P.run()
Esempio n. 17
0
def runIDROnPseudoreplicates(infiles, outfile):
    """
    Run IDR analysis on pseudoreplicates for each TRACK
    """
    # set IDR parameters
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS_ANNOTATIONS["interface_contigs"])
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")

    # get statement
    statement = IDR.getIDRStatement(infiles[0], infiles[1], outfile,
                                    PARAMS["idr_options_overlap_ratio"],
                                    PARAMS["idr_options_ranking_measure"],
                                    chr_table, idr_script)

    # run
    E.info("applyIDR: processing %s and %s" % (infiles[0], infiles[1]))
    job_options = "-l mem_free=5G"
    P.run()
Esempio n. 18
0
def runIDROnPooledPseudoreplicates(infiles, outfile):
    """
    Run IDR analysis on pooled pseudoreplicates for each EXPERIMENT
    """
    # set IDR parameters
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS["annotations_interface_contigs"])

    # get statement
    statement = IDR.getIDRStatement(infiles[0],
                                    infiles[1],
                                    outfile,
                                    PARAMS["idr_options_overlap_ratio"],
                                    PARAMS["idr_options_ranking_measure"],
                                    chr_table)

    # run
    E.info("applyIDR: processing %s and %s" % (infiles[0], infiles[1]))
    job_memory = "5G"
    P.run()
Esempio n. 19
0
def runIDROnPooledPseudoreplicates(infiles, outfile):
    """
    Run IDR analysis on pooled pseudoreplicates for each EXPERIMENT
    """
    # set IDR parameters
    chr_table = os.path.join(PARAMS["annotations_dir"],
                             PARAMS_ANNOTATIONS["interface_contigs"])
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")

    # get statement
    statement = IDR.getIDRStatement(infiles[0],
                                    infiles[1],
                                    outfile,
                                    PARAMS["idr_options_overlap_ratio"],
                                    PARAMS["idr_options_ranking_measure"],
                                    chr_table,
                                    idr_script)

    # run
    E.info("applyIDR: processing %s and %s" % (infiles[0], infiles[1]))
    job_options = "-l mem_free=5G"
    P.run()
Esempio n. 20
0
def plotBatchConsistencyForIndividualReplicates(infiles, outfile):
    # HACK!
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")
    statement = IDR.getIDRPlotStatement(infiles, outfile, idr_script)
    P.run()
Esempio n. 21
0
def plotBatchConsistencyForIndividualReplicates(infiles, outfile):

    # HACK!
    statement = IDR.getIDRPlotStatement(infiles, outfile)
    P.run()
Esempio n. 22
0
def plotBatchConsistencyForPooledPseudoreplicates(infiles, outfile):
    statement = IDR.getIDRPlotStatement(infiles[0], outfile)
    P.run()
Esempio n. 23
0
def plotBatchConsistencyForPooledPseudoreplicates(infiles, outfile):
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")
    statement = IDR.getIDRPlotStatement(infiles[0], outfile, idr_script)
    P.run()
Esempio n. 24
0
def plotBatchConsistencyForIndividualReplicates(infiles, outfile):
    # HACK!
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")
    statement = IDR.getIDRPlotStatement(infiles, outfile, idr_script)
    P.run()
Esempio n. 25
0
def plotBatchConsistencyForPooledPseudoreplicates(infiles, outfile):
    idr_script = os.path.join(os.path.dirname(P.__file__), "WrapperIDR.py")
    statement = IDR.getIDRPlotStatement(infiles[0], outfile, idr_script)
    P.run()
Esempio n. 26
0
def plotBatchConsistencyForIndividualReplicates(infiles, outfile):

    # HACK!
    statement = IDR.getIDRPlotStatement(infiles, outfile)
    P.run()
Esempio n. 27
0
def plotBatchConsistencyForPooledPseudoreplicates(infiles, outfile):
    statement = IDR.getIDRPlotStatement(infiles[0], outfile)
    P.run()