UniDec
Universal Deconvolution of Mass and Ion Mobility Spectra
Public Member Functions | Public Attributes | List of all members
UniDec.unidec.UniDec Class Reference
Inheritance diagram for UniDec.unidec.UniDec:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self)
 
def initialize (self)
 
def reset_config (self)
 
def load_config (self, f_name)
 
def export_config
 
def open_file (self, file_name, file_directory, kwargs)
 
def raw_process
 
def process_data (self, kwargs)
 
def run_unidec
 
def unidec_imports
 
def pick_peaks (self)
 
def convolve_peaks (self)
 
def autorun (self)
 
def check_badness (self)
 
def autocorrelation
 
def kendrick_peaks
 
def kendrick_continuous
 
def save_default (self)
 
def load_default (self)
 
def mass_grid_to_f_grid (self)
 
def integrate
 
def autointegrate
 
def get_auto_peak_width (self)
 
def export_params (self, e)
 
def process_mass_data (self)
 
def center_of_mass
 
def fit_all_masses (self)
 
def get_charge_peaks (self)
 
def save_state (self, file_name)
 
def load_state (self, load_path)
 
def cross_validate
 
def normalize_peaks (self)
 
def align_peaks
 
def correlate_intensities (self, pmasses=None, x_range=None, window=None, ci=0.99, kwargs)
 
def get_peaks_scores (self, window=None, x_range=None, ci=0.99, kwargs)
 
def fit_isolated_peaks (self, pmasses=None, x_range=None, window=None, norm=False, plot_fits=False, kwargs)
 
def get_errors (self, kwargs)
 
def open_test_spectrum (self, masslist=None, n=1, kwargs)
 
def make_plot
 

Public Attributes

 version
 
 config
 
 data
 
 pks
 
 autopeaks
 
 peakparams
 
 massfit
 
 massfitdat
 
 errorgrid
 

Constructor & Destructor Documentation

def UniDec.unidec.UniDec.__init__ (   self)
UniDec Engine

Consists of three main subclasses: Config, DataContiner, Peaks

:return: None

Member Function Documentation

def UniDec.unidec.UniDec.align_peaks (   self,
  pmasses = None,
  x_range = None,
  window = None,
  norm = False 
)

Here is the caller graph for this function:

def UniDec.unidec.UniDec.autocorrelation (   self,
  massdat = None 
)
Performs autocorrelation on mass data. Result is stored as self.data.autocorr.
Picks peaks greater than 0 using peak detection parameters in config file.
Peaks are stored as a peak structure at self.autopeaks
:param massdat: Data on which to run autocorrelation. Default is None, in which case self.data.massdat is used.
:return: float. First peak in autocorrelation.
def UniDec.unidec.UniDec.autointegrate (   self,
  ztab = None 
)
Perform automatic integration of peaks.

If self.config.integrateup is empty, the upperbound becomes self.config.peakwindow.
If self.config.integratelb is empty, the lowerbound becomes -self.config.peakwindow.

Integral range for each peak is set to peak.integralrange.
Integral value is set to peak.integral.

If ztab parameter is set to a list of charge states, it will integrate the mass vs charge grid at each
individual charge state. Otherwise, this is ignored.
:param ztab: List of charge states (default = None)
:return: zarea: P x Z array where P is the number of peaks and Z is the number of charge states.
Each value of the array is the integral of peak P at charge state Z.

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.autorun (   self)

Here is the call graph for this function:

def UniDec.unidec.UniDec.center_of_mass (   self,
  data = None,
  limits = None 
)
Return the center of mass and weighted standard deviation for data within some limits. If data is None,
self.data.massdat is used. If limits is None, the whole range is used.
:param data: mass data to determine center of mass
:param limits: limits to restrict the calculation
:return: com, std (center of mass, weighted standard deviation)
def UniDec.unidec.UniDec.check_badness (   self)
Check for problematic variables, such as upper bounds less than lower bounds and raise warning if found.
:return:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.convolve_peaks (   self)
Convolve Peaks with Peak Shape
:return: None
def UniDec.unidec.UniDec.correlate_intensities (   self,
  pmasses = None,
  x_range = None,
  window = None,
  ci = 0.99,
  kwargs 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.cross_validate (   self,
  numcrosstot = 5 
)
Experimental function to perform cross validation
:param numcrosstot: Number of cross validation routines to perform
:return: mean, stddtev (mean and standard deviaition of mass distribution following cross validation)
def UniDec.unidec.UniDec.export_config (   self,
  f_name = None 
)
Export UniDec Configuration File
:param f_name: File name, Default of None will using config.confname
:return: None

Here is the caller graph for this function:

def UniDec.unidec.UniDec.export_params (   self,
  e 
)
Export a number of different parameters about the peaks into different text files.
:param e: if e is "PostFit", it will output mass fit parameters as well
:return: None

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.fit_all_masses (   self)
Fit all masses to a series of peaks, with initial guesses defined by the peak parameters.
:return: self.massfitdat, self.massfit (fit to data, fit parameters)
def UniDec.unidec.UniDec.fit_isolated_peaks (   self,
  pmasses = None,
  x_range = None,
  window = None,
  norm = False,
  plot_fits = False,
  kwargs 
)

Here is the caller graph for this function:

def UniDec.unidec.UniDec.get_auto_peak_width (   self)

Here is the caller graph for this function:

def UniDec.unidec.UniDec.get_charge_peaks (   self)
Determines total charge distribution. Imports each charge state as a peak in self.pks.
Will overwrite mass peaks.
:return: cpeaks (Z x 2 array of (charge state, intensity))
def UniDec.unidec.UniDec.get_errors (   self,
  kwargs 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.get_peaks_scores (   self,
  window = None,
  x_range = None,
  ci = 0.99,
  kwargs 
)

Here is the caller graph for this function:

def UniDec.unidec.UniDec.initialize (   self)
Initialize Config, DataContainer, and Peaks
:return: None

Here is the call graph for this function:

def UniDec.unidec.UniDec.integrate (   self,
  limits,
  data = None 
)
Trapezoid ntegrate data between limits[0] and limits[1]
:param limits: [min,max] list of lower and upper bounds on integration
:param data: N x 2 array of data (mass, intensity)
If data is None (default), self.data.massdat is used.
:return: None

Here is the caller graph for this function:

def UniDec.unidec.UniDec.kendrick_continuous (   self,
  ref_mass = None,
  centermode = 0,
  nbins = 50,
  transformmode = 0,
  xaxistype = 1 
)
Runs continuous Kendrick analysis on self.data.massdat
:param ref_mass: Kendrick mass. Default is self.config.kendrickmass if it is already set and >0.
Otherwise, default is oligomer mass (self.config.molig)
:param centermode: Set range for normalization 0=(0,1),1=(-0.5,0.5). Default is 0.
:param nbins: Set mass defect axis density. Default is 50 bins.
:param transformmode: Set type of transformation. 0=Interpolation. 1=Integration. Default is 0.
:param xaxistype: Set x-axis dimensions. 0=Kendrick Mass Number, 1=Mass Number * Kendrick Mass. Default is 1.
:return: mass grid, mass defect grid, intensity grid. All with shape (len(self.data.massdat),nbins)
def UniDec.unidec.UniDec.kendrick_peaks (   self,
  kmass = None,
  centermode = 1 
)
Run Kendrick analysis on peaks (self.pks object)
:param kmass: Kendrick mass. Default is prior kendrick mass if it exists and is >0.
Otherwise, default is oligomer mass (self.config.molig)
:param centermode: Set range for normalization 1=(0,1),0=(-0.5,0.5)
:return: Array of [mass,defect] for each peak in self.pks.
def UniDec.unidec.UniDec.load_config (   self,
  f_name 
)
Import UniDec Configuration File
:param f_name: File name
:return: None

Here is the caller graph for this function:

def UniDec.unidec.UniDec.load_default (   self)
Loads config from default location set at self.config.defaultconfig
:return: None
def UniDec.unidec.UniDec.load_state (   self,
  load_path 
)
Load UniDec state from a zip save file.

Note: save_state is located under unidectools (ud.savestate)
:param load_path: .zip file to load
:return: True is successful, False if failed

Here is the call graph for this function:

def UniDec.unidec.UniDec.make_plot (   self,
  massrange = None 
)

Here is the caller graph for this function:

def UniDec.unidec.UniDec.mass_grid_to_f_grid (   self)
Convert the mass vs charge grid to a mass vs charge offset grid.

Calculates the charge offset for each (mass,charge) point, creates a new axis of regularly spaced charge
offsets (oaxis), and the interpolates a new grid of (mass, offset) from oaxis, which is output as outgrid.
:return: oxais, outgrid: offset axis (N) and offset grid (M x N)
def UniDec.unidec.UniDec.normalize_peaks (   self)
Noamlize everything in the peaks accoring to the type set in self.config.peaknorm
    0 = No normalization
    1 = Normalize the max value to 1
    2 = Normalize the sum to 1
:return: None

Here is the caller graph for this function:

def UniDec.unidec.UniDec.open_file (   self,
  file_name,
  file_directory,
  kwargs 
)
Open text or mzML file. Will create _unidecfiles directory if it does not exist.

If it finds a _conf.dat file in _unidecfiles, it will import the old configuration.
Otherwise, it keeps the existing configuration but resets file names.

If silent=True is passed in **kwargs, prints are suppressed.

:param file_name: Name of file to open. May be in  x y or x y z text format or in mzML format.
May be tab or space delimited
:param file_directory: Directory in which filename is located
:return: None

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.open_test_spectrum (   self,
  masslist = None,
  n = 1,
  kwargs 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.pick_peaks (   self)
Detect, Normalize, and Output Peaks
:return: None

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.process_data (   self,
  kwargs 
)
Process data according to parameters in config.

Checks certain parameters to make sure the limits make sense.
Will accept silent=True kwarg to suppress printing.
:return: None

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.process_mass_data (   self)
Apply the same parameters used to process the data to process the mass distribution. Linearization parameters
are ignored, but smoothing, baseline subtraction, normalization, and intensity threshold all apply.
:return: None
def UniDec.unidec.UniDec.raw_process (   self,
  dirname,
  inflag = False,
  binsize = 1 
)
Processes Water's Raw files into .txt using external calls to:
    self.config.rawreaderpath for MS
    self.config.cdcreaderpath for IM-MS

Default files are created with the header of the .raw file plus:
    _rawdata.txt for MS
    _imraw.txt for IM-MS

:param dirname: .raw directory name
:param inflag: If True, it will put the output .txt file inside the existing .raw directory. If False, it will
put the file in the same directory that contains the .raw directory
:param binsize: Parameter for IM-MS to specify the m/z bin size for conversion. If binsize=0, the conversion
will be at full resolution (which is huge), so the default is every 1 m/z.
:return: self.config.filename, self.config.dirname (name and location of created file)
def UniDec.unidec.UniDec.reset_config (   self)
Resets UniDec config to default. Should not reset paths or filenames.
:return: None

Here is the caller graph for this function:

def UniDec.unidec.UniDec.run_unidec (   self,
  silent = False,
  efficiency = False 
)
Runs UniDec.

Checks that everything is set to go and then places external call to:
    self.config.UniDecPath for MS
    self.config.UniDecIMPath for IM-MS

If successful, calls self.unidec_imports()
If not, prints the error code.
:param silent: If True, it will suppress printing the output from UniDec
:param efficiency: Passed to self.unidec_imports()
:return: out (stdout from external UniDec call)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec.UniDec.save_default (   self)
Saves existing config in default location set at self.config.defaultconfig
:return: None
def UniDec.unidec.UniDec.save_state (   self,
  file_name 
)
def UniDec.unidec.UniDec.unidec_imports (   self,
  efficiency = False 
)
Imports files output from the UniDec core executable into self.data.
:param efficiency: If True, it will ignore the larger files to speed up the run.
:return: None

Here is the caller graph for this function:

Member Data Documentation

UniDec.unidec.UniDec.autopeaks
UniDec.unidec.UniDec.config
UniDec.unidec.UniDec.data
UniDec.unidec.UniDec.errorgrid
UniDec.unidec.UniDec.massfit
UniDec.unidec.UniDec.massfitdat
UniDec.unidec.UniDec.peakparams
UniDec.unidec.UniDec.pks
UniDec.unidec.UniDec.version

The documentation for this class was generated from the following file: