Exemple #1
0
def main(argv):
    '''PePr main function. Including preprocing and peak calling. 
    No post-processing'''

    opt = optParser.opt_parser(argv)
    parameter = optParser.process_opt(opt)
    # read data and estimate the shiftsize, normalization constant
    initialize.preprocess(parameter)
    parameter.write_parameter_to_file()

    # read data again, begin to process.

    prepareData.read_files_to_arrays(parameter)
    read_dict = prepareData.prepare_data(parameter)

    if parameter.difftest is False:
        swap = False
        peakfilename = parameter.output_directory + parameter.name + "__PePr_peaks.bed"
        sigTests.negative_binomial(read_dict, peakfilename, swap, parameter)
    else:

        up_peakfilename = parameter.output_directory + parameter.name + "__PePr_chip1_peaks.bed"
        swap = False
        sigTests.negative_binomial(read_dict, up_peakfilename, swap, parameter)
        down_peakfilename = parameter.output_directory + parameter.name + "__PePr_chip2_peaks.bed"
        swap = True
        sigTests.negative_binomial(read_dict, down_peakfilename, swap,
                                   parameter)

    info("PePr finished running, thanks for all the wait!")
Exemple #2
0
def main(argv):
        ## performing the option parser
    opt = optParser.opt_parser(argv)
    parameter, readData = optParser.process_opt(opt)
    ## read in the data
    fileParser.parse(readData, parameter.file_format)

    ## remove the redundant reads
    if (parameter.remove_redundant):
        readData.remove_redundant_reads()

    ## shiftSize estimation and shifting reads
    shiftSize.estimate_shift_size(readData,parameter)
    shiftSize.shift_reads(readData)

    file_in = open(argv[1], 'r')
    file_passed = open(argv[1]+'_passed', 'w')
    file_filtered = open(argv[1]+'_filtered', 'w')
    post_processing(readData,file_in,file_passed,file_filtered)
Exemple #3
0
def main(argv):
    # initialize the logger 
    root_logger = logging.getLogger("")
    debug = root_logger.debug
    info = root_logger.info
    # performing the option parser
    opt = optParser.opt_parser(argv)
    parameter, readData = optParser.process_opt(opt)
    # 1. read and parse the data
    fileParser.parse(readData, parameter.file_format)
    # 2. remove the redundant reads
    if (parameter.remove_redundant):
        readData.remove_redundant_reads()    
    # 3. shiftSize estimation and shifting reads
    shiftSize.estimate_shift_size(readData, parameter)
    shiftSize.shift_reads(readData)
    # 4. calculating the normalization constant 
    windowSize.estimate_normalization_constant(readData, parameter)
    # 5. windowSize estimation and split reads into windows
    windowSize.estimate_window_size(readData, parameter)
    info (" The windowSize is %s", parameter.window_size)
    windowSize.separate_exact_by_window(readData, parameter) 
    # 6. calling peaks
    if parameter.difftest is False:
        swap = False
        peakfilename = parameter.name+"__PePr_peaks.bed"
        sigTests.negative_binomial(readData, peakfilename, swap, parameter)
    else: 
        up_peakfilename = parameter.name+"__PePr_up_peaks.bed"
        swap = False
        sigTests.negative_binomial(readData, up_peakfilename, swap, parameter)
        down_peakfilename = parameter.name+"__PePr_down_peaks.bed"
        swap = True
        sigTests.negative_binomial(readData, down_peakfilename,
                                   swap, parameter)
    # 7. Write to a file that record the command and parameters.     
    parameter.write_parameter_to_file() 
Exemple #4
0
def main(argv):
    # initialize the logger
    root_logger = logging.getLogger("")
    debug = root_logger.debug
    info = root_logger.info
    # performing the option parser
    opt = optParser.opt_parser(argv)
    parameter, readData = optParser.process_opt(opt)
    # 1. read and parse the data
    fileParser.parse(readData, parameter.file_format)
    # 2. remove the redundant reads
    if (parameter.remove_redundant):
        readData.remove_redundant_reads()
    # 3. shiftSize estimation and shifting reads
    shiftSize.estimate_shift_size(readData, parameter)
    shiftSize.shift_reads(readData)
    # 4. calculating the normalization constant
    windowSize.estimate_normalization_constant(readData, parameter)
    # 5. windowSize estimation and split reads into windows
    windowSize.estimate_window_size(readData, parameter)
    info(" The windowSize is %s", parameter.window_size)
    windowSize.separate_exact_by_window(readData, parameter)
    # 6. calling peaks
    if parameter.difftest is False:
        swap = False
        peakfilename = parameter.name + "__PePr_peaks.bed"
        sigTests.negative_binomial(readData, peakfilename, swap, parameter)
    else:
        up_peakfilename = parameter.name + "__PePr_up_peaks.bed"
        swap = False
        sigTests.negative_binomial(readData, up_peakfilename, swap, parameter)
        down_peakfilename = parameter.name + "__PePr_down_peaks.bed"
        swap = True
        sigTests.negative_binomial(readData, down_peakfilename, swap,
                                   parameter)
    # 7. Write to a file that record the command and parameters.
    parameter.write_parameter_to_file()
Exemple #5
0
def pre_processing_module():
    opt = optParser.opt_parser(sys.argv)
    parameter = optParser.process_opt(opt)
    # read data and estimate the shiftsize, normalization constant
    initialize.preprocess(parameter)
    parameter.write_parameter_to_file()