Beispiel #1
0
    def configure(self, title, pipeline_blocks, pipeline_globals,
                  pipeline_externals, pipeline_allowed_input_data):
        self.title = title
        self.globals = OptionsHolder('Globals', pipeline_globals)
        self.externals = pipeline_externals
        self.allowed_input_data = pipeline_allowed_input_data
        self.options_holders = []
        index = -1
        for block in pipeline_blocks:
            index += 1
            options_holder = OptionsHolder('', block[1])
            options_holder.optional = block[3]
            options_holder.selected = block[4]
            options_holder.command_line = block[0]
            options_holder.title = block[2]
            options_holder.index = index

            self.options_holders.append(options_holder)
                for row in csv_reader:
                    index += 1
                    if index == 0:
                        metids = row[1:]
                    else:
                        sampleid = row[0]
                        metvals = row[1:]
                        minlen = min(len(metids), len(metvals))
                        write_meta_values(h5, h5writepath, str(sampleid),
                                          metids[0:minlen], metvals[0:minlen],
                                          parameters['overwrite'] == 'yes')


if __name__ == "__main__":
    tic()
    settings = OptionsHolder(__doc__, ImportMetaSet_options)
    settings.description = 'Metadata import'
    settings.do = 'yes'
    printlog(settings.program_description)
    #Parse command line parameters
    try:
        settings.parse_command_line_args()
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!')
        printlog(inst)
        printlog('\nRun python ' + sys.argv[0] +
                 ' --help for command line options information!')
        sys.exit(-1)

    parameters = settings.parameters
    if parameters['logfile'] != '':
        idx = np.argmin(test*ref)
        divpoint = mididx[idx]+1

        return divpoint    
    
    def export(self):
        """
        Prepares peak alignment parameter set for export  
        """
        self.minsegwidth = self.minsegwidth * self.rtrange[1]
        self.maxpeakshift = self.maxpeakshift * self.rtrange[1]

    
if __name__ == "__main__": 
    tic();
    settings=OptionsHolder(__doc__, InternalAlign_options);
    settings.description='Profile Alignment';
    settings.do='yes';
    printlog(settings.program_description);
    try:
        settings.parse_command_line_args()   
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!');
        printlog(inst);
        printlog('\nRun python ' + sys.argv[0] + ' --help for command line options information!');
        sys.exit(-1)

    parameters = settings.parameters;
    if parameters['logfile'] != '':
        start_log(parameters['logfile'], overwrite_existing = (parameters['overwrite_logfile'] == 'yes'), verbosity_level = parameters['verbose']);
        printlog(settings.program_description, print_enabled = False);
Beispiel #4
0
            sp_mean = sp_mean + sp
            dataidx = np.append(dataidx, j)
        except Exception as inst:
            printlog(os.path.basename(datasetid) + ": Failed to readin")
            printlog(inst)

    dataidx = dataidx.astype(int)
    datasets = list(map(datasets.__getitem__, (dataidx)))
    sp_mean = sp_mean / len(dataidx)

    return sp_mean, crt, datasets


if __name__ == "__main__":
    tic()
    settings = OptionsHolder(__doc__, TICvis_options)
    settings.description = 'Intra-Sample Peak Alignment'
    settings.do = 'yes'
    printlog(settings.program_description)
    #Parse command line parameters
    try:
        settings.parse_command_line_args()
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!')
        printlog(inst)
        printlog('\nRun python ' + sys.argv[0] +
                 ' --help for command line options information!')
        sys.exit(-1)

    parameters = settings.parameters
    if parameters['logfile'] != '':
Beispiel #5
0
        if self.method == 'tophat':
            nsp, nmz = ics.shape
            for i in range(nmz):
                ics[:, i] = ndimage.white_tophat(ics[:, i], None, self.__se)
            ics[ics <= 0] = 0
        return ics

    def export(self, rtrange):
        if self.method == 'tophat':
            del self.__se
            self.params['frame'] = self.params['frame'] * rtrange[1]


if __name__ == "__main__":
    tic()
    settings = OptionsHolder(__doc__, NoiseFilter_options)
    settings.description = 'Noise Filtering'
    settings.do = 'yes'
    printlog(settings.program_description)
    #Parse command line parameters
    try:
        settings.parse_command_line_args()
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!')
        printlog(inst)
        printlog('\nRun python ' + sys.argv[0] +
                 ' --help for command line options information!')
        sys.exit(-1)

    parameters = settings.parameters
    if parameters['logfile'] != '':
Beispiel #6
0
#---------------------------------------------------------------------------

#Please also inherit your classes from object or its descendants to make the
#following call to the parent class init work:
#def __init__(self):
#    super(type(self), self).__init__()

#===========================================================================

#Here the main part of the code which is executed when the module is run starts
if __name__ == "__main__":
    tic()
    #Start default timer

    #Create command line options handler
    settings = OptionsHolder(__doc__, cmdline_options)

    #Set module short description. <Replace 'Template module' with your description>
    settings.description = 'Template module'
    settings.do = 'yes'  #Legacy. If you do not intend to - just do not run the module

    #Print full module description from header. <Can be changed safely to print
    #instead of printlog since logging is not initialized yet, but kept for consistency>
    printlog(settings.program_description)

    #Parse command line parameters
    try:
        settings.parse_command_line_args()
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!')
        printlog(inst)
Beispiel #7
0
                          'raw/crtrange',
                          data=[
                              np.floor(minrt * self.time_mult),
                              resrt * self.time_mult,
                              np.ceil(maxrt * self.time_mult)
                          ])

        printlog('Minimal mz: %s' % np.floor(minmass))
        printlog('Maximal mz: %s' % np.ceil(maxmass))
        printlog('Minimal rt (sec): %s' % np.floor(minrt * self.time_mult))
        printlog('Maximal rt (sec): %s' % np.ceil(maxrt * self.time_mult))


if __name__ == "__main__":
    tic()
    settings = OptionsHolder(__doc__, ImportSet_options)
    settings.description = 'Import Raw Data'
    printlog(settings.program_description)
    #Parse command line parameters
    try:
        settings.parse_command_line_args()
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!')
        printlog(inst)
        printlog('\nRun python ' + sys.argv[0] +
                 ' --help for command line options information!')
        sys.exit(-1)

    parameters = settings.parameters
    if parameters['logfile'] != '':
        start_log(
Beispiel #8
0
    
    fpath = os.path.split(output_prefix)[0];
    
    if not os.path.exists(fpath):
        os.makedirs(fpath);
        
    export_HTML_view_to_file(dbfilepath, params['h5readpath'], output_prefix, params['h5fullprofile'],
                             params['plot_width'], params['top_plot_height'], params['bottom_plot_height']);

                    
    return
        

if __name__ == "__main__": 
    tic();
    settings=OptionsHolder(__doc__, Reporting_options);
    settings.description='Generating HTML report';
    settings.do='yes';
    printlog(settings.program_description);
    #Parse command line parameters
    try:
        settings.parse_command_line_args()   
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!');
        printlog(inst);
        printlog('\nRun python ' + sys.argv[0] + ' --help for command line options information!');
        sys.exit(-1)

    parameters = settings.parameters;
    if parameters['logfile'] != '':
        start_log(parameters['logfile'], overwrite_existing = (parameters['overwrite_logfile'] == 'yes'), verbosity_level = parameters['verbose']);
Beispiel #9
0
    if not ('no' in params['export_integral_table']):
        export_integral_table_to_file(dbfilepath, params['h5readpath'], output_prefix, dataset_names, params['samples'], params['rts'], params['rt_tolerance']);

    if not ('no' in params['export_metadata_table']):
        export_metadata_table_to_file(dbfilepath, params['h5readpath'], output_prefix, dataset_names, params['samples']);

    '''if not ('no' in params['export_all_peaks']):
        export_all_peaks_to_file(dbfilepath, params['h5readpath'], output_prefix, dataset_names);
    '''                
    return
      
        

if __name__ == "__main__": 
    tic();
    settings=OptionsHolder(__doc__, Exporting_options);
    settings.description='Exporting processed data';
    settings.do='yes';
    printlog(settings.program_description);
    #Parse command line parameters
    try:
        settings.parse_command_line_args()   
    except Exception as inst:
        printlog('!!! Error in command line parameters: !!!');
        printlog(inst);
        printlog('\nRun python ' + sys.argv[0] + ' --help for command line options information!');
        sys.exit(-1)
    
    parameters = settings.parameters;
    if parameters['logfile'] != '':
        start_log(parameters['logfile'], overwrite_existing = (parameters['overwrite_logfile'] == 'yes'), verbosity_level = parameters['verbose']);
Beispiel #10
0
            del h5file[i]

    def mkdir(self, target):
        """
        Make group defined by target
        """
        target = abs_hdf5_path(target, self.h5path).rstrip('/')
        printlog('Creating group %s' % (target))
        if target in self.h5file:
            printlog('Error! %s already exists!' % target)
        else:
            self.h5file.create_group(target)


if __name__ == "__main__":
    settings = OptionsHolder(__doc__, Manipulate_options)
    settings.description = 'Manipulation of HDF5 file'
    settings.do = 'yes'
    printlog(settings.program_description)
    settings.parse_command_line_args()

    parameters = settings.parameters
    if parameters['logfile'] != '':
        start_log(
            parameters['logfile'],
            overwrite_existing=(parameters['overwrite_logfile'] == 'yes'))
        printlog(settings.program_description, print_enabled=False)

    printlog('Started on %s ' % (time.strftime("%a, %d %b %Y at %H:%M:%S")))
    printlog(settings.format_parameters())
    tic()