Ejemplo n.º 1
0
if __name__ == '__main__' :

    TERM_ESCAPE = True

    try :

        pipeline_args = {}

        # herro
        announce('ChIPSeq Experiment Pipeline Script Generator')
        print textwrap.fill(start_text)

        opts, args = parser.parse_args(sys.argv[1:])
        if len(args) > 0 :
            warn("Arguments were passed, but this script doesn't accept any arguments, rudely ignoring them...\n")

        # this dictionary will be used to generate a JSON formatted file with
        # all the relevant settings for the pipeline
        json_dict = {}

        ############################################################################
        # name of the experiment
        ############################################################################
        def_path = os.path.basename(os.getcwd())
        exp_name = input('Experiment name',def_path)
        exp_name = exp_name.replace(' ','_') # shhhhhhhh...

        json_dict['experiment name'] = exp_name
        json_dict['analysis path'] = os.getcwd()
if __name__ == '__main__' :

    TERM_ESCAPE = True

    try :

        pipeline_args = []  # list of (arg_key,arg_val) tuples

        # herro
        announce('ChIP-Seq Experiment Read Alignment Pipeline Script Generator')
        print textwrap.fill(start_text)

        opts, args = parser.parse_args(sys.argv[1:])
        if len(args) > 0 :
            warn("Arguments were passed, but this script doesn't accept any arguments, rudely ignoring them...\n")

        # this dictionary will be used to generate a JSON formatted file with
        # all the relevant settings for the pipeline
        json_dict = {}
        modules_list = []
        
        ############################################################################
        # get settings
        ############################################################################
        global_tool_settings = get_global_tool_settings()
        local_tool_settings = get_local_tool_settings()
        #valid_tool_settings = global_tool_settings.keys() + local_tool_settings.keys()
        all_tool_settings = {}
        all_tool_settings.update(global_tool_settings)
        all_tool_settings.update(local_tool_settings)
Ejemplo n.º 3
0
    # filter the records
    pass_recs = []
    for peak in peaks :
        # test each of the fields, if any one fails skip the record
        if not all([c(int(peak['length'])) for c in field_filters['length']]) or \
           not all([c(int(peak['tags'])) for c in field_filters['tags']]) or \
           not all([c(10**(float(peak['-10*log10(pvalue)'])/-10)) for c in field_filters['pvalue']]) or \
           not all([c(float(peak['fold_enrichment'])) for c in field_filters['fold_enrichment']]) or \
           not all([c(float(peak['FDR(%)'])) for c in field_filters['fdr']]) :
           continue
        else :
            pass_recs.append([peak[k] for k in MACSOutput.FIELD_NAMES])

    if len(pass_recs) == 0 :
        warn('WARNING: no records remain after filtering\n')
        sys.exit(1)

    # sorting
    if opts.sort_by :
        pass_recs.sort(key=_sort_keys[opts.sort_by],reverse=opts.sort_dir != 'ASCEND')

    # top records
    num_recs = len(pass_recs) if not opts.top else min(len(pass_recs),opts.top)

    # construct the summary string
    filters_str = 'none' if len(opts.filters) == 0  else ', '.join(opts.filters)
    sort_str = 'original order' if not opts.sort_by else opts.sort_by+', '+opts.sort_dir
    shuffled_str = str(opts.shuffle)
    summary = summary_str%{'macs_fn':args[0],'num_recs':num_recs,
                           'filters':filters_str,