findpeaks Package

findpeaks Package

Package of peak-finding related analysis modules.

class omsi.analysis.findpeaks.omsi_findpeaks_global(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Basic global peak detection analysis. The default implementation computes the peaks on the average spectrum and then computes the peak-cube data, i.e., the values for the detected peaks at each pixel.

TODO: The current version assumes 2D data

Initialize the basic data members

execute_analysis()

Execute the global peak finding for the given msidata and mzdata.

classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

class omsi.analysis.findpeaks.omsi_findpeaks_local(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Class defining a basic gloabl peak finding. The default implementation computes the peaks on the average spectrum and then computes the peak-cube data, i.e., the values for the detected peaks at each pixel.

TODO: The current version assumes 2D data

Initialize the basic data members

execute_analysis(msidata_subblock=None)

Execute the local peak finder for the given msidata.

Parameters:msidata_subblock – Optional input parameter used for parallel execution of the analysis only. If msidata_subblock is set, then the given subblock will be processed in SERIAL instead of processing self[‘msidata’] in PARALLEL (if available). This parameter is strictly optional and intended for internal use only.
classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

write_analysis_data(analysis_group=None)

This function is used to write the actual analysis data to file. If not implemented, then the omsi_file_analysis API’s default behavior is used instead.

Parameters:analysis_group – The h5py.Group object where the analysis is stored.

omsi_findpeaks_global Module

Global peak finder computing peaks and associated ion-images for the full MSI data.

class omsi.analysis.findpeaks.omsi_findpeaks_global.omsi_findpeaks_global(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Basic global peak detection analysis. The default implementation computes the peaks on the average spectrum and then computes the peak-cube data, i.e., the values for the detected peaks at each pixel.

TODO: The current version assumes 2D data

Initialize the basic data members

execute_analysis()

Execute the global peak finding for the given msidata and mzdata.

classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

omsi_findpeaks_local Module

Local peak finding analysis module.

class omsi.analysis.findpeaks.omsi_findpeaks_local.omsi_findpeaks_local(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Class defining a basic gloabl peak finding. The default implementation computes the peaks on the average spectrum and then computes the peak-cube data, i.e., the values for the detected peaks at each pixel.

TODO: The current version assumes 2D data

Initialize the basic data members

execute_analysis(msidata_subblock=None)

Execute the local peak finder for the given msidata.

Parameters:msidata_subblock – Optional input parameter used for parallel execution of the analysis only. If msidata_subblock is set, then the given subblock will be processed in SERIAL instead of processing self[‘msidata’] in PARALLEL (if available). This parameter is strictly optional and intended for internal use only.
classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

write_analysis_data(analysis_group=None)

This function is used to write the actual analysis data to file. If not implemented, then the omsi_file_analysis API’s default behavior is used instead.

Parameters:analysis_group – The h5py.Group object where the analysis is stored.

findpeaks.third_party Package

findpeaks.third_party Package

Package containing shared third-party code modules included here to reduce the need for external dependencies when only small parts of external code are used.

findpeaks Module

class omsi.analysis.findpeaks.third_party.findpeaks.findpeaks(x, y, sizesmooth, slwindow, peakheight)
Name = 'findpeaks'
display()
peakdet()

Converted from MATLAB script at http://billauer.co.il/peakdet.html

Currently returns two lists of tuples, but maybe arrays would be better

function [maxtab, mintab]=peakdet(v, delta, x) %PEAKDET Detect peaks in a vector % [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local % maxima and minima (“peaks”) in the vector V. % MAXTAB and MINTAB consists of two columns. Column 1 % contains indices in V, and column 2 the found values. % % With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices % in MAXTAB and MINTAB are replaced with the corresponding % X-values. % % A point is considered a maximum peak if it has the maximal % value, and was preceded (to the left) by a value lower by % DELTA.

% Eli Billauer, 3.4.05 (Explicitly not copyrighted). % This function is released to the public domain; Any use is allowed.

sliding_window_minimum()

A iterator which takes the size of the window, k, and an iterable, li. Then returns an iterator such that the ith element yielded is equal to min(list(li)[max(i - k + 1, 0):i+1]).

Each yield takes amortized O(1) time, and overall the generator takes O(k) space.

smoothListGaussian()

findpeaks.experimental Package

findpeaks.experimental Package

Module with experimental analysis code, i.e., code that is not (yet) used in production but is under development. Often this is code that is used in a specific research.

omsi_peakcube Module

omsi.analysis.findpeaks.experimental.omsi_peakcube.main(argv=None)
class omsi.analysis.findpeaks.experimental.omsi_peakcube.omsi_peakcube(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Initalize the basic data members

execute_analysis()
getGlobalMz(peaksBins, peaksMZdata, HCpeaksLabels, HCLabelsList)
getPeakCube(peaksIntensities, peaksArrayIndex, HCpeaksLabels, HCLabelsList)
record_execute_analysis_outputs(analysis_output)

We are recording our outputs manually as part of the execute function

classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

omsi.analysis.findpeaks.experimental.omsi_peakcube.stop()

pfrun Module

omsi.analysis.findpeaks.experimental.pfrun.generateScript(scriptfile, PFcontent=None, repo=None)
omsi.analysis.findpeaks.experimental.pfrun.main(argv)
omsi.analysis.findpeaks.experimental.pfrun.printHelp(thisfilename)
omsi.analysis.findpeaks.experimental.pfrun.queuePCjob(pcstring, therepo=None)
omsi.analysis.findpeaks.experimental.pfrun.run_lpf(omsiInFile, expIndex, dataIndex, ph, slw, smw)
omsi.analysis.findpeaks.experimental.pfrun.run_npg(omsiInFile, expIndex, dataIndex, LPFIndex, mzth, tcut)
omsi.analysis.findpeaks.experimental.pfrun.run_peakcube(omsiInFile, expIndex, dataIndex, LPFIndex, NPGIndex)
omsi.analysis.findpeaks.experimental.pfrun.stop()

omsi_lpf Module

omsi.analysis.findpeaks.experimental.omsi_lpf.cl_peakfind(self, msidt, smoothsize, slwindow, peakheight)
omsi.analysis.findpeaks.experimental.omsi_lpf.execute_analysis(self)
omsi.analysis.findpeaks.experimental.omsi_lpf.main(argv=None)

Then main function

class omsi.analysis.findpeaks.experimental.omsi_lpf.omsi_lpf(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

omsi.analysis.findpeaks.experimental.omsi_lpf.v_qmz

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

omsi.analysis.findpeaks.experimental.omsi_lpf.v_qslice

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

omsi.analysis.findpeaks.experimental.omsi_lpf.v_qslice_viewer_options

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

omsi.analysis.findpeaks.experimental.omsi_lpf.v_qspectrum

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

omsi.analysis.findpeaks.experimental.omsi_lpf.v_qspectrum_viewer_options

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:
def f(cls, arg1, arg2, ...): ... f = classmethod(f)

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

omsi_npg Module

class omsi.analysis.findpeaks.experimental.omsi_npg.Node(label)
omsi.analysis.findpeaks.experimental.omsi_npg.main(argv=None)
class omsi.analysis.findpeaks.experimental.omsi_npg.omsi_npg(name_key='undefined')

Bases: omsi.analysis.base.analysis_base

Initalize the basic data members

Find(x)
MakeSet(x)
Union(x, y)
execute_analysis()
getClustersInfo(GpeaksLabels, GLabelsList)
getCoordIdxB(xCoord, yCoord)
getCoordInfoB(xCoord, yCoord, peaksLabels)
getCoordPeaksB(xCoord, yCoord)
getNearestPeakIndex(myPeaksArray, myPeak)
getPixelMap(Nx, Ny)
classmethod getnpgimage(PeaksLabels, LabelsList, peaksArrayIndex, peaksIntensities, z)
classmethod getnpgspec(PeaksLabels, LabelsList, peaksArrayIndex, peaksIntensities, xCoord, yCoord)
myHC(labelsMMz, TreeCut)
record_execute_analysis_outputs(analysis_output)

We are recording our outputs manually as part of the execute function

splitLabelsList(LabelData, Thres, SplitMax)
classmethod v_qmz(analysis_object, qslice_viewer_option=0, qspectrum_viewer_option=0)

Implement support for qmz URL requests for the viewer

classmethod v_qslice(analysis_object, z, viewer_option=0)

Implement support for qslice URL requests for the viewer

classmethod v_qslice_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

classmethod v_qspectrum(analysis_object, x, y, viewer_option=0)

Implement support for qspectrum URL requests for the viewer

classmethod v_qspectrum_viewer_options(analysis_object)

Define which viewer_options are supported for qspectrum URL’s

omsi.analysis.findpeaks.experimental.omsi_npg.stop()

mypeakfinder Module

omsi.analysis.findpeaks.experimental.mypeakfinder.generateScript(scriptfile, PFcontent=None, repo=None)
omsi.analysis.findpeaks.experimental.mypeakfinder.getJobOutput(jobname, runtype)
omsi.analysis.findpeaks.experimental.mypeakfinder.getPFcmd(pfstring, lpfstring, npgstring, LPFIndex, NPGIndex, SkipNPG, SkipPeakCube, IndexFile=None)
omsi.analysis.findpeaks.experimental.mypeakfinder.main(argv)
omsi.analysis.findpeaks.experimental.mypeakfinder.monitorJob(jobid, jobname, runtype='pf')
omsi.analysis.findpeaks.experimental.mypeakfinder.printHelp(thisfilename)
omsi.analysis.findpeaks.experimental.mypeakfinder.stop()