unidec.modules package

Subpackages

Submodules

unidec.modules.AutocorrWindow module

class unidec.modules.AutocorrWindow.AutocorrWindow(*args, **kwargs)

Bases: Dialog

Dialog window for autocorrelation.

initalize_dialog(config, massdat, window=None)

Initilizes dialog and the layout. Calls run_autocorr. :param config: UniDecConfig object :param massdat: Array of mass distribution (N x 2) :return: None

on_close(e)

Close dialog. :param e: Unused event :return: None

on_close_cancel(e)

Cancel the dialog. :param e: Unused event :return: None

run_autocorr(e)

Performs autocorrelation using ud.autocorr from unidectools. Plots the results and adds peaks to listctrl. :param e: Unused event :return: None

class unidec.modules.AutocorrWindow.CorrListCtrl(parent, id_value, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

Class for the list control of peak values

clear_list()

Clears the list. :return: None

populate(pks)

Add Peaks class object to the panel. Adds p.textmarker to the first column and p.mass to the second. The background color is set to p.color. :param pks: Peaks object :return: None

class unidec.modules.AutocorrWindow.CorrListCtrlPanel(parent)

Bases: Panel

Panel for the ListCtrl

unidec.modules.CDCal module

class unidec.modules.CDCal.CDCalDialog(parent, *args, **kwargs)

Bases: Frame

initialize_interface(config)

Initialize the parameters, set up the panels, and display the interface. :param config: UniDecConfig object :return: None

load_csv(path)
on_add(e)

Add lines to the masspanel. :param e: Unused event :return: None

on_load_csv(e=None)
on_plot(e=None)

Gathers all of the parameters, fits, and plots the data. :param e: wx.Event :return: None

setup_panel()

Make/remake the main panel. :return: None

class unidec.modules.CDCal.CDListCtrl(parent, id_val, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(val='File Name')

Add a new line to the list. :param val: Value for the first column. Default is 0. Default for second column is 0. :return: None

clear_list()

Clear list. :return: None

get_list()

Return the list of values in the listctrl. :return: Nested list of listctrl output

on_delete(event)

Delete the selected item. :param event: Unused event. :return: None

on_right_click(event)

Create a right click menu. :param event: Unused event :return: None

populate(data, colors=None)

Add data from array or nested list to the listctrl. :param data: List or array of data values. :param colors: Background colors list :return: None

class unidec.modules.CDCal.CDListCtrlPanel(parent, size=(1000, 300))

Bases: Panel

unidec.modules.CDEng module

unidec.modules.CDEng.Gmax2(darray)
class unidec.modules.CDEng.UniDecCD

Bases: UniDec

before_open(refresh=False)

Creates the initial blank self.pks and self.data objects. Creates the _unidecfiles folder if needed. Sets the default file names. If it finds raw data already in the numpy compressed format, it switches the path to that. :return: None

convert(slope=None)
convert_stori(path)
create_mass_axis(harray=None, mass=None)
decon_core()

Core unidec deconvolution function. Needs kernels already in place. :return: self.harray, the intensity array.

decon_external_call()
exe_mode(exemode=True)
extract_intensities(mass, minz, maxz, window=25, sdmult=2, noise_mult=0)
filter_centroid_all(mz_threshold=1)

Filter the self.farray to remove ions with nearby ions. See Worner et Al., Nat. Methods, 2020.

Removed all the resolution settings of Worner et Al in favor of a simple single mz_threshold.

Parameters:

mz_threshold – Distance cutoff. Two points in the same scan closer than this will be removed.

Returns:

None

filter_int(int_range)

Filter the self.farray to include only intensities within the int_range.

Parameters:

int_range – list or array with int_range[0] as the minimum intensity and int_range[1] as the maximum

Returns:

None

filter_mdist(I, setup=True)
filter_mz(mzrange=None)

Filter the self.farray to include only m/z value within the mzrange.

Parameters:

mzrange – list or array with mzrange[0] as the minimum m/z and mzrange[1] as the maximum

Returns:

self.farray, the filtered data array

filter_z(zrange, slope=None)

Function to filter intensities based on their eventual charge state. Calculates int_range from zrange based on the slope. Calls self.filter_int from the calculated int_range.

Parameters:
  • zrange – list or array with zrange[0] as the minimum charge state and zrange[1] as the maximum.

  • slope – Optional parameter to specify the slope. If None (default), will use self.config.CDslope

Returns:

None

filter_zdist(I, setup=True)
get_fit(extracts)
get_fit_linear(extracts)
get_fit_quadratic(extracts)
harray_process(transform=True)
hist_data_prep(harray=None)
hist_datareduction(harray, red_per)
hist_filter_smash(harray, smashrange=None)

Smashes the range region to 0. Used to eliminate unwanted peaks. :return: None

hist_int_threshold(harray, int_threshold)

Filter the harray to include only intensities above the int_threshold.

Parameters:
  • harray – 2D numpy array to be filtered

  • int_threshold – Intensity threshold

Returns:

harray, the filtered 2D numpy array

hist_mass_filter(harray, massrange=None)
hist_nativeZ_filter(nativeZrange=None)
histogram(mzbins=1, zbins=1, x=None, y=None, mzrange=None, zrange=None)
make_kernel(mzsig=None, zsig=None)

Sets up the deconvolution kernels based on the provided mzsig and zsig values, which specify the peak FWHM in m/z and z. :param mzsig: FWHM for m/z in units of Th. :param zsig: FWHM for charge. This is also the uncertainty for the charge assignment. :return: None

open_cdms_file(path, refresh=False)

Main function for opening CD-MS files. Supports Thermo Raw, mzML, text, binary, and numpy compressed.

Calls self.before_open() first to setup UniDec files and directories. Searches first for previously opened numpy compressed data. Switches path to that if found. Otherwise it opens the specified path.

Thermo Data via .Raw or .mzML needs to be corrected first by multiplying by the injection times in units of s.

Text, binary, and numpy files are opened assuming the first column is m/z, the second is intensity, the third is scans. If no third column is provided, it assigns a scan number of 1 to each. The m/z, intensity, and scan data is saved in self.darray (the raw data array).

Next, it filters out any data with intensities of zero. The noise is calculated as the maximum of the second derivative of the intensity distribution, also known as the Gmax2. The self.farray (filtered array) is created from self.darray.

An Import Error is raised if the darray is empty

The min and max m/z values are set from the darray.

Then, saves a numpy compressed file if it doesn’t exist for faster imports in the future. Finally, it opens the config file if found in the _unidecfiles folder.

Parameters:

path – File path to open.

Returns:

None

open_file(path, refresh=False)

Passthrough function for opening CD-MS files. Calls self.open_cdms_file. :param path: File path :param refresh: Whether to refresh file :return: None

open_stori(path)
plot_add()
plot_hist()
plot_mzmass_hist()
process_data(transform=True)

Main function for processing CDMS data, includes filtering, converting intensity to charge, histogramming, processing the histograms, and transforming (if specified). Transforming is sometimes unnecessary, which is why it can be turned off for speed.

Parameters:

transform – Sets whether to transform the data from m/z to mass. Default True.

Returns:

None

run_deconvolution(process_data=True)

Function for running the full deconvolution sequence, including setup, pre-, and post-processing.

Returns:

None

setup_msmooth()
setup_zsmooth()
sim_dist()
simp_convert(y)
transform(harray=None, dataobj=None, ztab=None, mass=None, mz=None)
transform_mzmass()
unidec.modules.CDEng.cconv2D_preB(a, B)
unidec.modules.CDEng.fft_fun(a)
unidec.modules.CDEng.filter_centroid_const(d, mz_threshold=1)
unidec.modules.CDEng.ifft_fun(A, shape)
unidec.modules.CDEng.linearmodel(x, slope, intercept)
unidec.modules.CDEng.ndis(x, y, s)
unidec.modules.CDEng.quadraticmodel(x, a, b, c)
unidec.modules.CDEng.safedivide(a, b)
unidec.modules.CDEng.slopefunc(x, slope)
unidec.modules.CDEng.softmax(I, beta)

unidec.modules.ChromEng module

class unidec.modules.ChromEng.ChromEngine

Bases: MetaUniDec

UniChrom Engine.

add_chrom_peaks()
add_list_times(starts, ends)
add_manual_selection()
add_regular_times()
add_sliding_window()
get_chrom_peaks(window=None)
get_data_from_scans(scan_range=None)
get_data_from_times(minval, maxval)
get_minmax_times()
get_times()
load_mzml(path, load_hdf5=True, refresh=False, *args, **kwargs)
open_chrom(path, load_hdf5=True, refresh=False)
open_hdf5_file(path)
reset_vars(export=True)

unidec.modules.ColorPlot module

class unidec.modules.ColorPlot.ColorPlot2D(*args, **kwargs)

Bases: PlottingWindowBase

Method to perform a 3D plot by plotting the Z axis as 2D slices of a different color. Each 2D slice uses the alpha (trasparency) parameter to indicate intensity in square root scale.

make_color_plot(mzgrid, mzax, dtax, ztab)

Creates the color plot :param mzgrid: mz x dt x z numpy array of intensity values :param mzax: m/z axis :param dtax: drift time axis :param ztab: charge axis :return: None

make_compare_color_plot(data1, data2, test_kda=True, xlab='', ylab='')

unidec.modules.DoubleDec module

class unidec.modules.DoubleDec.DoubleDec(*args, **kwargs)

Bases: object

Extract(data, basemass=41983, m1=762, m2=63, m1range=None, m2range=None, exmethod=1, window=10)
PlotPeaks()
WeightedAvgs(cutoff=0)
dd_core(data, kernel)
dd_import(datapath, kernelpath)
dd_prep()
dd_run(data=None, kernel=None)
kimport(kernelpath)
plot2()
waplot()
unidec.modules.DoubleDec.batch_dd(files, kfile)
unidec.modules.DoubleDec.cconv2(a, b)
unidec.modules.DoubleDec.import_kernel_and_run(data, kfile)
unidec.modules.DoubleDec.make_kernel(data)

unidec.modules.Extract2D module

class unidec.modules.Extract2D.Extract2DPlot(parent, data_list, config=None, yvals=None, directory=None, header=None, params=None)

Bases: Frame

extractall()

Extract intensity values from self.datalist for mass values in self.massgrid. :return: None

getfromgui()

Extract parameters from GUI to self.params :return:

makebarchart()
makedataplot()
makegrid()

Make grid of mass values for potential combinations of m1 and m2 + m0. :return: None

makeplot()

Make the 2D and 1D plots for element self.pos in data_list. :return: None

makeplottotal()

Make the 2D and 1D plots for the sum of all arrays in data_list. Write outputs to _grid_2D_extract.txt and _total_2D_extract.txt. :return:

makeplotwap()

Calculates the weighted average of position (WAP) for each element in the intensity grid. Writes 1D output to _WAP_2D_Extract.txt. :return: None

on_all_next(e=None)
on_back(e=None)

PLot the extraction from the previous array in data_list. :param e: Unused event :return:

on_close(e=None)

Close the window. Return self.config.discreteplot to its original value. :param e: :return:

on_fit(e)
on_fit2(e)
on_fit3(e)
on_fit4(e)
on_next(e=None)

Plot the extraction from the next array in data_list. :param e: Unused event :return: None

on_save_fig(e)

Save figures as a PNG in self.directory. :param e: Unused event :return: None

on_save_figPDF(e)

Save figures as a PDF in self.directory. :param e: Unused event :return: None

on_total(e=None)

Extract all and plot total. :param e: Unused event :return: None

on_wap(e)

Extract all and plot weighted average of position. :param e: Unused event :return: None

run_multip(string)
unidec.modules.Extract2D.get_kd(mutant, wt, n=0, l=1, temp=25, units='kJ')

unidec.modules.GridDecon module

class unidec.modules.GridDecon.GridDeconWindow(parent, data, config=None, directory=None)

Bases: Frame

deconvolve(e)
extract(e)
getfromgui()

Extract parameters from GUI to self.params :return:

makegrids()

Make grid of mass values for potential combinations of m1 and m2 + m0. :return: None

makeplot(title='Extracted Data')

Make the 2D and 1D plots for element self.pos in data_list. :return: None

on_close(e=None)

Close the window. Return self.config.discreteplot to its original value. :param e: :return:

on_save_fig(e)

Save figures as a PNG in self.directory. :param e: Unused event :return: None

on_save_figPDF(e)

Save figures as a PDF in self.directory. :param e: Unused event :return: None

unidec.modules.GridDecon.blur(b, msig, zsig)
unidec.modules.GridDecon.conv(b, pmat)
unidec.modules.GridDecon.grid_unidec(mzgrid, igrid, numit=1000, fwhm=5, mode=0, msig=0, zsig=1)
unidec.modules.GridDecon.make_pmat(mzgrid, fwhm)

unidec.modules.GridDecon2 module

class unidec.modules.GridDecon2.GridDeconWindow(parent, data, config=None, directory=None)

Bases: Frame

deconvolve(e)
extract(e)
getfromgui()

Extract parameters from GUI to self.params :return:

makegrids()

Make grid of mass values for potential combinations of m1 and m2 + m0. :return: None

makeplot(title='Extracted Data')

Make the 2D and 1D plots for element self.pos in data_list. :return: None

on_close(e=None)

Close the window. Return self.config.discreteplot to its original value. :param e: :return:

on_save_fig(e)

Save figures as a PNG in self.directory. :param e: Unused event :return: None

on_save_figPDF(e)

Save figures as a PDF in self.directory. :param e: Unused event :return: None

unidec.modules.GridDecon2.blur(b, msig, zsig)
unidec.modules.GridDecon2.conv(b, pmat)
unidec.modules.GridDecon2.grid_unidec(mzgrid, igrid, numit=1000, fwhm=5, mode=0, msig=0, zsig=1)
unidec.modules.GridDecon2.make_pmat(mzgrid, fwhm)

unidec.modules.HTEng module

class unidec.modules.HTEng.HTEng(*args, **kwargs)

Bases: object

correct_cycle_time()

Correct the cycle time to be not a division of the total sequence length but a fixed number of scans :return: None

ftdecon(data, flatten=None, apodize=None, aFT=False, normalize=False, nzp=None, keepcomplex=False)

Perform Fourier Transform Deconvolution :param data: 1D data array of y-data only :param flatten: Whether to flatten the TIC before demultiplexing to remove low frequency components :param apodize: Whether to apodize the data with a Hanning window :param aFT: Whether to use Absorption FT mode :param normalize: Whether to normalize the output to the maximum value :param nzp: Zero padding factor :return: 1D array of demultiplexed data. Same length as input.

get_cycle_time(data=None, cycleindexguess=None, widthguess=110)

Get the cycle time from the data. This is the time between the first peak and the next peak. Uses an autocorrelation and then peak picking on the autocorrelation. May need to adjust the peak picking parameters to get it to work right. :param data: Input data :param cycleindexguess: Guess for the cycle index :param widthguess: Guess for peak width in number of scans :return: autocorrelation of the data

get_first_peak(data, threshold=0.5)

Get the index of the first peak in the data above a threshold. :param data: Data array 1D :param threshold: Threshold as ratio of highest peak :return: Index of first data point above threshold

htdecon(data, **kwargs)

Deconvolve the data using the HT kernel. Need to call setup_ht first. :param data: 1D array of data to be deconvolved. Should be same dimension as self.htkernel. :param kwargs: Keyword arguments. Currently supports “normalize” which normalizes the output to the maximum value. Also supports “gsmooth” which smooths the data with a Gaussian filter before deconvolution. Also supports “sgsmooth” which smooths the data with a Savitzky-Golay filter before deconvolution. :return: Demultiplexed data. Same length as input.

masked_demultiplex_ht(data, win=None, n=None, demult=None, mode='rand', **kwargs)
parse_file_name(path)

Parse the file name to extract relevant parameters for HT processing. :param path: File path :return: None

run_demultiplex(data, mode=None, **kwargs)

Overarching function to demultiplex data. Calls each demultiplexing type based on config parameter :param data: 1D array of data to be deconvolved. Should be same dimension as self.htkernel if HT mode. :param mode: Type of demultiplexing. Default is HT. :param kwargs: Additional keyword arguments. :return: Demultiplexed data. Same length as input.

set_timepad_index(timepad)

Find the index of the first scan above a timepad :param timepad: Time value :return: Index of first scan above timepad

setup_demultiplex(mode=None, **kwargs)

Overarching function to set up demultiplexing. Calls each demultiplexing type based on config parameter :param mode: Type of demultiplexing. Default is HT. :param kwargs: Additional keyword arguments. :return: None

setup_ft(FTstart=None, FTend=None, nzp=None)

Set up the Fourier Transform Deconvolution. Sets self.decontime with drift time axis. :param FTstart: Starting frequence (hz) :param FTend: Ending frequence (hz) :return: None

setup_ht(cycleindex=None, seq=None)

Sets up the HT kernel for deconvolution. This is a binary sequence that is convolved with the data to deconvolve the data. The sequence is defined by the htseq variable. The timepad and timeshift variables shift the sequence in time. The config.HTksmooth variable smooths the kernel to reduce ringing. :param cycleindex: The length of a cycle in number of scans. If not specified, default is the full number of scans divided by the number of cycles. :return: None

class unidec.modules.HTEng.UniChromHT(*args, **kwargs)

Bases: HTEng, ChromEngine

eic_ht(massrange)

Get the EIC and run HT on it. :param massrange: Mass range for EIC selection [low, high] :return: Demultiplexed data output

get_eic(massrange)

Get the EIC from the chromatogram. :param massrange: Mass range for EIC selection [low, high] :return:

open_file(path)

Open file and set up the time domain. :param path: File path :return: None

tic_ht(correct=False, **kwargs)

Get the TIC and run HT on it. :param correct: Whether to correct the data for the first peak :param kwargs: Deconvolution keyword arguments :return: Demultiplexed data output

class unidec.modules.HTEng.UniDecCDHT(*args, **kwargs)

Bases: HTEng, UniDecCD

ccs_transform_stacks()

Transform the histogram stacks from drift time to CCS. :return: None

clear_arrays(massonly=False)

Clear arrays to reset. :param massonly: Whether to only reset mass arrays. Default False. :return: None

convert_trace_to_ccs(trace, mzrange, zrange, sarray=None, normalize=False)

Convert a trace to CCS. :param trace: 1D array of intensity :param mzrange: m/z range :param zrange: charge range :param sarray: Swoop array, m/z mid, z mid, z spread (vertical), z width (horizontal), default None :param normalize: Whether to normalize the output to the maximum. :return: 2D array of CCS (time, intensity)

create_chrom(farray, **kwargs)

Create a chromatogram from the farray. :param farray: Data array of features :param kwargs: Keyword arguments. Currently supports “normalize” which normalizes the output to the maximum. :return: TIC/EIC in 2D array (time, intensity)

eic_ht(mzrange, zrange, sarray=None, **kwargs)

Get the EIC and run HT on it. :param mzrange: m/z range :param zrange: charge range :param sarray: Swoop array, m/z mid, z mid, z spread (vertical), z width (horizontal), default None :param kwargs: Keyword arguments. Passed down to create_chrom and htdecon. :return: Demultiplexed data output. 2D array (time, intensity)

extract_subdata(mzrange, zrange)

Extract a subdata object based on m/z and charge range. :param mzrange: m/z range, [low, high] :param zrange: z range, [low, high] :return: Data Object

extract_swoop_subdata(sarray)

Extract a subdata object based on the Swoop selection. :param sarray: Swoop array, m/z mid, z mid, z spread (vertical), z width (horizontal) :return: Data Object

get_ccs_eic(massrange=None, zrange=None, mzrange=None, normalize=False)

Get the EIC for a mass range after transforming the data to CCS. :param massrange: Mass range :param zrange: Charge range. Default None sets to full range. :param mzrange: m/z range. Default None sets to full range. :param normalize: Whether to normalize the output to the maximum. :return: 2D array of EIC (time, intensity)

get_eic(mzrange, zrange, **kwargs)

Get the EIC from the farray. :param mzrange: m/z range :param zrange: charge range :param kwargs: Keywords to be passed down to create_chrom :return: 2D array of EIC (time, intensity)

get_mass_eic(massrange, zrange=None, ht=False)

Get the EIC for a mass range after transforming the data to mass. Can be either HT or not. :param massrange: Mass range :param zrange: Charge range. Default None sets to full range. :param ht: Boolean whether to use HT or not :return: 2D array of EIC (time, intensity)

get_swoop_eic(sarray, **kwargs)

Extract an EIC based on the Swoop selection. :param sarray: Swoop array, m/z mid, z mid, z spread (vertical), z width (horizontal) :param kwargs: Keywords to be passed down to create_chrom :return: Data Object

get_tic(farray=None, **kwargs)

Get the TIC from the farray. :param farray: Optional input feature array :param kwargs: Keywords to be passed down to create_chrom :return: 2D array of TIC (time, intensity)

histogramLC(x=None, y=None, w=None)

Histogram function used for LC-CD-MS data. :param x: x-axis (m/z) :param y: y-axis (charge) :return: Histogram array

open_file(path, refresh=False)

Open CDMS file and set up the time domain. :param path: Path to file :param refresh: Whether to refresh the data. Default False. :return: None

prep_hist(mzbins=1, zbins=1, mzrange=None, zrange=None)

Prepare the histogram for process_data_scans CDMS data. :param mzbins: Bin size for m/z :param zbins: Bin size for charge :param mzrange: m/z range :param zrange: charge range :return: None

prep_time_domain()

Prepare the time domain for CDMS data. Creates scans, fullscans, fulltime arrays. Need to set self.config.HTanalysistime before calling this function. :return: None

process_data_scans(transform=True)

Main function for processing CDMS data, includes filtering, converting intensity to charge, histogramming, processing the histograms, and transforming (if specified). Transforming is sometimes unnecessary, which is why it can be turned off for speed.

Parameters:

transform – Sets whether to transform the data from m/z to mass. Default True.

Returns:

None

run_all_ht()

Run HT on all data in full 3D array. Will call process_data_scans if necessary. :return: TIC based on demultiplexed data. 2D array (time, intensity)

select_ht_range(range=None)

Select a range of time from HT stack and processes it as a histogram array :param range: Time range :return: 2D histogram array

select_raw_range(range=None)

Select a range of time from raw data and processes it as a histogram array :param range: Time range :return: 2D histogram array

tic_ht(**kwargs)

Get the TIC and run HT on it. :param kwargs: Keyword arguments. Passed down to create_chrom and htdecon. :return: Demultiplexed data output. 2D array (time, intensity)

transform_array(array, dtype=<class 'float'>)

Transforms a histogram stack from m/z to mass :param array: Histogram stack. Shape is time vs. charge vs. m/z. :return: Transformed array

transform_dt_ccs_array(array, keepcomplex=True)

Transforms a histogram stack from drift time to CCS :param array: Histogram Mass stack. Shape is time vs. mass vs. charge. :return: Transformed array

transform_stacks()

Transform the histogram stacks from m/z to mass. Calls transform_array function on each stack. :return: None

unidec.modules.IM_functions module

unidec.modules.IM_functions.calc_linear_ccs(mass, z, dt, config)
unidec.modules.IM_functions.calc_linear_ccsconst(config)
unidec.modules.IM_functions.calc_linear_dt(mass, z, ccs, config)

Calculate drift time in a linear cell

Parameters:
  • mass – Mass in Da

  • z – Charge

  • ccs – CCS in Angstrom^2

  • config – UniDecConfig object (carries the key parameters of temp, pressure, etc)

Returns:

Drift time (ms)

unidec.modules.IM_functions.calc_native_ccs(mass, gasmass)

Predict native CCS value for a particular mass in a given mass :param mass: Mass of protein in Da :param gasmass: Mass of IM background gas in Da :return: Predicted CCS in Angstroms^2

unidec.modules.IM_functions.calc_twave_dt_linear(mass, z, ccs, config)

Calculate drift time in a T-wave cell :param mass: Mass in Da :param z: Charge :param ccs: CCS in Angstrom^2 :param config: UniDecConfig object (carries the key parameters of calibration) :return: Drift time (ms)

unidec.modules.IM_functions.calc_twave_dt_log(mass, z, ccs, config)

Calculate drift time in a T-wave cell :param mass: Mass in Da :param z: Charge :param ccs: CCS in Angstrom^2 :param config: UniDecConfig object (carries the key parameters of calibration) :return: Drift time (ms)

unidec.modules.IM_functions.calc_twave_dt_power(mass, z, ccs, config)

Calculate drift time in a T-wave cell :param mass: Mass in Da :param z: Charge :param ccs: CCS in Angstrom^2 :param config: UniDecConfig object (carries the key parameters of calibration) :return: Drift time (ms)

unidec.modules.IM_functions.compress_2d(xgrid, ygrid, zgrid, num)

Compresses a 2D grid in to smaller grids by merging n data points in the x dimension together as their average. :param xgrid: 2D numpy array :param ygrid: 2D numpy array :param zgrid: 2D numpy array :param num: number of consecutive data points in the x-dimension to average together :return: x, y, and z grids compressed along the x dimension to a new size

unidec.modules.IM_functions.detectoreff_2d(igrid, xgrid, va)

Corrects for Q-TOF detector efficiency :param igrid: Intensity 2D numpy array :param xgrid: 2D numpy array of m/z values :param va: TOF acceleration voltage :return: igrid corrected for detector efficiency

unidec.modules.IM_functions.intensitythresh(igrid, thresh)

Intensity threshold for 2D grid :param igrid: 2D numpy array :param thresh: Threshold :return: igrid with all elements below thresh set to 0

unidec.modules.IM_functions.linearize_2d(xvals, yvals, igrid, binsize)

Linearize the x-axis of a 2D grid :param xvals: 2D numpy array (x values) :param yvals: 2D numpy array (y values) :param igrid: 2D numpy array (intensity values) :param binsize: difference between consecutive linear x points :return: x, y, and z grid linearized along the x-axis

unidec.modules.IM_functions.min_array(igrid, xwidth, ywidth)

Creates an array of local minimum values in a neighborhood of +/- width :param igrid: 2D numpy array :param xwidth: width in x direction :param ywidth: width in y direction :return: array of local minimum values in the same dimensions as igrid

unidec.modules.IM_functions.process_data_2d(xgrid, ygrid, igrid, config)

Process IM-MS raw data. 1. Chop data to defined limits 2. Linearize 3. Smooth 4. Subtract background 5. Detector efficiency correction 6. Normalize :param xgrid: 2D numpy array (x values) :param ygrid: 2D numpy array (y values) :param igrid: 2D numpy array (intensity values values) :param config: UniDecConfig object carrying parameters for processing :return: x, y, and z grids of processed data

unidec.modules.IM_functions.smooth_2d(igrid, smooth, smoothdt)

Gaussian smooth of 2D grid :param igrid: 2D numpy array :param smooth: width in x dimension (in data points) :param smoothdt: width in y dimension (in data points) :return: smoothed 2D numpy array

unidec.modules.IM_functions.subtract_complex_2d(igrid, config)

Subtract a complex curved baseline. Creates a baseline using min_array, smooths it using smooth_2d, and subtracts it. :param igrid: 2D numpy array :param config: UniDecConfig object specifying width parameters in x and y dimensions :return: igrid with background subtraction applied

unidec.modules.IM_windows module

class unidec.modules.IM_windows.IMListCtrl(parent, id_val, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(val=0)

Add a new line to the list. :param val: Value for the first column. Default is 0. Default for second column is 0. :return: None

clear_list()

Clear list. :return: None

get_list()

Return the list of values in the listctrl. :return: Nested list of listctrl output

on_delete(event)

Delete the selected item. :param event: Unused event. :return: None

on_right_click(event)

Create a right click menu. :param event: Unused event :return: None

populate(data, colors=None)

Add data from array or nested list to the listctrl. :param data: List or array of data values. :param colors: Background colors list :return: None

class unidec.modules.IM_windows.IMListCtrlPanel(parent, size=(200, 200))

Bases: Panel

class unidec.modules.IM_windows.IMToolExtract(*args, **kwargs)

Bases: Dialog

get_from_gui(e)

Load from GUI to self.zout. If nothing is set, self.zout = 0. :param e: Unused event :return: None

initialize_interface(massdat, ccsdat, mccsgrid, config, pks)

Initilizes the interface and plots the intial results. :param massdat: Mass distribution array (N x 2) :param ccsdat: CCS distribution array (M x 2) :param mccsgrid: Array of intensity values for corresponding mass and CCS values (N x M) array :param config: UniDecConfig object :param pks: Peaks object :return: None

loadpeaks(e)

Load masses from self.pks.peaks into the masspanel. :param e: Unused event :return: None

on_add(e)

Add a blank line to the masspanel. :param e: Unused event :return: None

on_close(e)

Close the dialog and set self.config.zout to self.zout. :param e: Unused event :return: None

on_close_cancel(e)

Close the dialog but do not update self.config.zout. :param e: Unused event :return: None

on_plot(e)

First, it updates from the GUI. Second, if _zout_str(self.zout).bin file exists, it will be imported. This allows slices of specific charge states to be extracted. Otherwise, the default is all charge states. Third, the values are extracted and plotted. :param e: Unused event :return: None

class unidec.modules.IM_windows.IMTools(*args, **kwargs)

Bases: Dialog

get_from_gui(e)

Load from GUI to self.config :param e: Unused event :return: None

initialize_interface(data3, config)

Initialize the parameters, setup the panels, and display the interface. :param data3: IM-MS raw or processed data :param config: UniDecConfig object :return: None

load_to_gui(e)

Load from self.config into the GUI control boxes. :param e: Unused event :return: None

on_add(e)

Add lines to the masspanel. :param e: Unused event :return: None

on_close(e)

Close the window and set self.defaultconfig to the new self.config. :param e: Unused event :return: None

on_close_cancel(e)

Close the window but do not update self.defaultconfig. :param e: Unused event :return: None

on_flip_twave(e)

Flip configuration from linear to t-wave. Changes the gas from Ni to He or visa versa. Remakes the GUI. :param e: Unused event :return: None

on_plot(e)

Gathers all of the parameters and simulates the m/z and dt values. Plots the results. :param e: wx.Event :return: None

setup_panel()

Make/remake the main panel. :return: None

unidec.modules.ManualSelectionWindow module

class unidec.modules.ManualSelectionWindow.ManualListCrtl(parent, id_value, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0, imflag=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(line=None)

Insert a new line into the listctrl. :param line: Optional list of values for the new line. Default is [0,0,0,0] :return: None

clear()

Clear the list. :return: None

get_list()

Return a nested list of the values in the listctrl. :return: Nested list of the outputs.

populate(data, colors=None)

Add data from an array to the listctrl. :param data: Data array to be added :param colors: Optional list of background colors. :return: None

class unidec.modules.ManualSelectionWindow.ManualListCtrlPanel(parent, imflag=0)

Bases: Panel

on_popup_one(e=None)

Delete the selected items. :param e: Unused event :return: None

on_right_click(e=None)

Open right click menu. :param e: Unused event :return: None

class unidec.modules.ManualSelectionWindow.ManualSelection(*args, **kwargs)

Bases: Dialog

initiate_dialog(config, data)

Initiate the dialog window, lay everything out, and plot the intial results :param config: UniDecConfig object :param data: Data to plot (either MS or IM-MS) :return: None

on_add(e)

Add a new blank line to the listctrl. :param e: Unused event :return: None

on_add_from_plot(e)

Grab the limits of the plot and make that the limits of the manual assignment. :param e: Unused event :return: None

on_clear(e)

Clear the listctrl. :param e: Unused event :return: None

on_close(e)

Get manuallist from listctrl, clean up, write it to self.config.manuallist, and then destroy the window. :param e: Unused event :return: None

on_close_cancel(e)

Destroy the dialog without updating the manual assignment list in UniDecConfig. :param e: Unused event :return: None

on_import(e)

Open a file dialog and import a N x 3 (MS) or N x 5 (IMMS) array of manual assignment. Add the array to the listctrl. :param e: Unused event :return: None

on_plot(e)

Attempts to correct and plot the manual assignments. :param e: Unused event :return: None

class unidec.modules.ManualSelectionWindow.SmashListCrtl(parent, id_value, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0, imflag=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(line=None)

Insert a new line into the listctrl. :param line: Optional list of values for the new line. Default is [0,0,0,0] :return: None

clear()

Clear the list. :return: None

get_list()

Return a nested list of the values in the listctrl. :return: Nested list of the outputs.

populate(data, colors=None)

Add data from an array to the listctrl. :param data: Data array to be added :param colors: Optional list of background colors. :return: None

class unidec.modules.ManualSelectionWindow.SmashListCtrlPanel(parent, imflag=0)

Bases: Panel

on_popup_one(e=None)

Delete the selected items. :param e: Unused event :return: None

on_right_click(e=None)

Open right click menu. :param e: Unused event :return: None

class unidec.modules.ManualSelectionWindow.SmashSelection(*args, **kwargs)

Bases: Dialog

initiate_dialog(config, data)

Initiate the dialog window, lay everything out, and plot the intial results :param config: UniDecConfig object :param data: Data to plot (either MS or IM-MS) :return: None

on_add(e)

Add a new blank line to the listctrl. :param e: Unused event :return: None

on_add_from_plot(e)

Grab the limits of the plot and make that the limits of the manual assignment. :param e: Unused event :return: None

on_clear(e)

Clear the listctrl. :param e: Unused event :return: None

on_close(e)

Get smashlist from listctrl, clean up, write it to self.config.smashlist, and then destroy the window. :param e: Unused event :return: None

on_close_cancel(e)

Destroy the dialog without updating the manual assignment list in UniDecConfig. :param e: Unused event :return: None

on_import(e)

Open a file dialog and import a N x 3 (MS) or N x 5 (IMMS) array of manual assignment. Add the array to the listctrl. :param e: Unused event :return: None

on_plot(e)

Attempts to correct and plot the smash assignments. :param e: Unused event :return: None

unidec.modules.ManualSelectionWindow.checkoverlap(l1, l2)

Check whether two lines of manual assignments are overlapping. :param l1: Line 1 (1 x 5) :param l2: Line 2 (1 x 5) :return: True if overlapping, False if not.

unidec.modules.ManualSelectionWindow.closest(x, y, manlist)

For manlist of manual assignments and an (x,y) point, finds the nearest manual assignment. Used in correcting overlapping rectanges. :param x: Float :param y: Float :param manlist: Array of manual assignment for IMMS (N x 5) :return: out, pos

out is the line in manlist that is closest. pos is the position of the line in manlist.

unidec.modules.ManualSelectionWindow.correctassignments(manlist, xdat, ydat)

Correct the manual assignments so that they are not overlapping in IM-MS. :param manlist: List of manual assignments in (N x 5) array. :param xdat: x-axis (m/z) :param ydat: y-axis (arrival time) :return: manlist3, a new array of values corrected to eliminate overlap.

unidec.modules.ManualSelectionWindow.detectoverlap(manlist)

For a list of IM-MS manual assignments, check if any of the rectangles are overlapping. :param manlist: Array of manual assignments (N x 5) :return: True if overlapping, False if not.

unidec.modules.ManualSelectionWindow.range_overlap(a_min, a_max, b_min, b_max)

Checks whether two specific ranges of [a_min,a_max] and [b_min,b_max] overlap. :param a_min: :param a_max: :param b_min: :param b_max: :return: True if overlapping, False if not.

unidec.modules.MassDefectExtractor module

class unidec.modules.MassDefectExtractor.MassDefectExtractorWindow(parent, datalist, xarray, yarray, config=None, xtype=0)

Bases: Frame

fill_grid()
make_2d_plot()
make_ext_plots()
make_list_plots()
on_add_line(e)

Add a horizontal line to the plot to visualize a predicted mass defect. Opens a dialog to input the value. Can be called more than once to add multiple lines. :param e: Unused event :return: None

on_add_mass(e)

Adds a blank line to the mass list. :param e: Unused Event :return: None

on_clear_masslist(e)

Clears the mass list. :param e: Unused event :return: None

on_close(e)

Close the window. :param e: Unused event :return: None

on_extract(e=None)
on_fit(e=None)
on_import_masses(e)

Opens a dialog to import mass list files. :param e: Unused event :return: None

on_oligomer_tools(e)
on_save_fig(e)

Saves the figures in self.directory as PNGs. :param e: Unused event :return: None

on_save_fig_pdf(e)

Saves the figures in self.directory as PDFs. :param e: Unused event :return: None

on_total(e=None)
post_extract()
update()

unidec.modules.MassDefects module

class unidec.modules.MassDefects.MassDefectWindow(parent, data_list, config=None, yvals=None, pks=None, value=None, directory=None)

Bases: Frame

getfromgui()

Update parameters from GUI. :return: None

make_list_plots()
makeplot()

Runs the kendrick analysis on a single of the mass distributions in self.datalist set by self.pos. Plots the results in 1D and 2D. :return: None

makeplottotal(e=None)

Runs the kendrick analysis on all of the mass distributions in self.datalist. Assumes they are all the same dimensions, which is why we run mergedata when it is loaded. Sums the results and plots the sums in 1D and 2D. :param e: Unused event :return: None

on_add_line(e)

Add a horizontal line to the plot to visualize a predicted mass defect. Opens a dialog to input the value. Can be called more than once to add multiple lines. :param e: Unused event :return: None

on_add_multilines(e)

Add a horizontal line to the plot to visualize a predicted mass defect. Opens a dialog to input the value. Can be called more than once to add multiple lines. :param e: Unused event :return: None

on_back(e)

Plot the mass defect of the previous thing in the mass defect list. :param e: Unused event :return: None

on_close(e)

Close the window. Will try to set self.config.molig as self.m0. :param e: Unused event :return: None

on_com(e=None)
on_compare_window(e=None)
on_extract_window(e=None)
on_fit(e)
on_label_peaks(e=None)
on_linear_regression(e=None)
on_next(e)

Plot the mass defect of the next thing in the mass defect list. :param e: Unused event :return: None

on_peaks(e)

For each peak in self.pks, get the mass defects and plot them. :param e: Unused event :return: None

on_save_fig(e)

Saves the figures in self.directory as PNGs. :param e: Unused event :return: None

on_save_fig_pdf(e)

Saves the figures in self.directory as PDFs. :param e: Unused event :return: None

unidec.modules.MassFitter module

class unidec.modules.MassFitter.MassFitter(massdat, guessarray, psfun, *args)

Bases: object

Class for fitting zero-charge mass spectrum to overlapping peaks.

perform_fit(*args)

Run least squares fitting :param args: Arguments passed to fitting :return: fitdat, fit (fit to data and fit parameters in a P x 3 array of (mid, fwhm, area))

unidec.modules.MassFitter.error_function(array, massdat, psfun, startarray, *args)

Error function for least_squares_minimize :param array: Array of test parameters :param massdat: Mass data to be fit :param psfun: Peak shape function integer code :param startarray: Starting array (not currently used but can be used to restrict some guesses) :param args: Extra arguments for make_mass_list :return: Squared errors array

unidec.modules.MassFitter.least_squares_minimize(massdat, array, psfun, *args)

Perform least squares minimization of peaks defined in array to massdat. :param massdat: Data to fit :param array: Array of parameters for defining peaks that will be fit :param psfun: Peak shape function integer code :param args: Extra arguments for make_mass_list :return: Best fit of values in array

unidec.modules.MassFitter.make_mass_list(massdat, arrayin, psfun, startarray, *args)

For parameters in arrayin, make mass peaks to be fit to massdat. Arrayin must be P x 3 array of (mid, fwhm, area). :param massdat: Data to be fit :param arrayin: Parameters defining peaks :param psfun: Peak shape function integer code :param startarray: Starting array (not currently used but can be used to restrict some guesses) :param args: Extra arguments (such as nonorm to prevent normalization) :return:

unidec.modules.MassSpecBuilder module

unidec.modules.MassSpecBuilder.get_mzrange(params, padding=1000, **kwargs)

From paramaters defining mass spectrum, pick a reasonable m/z range. :param params: P x 5 array of parameters [mass, mass fwhm, z avg, z std dev, intensity] :return: m/z range [min m/z , max m/z]

unidec.modules.MassSpecBuilder.get_zrange(params)

From paramaters defining mass spectrum, pick a reasonable charge state range. :param params: P x 5 array of parameters [mass, mass fwhm, z avg, z std dev, intensity] :return: charge state range [min z , max z]

unidec.modules.MassSpecBuilder.isotopic_spectrum(masslist, chargelist=None, intlist=None, x=None, resolution=100000, **kwargs)
unidec.modules.MassSpecBuilder.make_mass_spectrum(array, zrange=(10, 50), mzrange=(2000, 10000), mz_bin_size=1, adductmass=1.00727647, psfun=0, noise=0, baseline=0, **kwargs)

Create a new mass spectrum.

First, create the mzaxis from mzrange and the possible charge states from zrange. Then, add in peaks at the appropriate mz values for the parameters defined in array. Then, normalize and add optional background and noise. Finally, renormalize.

Parameters:
  • array – P x 5 array of parameters [mass, mass fwhm, z avg, z std dev, intensity]

  • zrange – Tuple of list define range of allowed charge states

  • mzrange – Tuple or list defining range of m/z values

  • mz_bin_size – delta mz of mzaxis

  • adductmass – Mass of electrospray adduct species

  • psfun – Peak shape function integer code

  • noise – Std deviation of random Gaussian noise to be added to normalized spectrum

  • baseline – Peak intensity of sinusoidal baseline to be added to normalized spectrum

  • kwargs – Keyword catcher

Returns:

Spectrum, ztab (new spectrum in N x 2 (m/z, intensity) and charge states allowed)

unidec.modules.MassSpecBuilder.simple_params(masslist, intlist=None, resolution=1000, zwidth=2, rlist=None, **kwargs)

Set simple parameters [mass, mass fwhm, z avg, z std dev, intensity] for a mass list and optional arguments. Average charge is defined as the native charge state. Other parameters are defaults.

Parameters:
  • masslist – list of masses in Da

  • intlist – list of intensities (default is None which gives all as 1)

  • resolution – Mass resolution (delta m/m), Overridden if rlist is not None

  • zwidth – Standard deviation of charge state distribution

  • rlist – List of resolution values for each corresponding mass.

If None, will use a single resolution for all defined by resolution. :param kwargs: Extra keywords :return: P x 5 array of parameters [mass, mass fwhm, z avg, z std dev, intensity]

unidec.modules.MassSpecBuilder.simple_spectrum(masslist, **kwargs)

For a mass list, create the parameters and ranges for a simple default spectrum. :param masslist: Mass values :param kwargs: Keywords of parameters to pass to simple_params and make_mass_spectrum :return: N x 2 spectrum (m/z, intensity)

unidec.modules.MassSpecBuilder.simple_spectrum2(masslist, **kwargs)

For a mass list, create the parameters and ranges for a simple default spectrum. :param masslist: Mass values :param kwargs: Keywords of parameters to pass to simple_params and make_mass_spectrum :return: N x 2 spectrum (m/z, intensity)

unidec.modules.NanodiscBuilder module

unidec.modules.NanodiscBuilder.make_mixed_nanodiscs(array, plot=True)
unidec.modules.NanodiscBuilder.make_nanodiscs(array)
Parameters:

array – Array of different nanodiscs of form: N x 6 [belt mass, lipid mass, lipid num, lipid std dev, mass sig, z, zstd dev]

Returns:

unidec.modules.PlotAnimations module

class unidec.modules.PlotAnimations.AnimationWindow(parent, data_list, config=None, yvals=None, mode='1D', pks=None, pksmode='mz', *args, **kwargs)

Bases: Frame

add_peaks(e=None)
add_peaks_mass(e=None)
add_peaks_mz(e=None)
init()

Create a fresh plot and start the animation. :return: None

on_back(e)

Plot the previous data set in data_list. :param e: Unused event :return: None

on_close(e)

Stop the animation and close the window. :param e: Unused event :return: None

on_next(e)

Plot the next data set in data_list. :param e: Unused event :return: None

on_play(e)

Toggles self.play on or off. Will break the while loop in self.update if self.play = False. :param e: Unused event :return: None

on_save_fig(e=None)
refresh_plot()

Create a fresh plot from the top. :return: None

save_fig(base, ext)
update(frame_number)

Continues to increment the plot to the next value in the data_list. Will stop if self.play is False. :param frame_number: Required but unused. Filled by FuncAnimation. :return: 0

update_framerate(e)

Change the frame rate. Restart the animation with fresh frame rate. :param e: Unused event :return: None

update_plot()

Increment to the next data set and update the plot with the new data. Tries to keep some of the old plotting parameters like the zoom the same. Stops the animation if an error occurs. :return: None

unidec.modules.PlotBase module

class unidec.modules.PlotBase.PlotBase(*args, **kwargs)

Bases: object

Class for matplotlib plots

add_legend(location=1, anchor=None)

Adds a legend to the plot. :param location: Integer code for location :param anchor: BBox to anchor parameter :return: None

add_rect(xstart, ystart, xwidth, ywidth, alpha=0.5, facecolor='k', edgecolor='k', nopaint=False)
add_title(title='')
addtext(txt, x, y, vlines=True, hlines=False, color='k', ymin=0, ymax=None, verticalalignment='top', xmin=0, xmax=None, nopaint=False, **kwargs)

Adds text and lines. Puts things that have been added in self.lines and self.text lists. :param txt: String of text to add :param x: x position for where to add :param y: y position for where to add :param vlines: Whether to add vertical lines to the text as well. :param hlines: Whether to add horizontal lines to the text as well. :param color: Color of text and lines :param ymin: Minimum value of vlines :param ymax: Maximum value of vlines :param verticalalignment: Vertical alignment of the text :param xmin: Minimum value of hlines :param xmax: Maximum value of hlines :param nopaint: Don’t paint it :param kwargs: Keywords If range=(a,b) is specified, adds a line from a to b and vertical lines at a and b. :return: None

clear_plot(*args)

Clear the plot and rest some of the parameters. :param args: Arguments :return:

draw_mz_curve(sarray, color='y', alpha=0.4, adduct_mass=1, repaint=False)
get_blank_axis(scale=None)
get_limits()
get_linewidth()
get_png()

Returns PNG string of figure. :return: PNG string

get_svg()

Returns SVG string of figure. :return: SVG string

get_zoomvals()
kda_test(xvals)

Test whether the axis should be normalized to convert mass units from Da to kDa. Will use kDa if: xvals[int(len(xvals) / 2)] > 100000 or xvals[len(xvals) - 1] > 1000000

If kDa is used, self.kda=True and self.kdnorm=1000. Otherwise, self.kda=False and self.kdnorm=1. :param xvals: mass axis :return: None

on_save_fig(evt, path, **kwargs)

Save figure to path. :param evt: wx.Event (unused) :param path: Path to save figure to :param kwargs: keywords passed to save_figure :return: None

plotadddot(x, y, colval, markval, label='', linewidth=None)

Adds a scatter plot to the figure. May be one or more. :param x: x values :param y: y values :param colval: Color :param markval: Marker :param label: Label for Plot :param linewidth: Line width :return: None

repaint(setupzoom=False, resetzoom=False)
reset_zoom()
save_figure(path, **kwargs)

Saves Figure to path. :param path: Path to save figure at. :param kwargs: Keywords passed to matplotlib.figure.savefig (note only specific ones are passed) :return: None

set_aspect(aspect=None)
set_color(rgbtuple=None)

Sets background color :param rgbtuple: background color :return:

set_nticks(bins)

Set the number of ticks in the x-axis. :param bins: Number of ticks in the x-axis :return: None

set_tickcolor()

Sets tick colors based on the colormap set at self.cmap :return: None

set_zoomvals(zoomvals=None)
setup_zoom(plots=None, zoom=None, data_lims=None, pad=0, groups=None)
textremove()

Remove text and lines previous placed in the self.text and self.lines containers :return: None

update_style(stylefile=None)
write_data(path)
zoomout()

unidec.modules.PlottingWindow module

class unidec.modules.PlottingWindow.MZLimitsEvent(evttype, id, minval=None, maxval=None)

Bases: PyCommandEvent

class unidec.modules.PlottingWindow.NetworkFrame(*args, **kwargs)

Bases: PlottingWindowBase

clear_frame()
class unidec.modules.PlottingWindow.Plot1d(*args, **kwargs)

Bases: PlottingWindowBase, Plot1dBase

Class for 1D plots.

class unidec.modules.PlottingWindow.Plot2d(*args, **kwargs)

Bases: PlottingWindowBase, Plot2dBase

Plotting class for 2D contour plots

class unidec.modules.PlottingWindow.PlotAny(*args, **kwargs)

Bases: PlottingWindowBase, Plot1dBase, Plot2dBase

Plotting class for 2D contour plots

class unidec.modules.PlottingWindow.PlottingWindowBase(*args, **kwargs)

Bases: PlotBase, Panel

Class for wx window with embedded matplotlib plots Inherits from PlotBase, which is the core functions stripped of everything interactive

copy_to_clipboard(*args, **kwargs)
mouse_activate(event)
mouse_inactivate(event)
on_draw(event)
on_idle(event)

Function triggered on idle event from plot. :param event: wx.Event :return: None

on_key(evt)
on_left_click(x, y)
on_newxy(x, y)
on_release(event)

Function triggered on button release event from plot. Currently wired to trigger on_save_figure_dialog on middle button. :param event: wx.Event :return: None

on_right_click(event=None)
on_save_fig(evt, path, **kwargs)

Save figure to path. :param evt: wx.Event (unused) :param path: Path to save figure to :param kwargs: keywords passed to save_figure :return: None

on_save_fig_dialog(evt)

Open a save figure dialog for specified plot. :param evt: wx.Event (unused) :return: None

on_scans_selected(smin, smax)
on_size(event)

Resizes the plots :param event: wx.Event :return: None

on_swoop_drag(sarray)
on_write_dialog(evt)

Open a save figure dialog for specified plot. :param evt: wx.Event (unused) :return: None

repaint(setupzoom=True, resetzoom=False)

Redraw and refresh the plot. :param setupzoom: Boolean, whether to setup zooming :param resetzoom: Boolean, whether to reset zooming :return: None

set_resize(newsize)
setup_zoom(plots, zoom, data_lims=None, pad=0, groups=None)

Set up zoom on axes. :param pad: Padding around plot :param plots: Axes objects to setup :param zoom: Type of zoom (‘span’ or ‘box’) :param data_lims: Optional manual description of the data limits (where to go when fully zoomed out) :param groups: Group of axes to link zoom together for :return: None

size_handler(event=None, *args, **kwargs)

Resizes the plots :param args: :param kwargs: :return: None

zoomout()
class unidec.modules.PlottingWindow.ScanSelectedEvent(evttype, id, smin=None, smax=None)

Bases: PyCommandEvent

class unidec.modules.PlottingWindow.SwoopDragEvent(evttype, id, sarray=None)

Bases: PyCommandEvent

unidec.modules.SubDiv module

class unidec.modules.SubDiv.SubDivFrame(parent, data, pks, config=None)

Bases: Frame

change_type(e=None)
make_plot(data=None)
replot(e=None)
subdiv()

unidec.modules.UniFit module

unidec.modules.UniFit.BootMin(data, kdargs, weights)
unidec.modules.UniFit.BootMinWorker(queue, results_queue)
unidec.modules.UniFit.CompareModels(e1, e2, p1, p2, n, thresh)
unidec.modules.UniFit.Ftest(e1, e2, p1, p2, n)
unidec.modules.UniFit.GetDegenKD(kds, kdargs)
unidec.modules.UniFit.GetError(data, pfree, lfree, ureact, prottab, ligtab, paths, kds, weights, nodelist, nfactors)
unidec.modules.UniFit.GetFree(pO, ptot, ltot, ureact, prottab, ligtab, paths, kds, nfactors)
class unidec.modules.UniFit.KDmodel(data, pconc, lconc, nodelist=None, header=None, numtotprot=0, numtotlig=0, removeoutliers=False, plot1=None, plot2=None, plot3=None, bootnum=1, maxsites=0, maxligagg=1, hill=False, label='', cmap='rainbow', **kwargs)

Bases: object

Bootstrap(std, numpts)
FindBestModel(fixedprotmodel, fixedligmodel)
GraphPlot(ax=None)
MakeFitGrid()
ModPaths()
ModPathsAgg()
OutlierTest()
PlotHist(topax=None)
PlotTrace(topax=None)
Return()
RunBootstrap()
RunKDFit(**kwargs)
SetupModel(**kwargs)
SetupModelAgg(**kwargs)
unidec.modules.UniFit.MakeGrid(pfree, lfree, ureact, prottab, ligtab, paths, kds, nfactors)
unidec.modules.UniFit.MinFree(ptot, ltot, ureact, prottab, ligtab, paths, kds, pguess, lguess, nfactors)
unidec.modules.UniFit.MinFreeError(kds, data, weights, kdargs)
unidec.modules.UniFit.Minimize(data, kdargs, **kwargs)
unidec.modules.UniFit.draw_graph(graph1, graph2, kds, errors, kdmap, header, ax=None, ulabel='')
unidec.modules.UniFit.draw_graph_structure(graph1, graph2, kdmap, ax=None)
unidec.modules.UniFit.findend(reactions, end)
unidec.modules.UniFit.findpaths(reactions)
unidec.modules.UniFit.fixlists(list1, list2)
class unidec.modules.UniFit.kdstruct

Bases: object

unidec.modules.UniFit.make_graph_agg(reactions)
unidec.modules.UniFit.safedivide(a, b)
unidec.modules.UniFit.sortarray(a)

unidec.modules.UniList module

class unidec.modules.UniList.UDListCtrl(parent, id_val, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(val=0)

Add a new line to the list. :param val: Value for the first column. Default is 0. Default for second column is 0. :return: None

clear_list()

Clear list. :return: None

get_list()

Return the list of values in the listctrl. :return: Nested list of listctrl output

on_delete(event)

Delete the selected item. :param event: Unused event. :return: None

on_right_click(event)

Create a right click menu. :param event: Unused event :return: None

populate(data, colors=None)

Add data from array or nested list to the listctrl. :param data: List or array of data values. :param colors: Background colors list :return: None

class unidec.modules.UniList.UDListCtrlPanel(parent, size=(300, 800))

Bases: Panel

class unidec.modules.UniList.UniListApp(*args, **kwargs)

Bases: UniDecPres

add_file(path)

Adds path to the list and imports its engine. :param path: Path of data to add to the current list :return: None

get_engs(paths)

Creates a UniDecEngine object for each path and imports the data into that engine. :param paths: List of paths :return: None

init(*args, **kwargs)

Initialize Engine and View. :param args: :param kwargs: :return:

insetplot()
multiplot()
on_add(e=0)

Open a dialog to add a file. Triggers self.add_file() :param e: Event :return: None

on_replot(e=None)

Makes Mass Plots (plot 2) and m/z Plots (plot 4) :param e: Event (unused) :return: None

populate_list(listdat)

Add listdat items to the left hand list and get the engines for each. Populates the self.listdat and self.paths parameters. :param listdat: List of paths and associated data in N x M list. :return: None

single_eng(path)
update_gui(index)
class unidec.modules.UniList.UniListWindow(parent, title, config, iconfile=None, tabbed=None)

Bases: MainwindowBase

on_click(e)
on_motion(xpos, ypos)

Triggered by pubsub from plot windows. Reports text in Status Bar. :param xpos: x position fed from event :param ypos: y position fed from event :return: None

populate(listdat)

unidec.modules.biopolymertools module

unidec.modules.biopolymertools.calc_dna_mass(sequence, threeend='OH', fiveend='MP')
unidec.modules.biopolymertools.calc_pep_mass(sequence, allow_float=True, remove_nan=True, all_cyst_ox=False, pyroglu=False, round_to=2)
unidec.modules.biopolymertools.calc_rna_mass(sequence, threeend='OH', fiveend='MP')
unidec.modules.biopolymertools.get_aa_mass(letter)
unidec.modules.biopolymertools.get_dna_mass(letter)
unidec.modules.biopolymertools.get_rna_mass(letter)
unidec.modules.biopolymertools.read_fasta(path)

unidec.modules.data_reader module

class unidec.modules.data_reader.DataImporter(path, *args, **kwargs)

Bases: object

Imports mzML data files.

get_data(scan_range=None, time_range=None)

Returns merged 1D MS data from mzML import :return: merged data

get_max_scans()
get_max_time()
get_polarity(scan=0)
get_scans_from_times(time_range)
get_tic()
get_times_from_scans(scan_range)
grab_data()
unidec.modules.data_reader.register()

unidec.modules.fft_window module

class unidec.modules.fft_window.FFTWindow(parent, data, config=None, directory=None)

Bases: Frame

createcompareplot()
getfromgui()

Update parameters from GUI. :return: None

makeplot(e=None)

Runs the kendrick analysis on a single of the mass distributions in self.datalist set by self.pos. Plots the results in 1D and 2D. :return: None

on_add_line(e)

Add a horizontal line to the plot to visualize a predicted mass defect. Opens a dialog to input the value. Can be called more than once to add multiple lines. :param e: Unused event :return: None

on_close(e)

Close the window. Will try to set self.config.molig as self.m0. :param e: Unused event :return: None

on_compare_regions(e=None)
on_get_peaks(e=None, data=None)
on_save_fig(e)

Saves the figures in self.directory as PNGs. :param e: Unused event :return: None

on_save_fig_pdf(e)

Saves the figures in self.directory as PDFs. :param e: Unused event :return: None

unidec.modules.fitting module

unidec.modules.fitting.binomial(x, n, p, A)
unidec.modules.fitting.binomial_fit(xvals, yvals)
unidec.modules.fitting.complex_poisson(datatop, oarray=None, background=False)
unidec.modules.fitting.exp_decay(x, gamma=1, a=1, background=0)
unidec.modules.fitting.exp_fit(xvals, yvals, gguess=None, aguess=None, bguess=None)

Simple exponential fitting function.

unidec.modules.fitting.fit_peak(xvals, yvals, psfun, midguess, fwhmguess, aguess, bguess)

Fit peak from xvals and yvals data to defined peak shape function. :param xvals: x values of data :param yvals: y values of data :param psfun: peak shape function integer code :param midguess: midpoint guess :param fwhmguess: fwhm guess :param aguess: amplitude guess :param bguess: background guess :return: popt, perr, fitdat (optimized parameters [fwhm, mid, a, b], std error of parameters, fit to data)

unidec.modules.fitting.gaussfit(xvals, yvals, mguess=None, sguess=0.1, aguess=None, cleanup=True)

Simple gaussian fitting function. :param xvals: X values :param yvals: Y values :param mguess: Guess for midpoint :param sguess: Guess for standard deviation :param aguess: Guess for amplitude :param cleanup: Boolean Flag, if True, will clean up data to remove background and normalize :return: Gaussian fit parameters [mid, sig, amp]

unidec.modules.fitting.isolated_peak_fit(xvals, yvals, psfun, **kwargs)

Fit an isolated peak to the peak shape model. :param xvals: x values of data :param yvals: y values of data :param psfun: peak shape function integer code :param kwargs: keywords (unused) :return: fit_array, fit_data (4 x 2 array of (fit, error) for [fwhm,mid,amp,background],fit to data)

unidec.modules.fitting.ldis(x, mid, fwhm, a=1, norm_area=False)

Lorentzian function normalized to a max of 1. Note: x and mid are interchangable. At least one should be a single float. The other may be an array. :param x: x values :param mid: Mean :param fwhm: Full Width at Half Max :param a: Amplitude (default is 1) :param norm_area: Boolean, Whether to normalize so that the area under the distribution is 1. :return: Lorentzian distribution at x values

unidec.modules.fitting.ldis_fit(x, s, m, a, b)

Function for fitting Lorentzian distribution to peak. Adds a background to ldis. Prevents negative background, amplitude, and standard deviation. :param x: x value :param s: full width half max :param m: mean :param a: amplitude :param b: linear background :return: peak shape

unidec.modules.fitting.lin_fit(xvals, yvals)
unidec.modules.fitting.logistic(x, mid, slope, aspan, ymin)

Logistic function

unidec.modules.fitting.mperror(array, datatop, oarray, background)
unidec.modules.fitting.mpinit(datatop, oarray, background=False)
unidec.modules.fitting.multipoisson(array, datatop, oarray, background=False)
unidec.modules.fitting.ndis(x, mid, fwhm, **kwargs)

Gaussian function normalized to a max of 1.

Note: x and mid are interchangable. At least one should be a single float. The other may be an array. :param x: x values :param mid: Mean :param fwhm: Full Width at Half Max (2.35482 * standard deviation) :param kwargs: Allows norm_area flag to be passed :return: Gaussian distribution at x values

unidec.modules.fitting.ndis_fit(x, s, m, a, b)

Function for fitting normal distribution to peak. Adds a background to ndis. Prevents negative background, amplitude, and standard deviation. :param x: x value :param s: full width half max :param m: mean :param a: amplitude :param b: linear background :return: peak shape

unidec.modules.fitting.ndis_std(x, mid: float, sig: float, a: float = 1, norm_area: bool = False) array

Normal Gaussian function normalized to the max of 1. :param x: x values :param mid: Mean of Gaussian :param sig: Standard Deviation :param a: Maximum amplitude (default is 1) :param norm_area: Boolean, Whether to normalize so that the area under the distribution is 1. :return: Gaussian distribution at x values

unidec.modules.fitting.poisson(x, mu, A)
unidec.modules.fitting.poisson_fit(xvals, yvals)
unidec.modules.fitting.poisson_mono_di(datatop)
unidec.modules.fitting.poly_fit(datatop, degree=1, weights=None)
unidec.modules.fitting.psfit(x, s, m, a=1, b=0, psfun=0)

Make peak shape from fit :param x: x values :param s: fwhm :param m: max position :param a: amplitude :param b: background :param psfun: peak shape function integer code :return: peak shape fit data

unidec.modules.fitting.sig_fit(xvals, yvals)
unidec.modules.fitting.splitdis(x, mid, fwhm, a=1, norm_area=False)

Split Gaussain/Lorentzian function normalized to a max of 1.

Gaussian < mid. Lorentzian > mid.

Parameters:
  • mid – Mid point (point of peak intensity)

  • x – x value or values

  • fwhm – Full Width at Half Max

Returns:

Split Gaussian/Lorentzian distribution at x value

unidec.modules.fitting.splitdis_fit(x, s, m, a, b)

Function for fitting Split G/L distribution to peak. Adds a background to splitdis. Prevents negative background, amplitude, and standard deviation. :param x: x value :param s: full width half max :param m: mean :param a: amplitude :param b: linear background :return: peak shape

unidec.modules.fitting.voigt(x, mu=0, sigma=1, gamma=1, amp=1, background=0)

voigt profile

V(x,sig,gam) = Re(w(z))/(sig*sqrt(2*pi)) z = (x+i*gam)/(sig*sqrt(2))

unidec.modules.fitting.voigt_fit(xvals, yvals, mguess=0, sguess=0.1, gguess=0, aguess=0, bguess=0)
unidec.modules.fitting.weighted_std_2(values, weights)

Calculate weighted standard deviation. :param values: Values :param weights: Weights :return: Weighted standard deviation.

unidec.modules.hdf5_tools module

unidec.modules.hdf5_tools.get_data(f, group, dataset)
unidec.modules.hdf5_tools.get_dataset(group, name)
unidec.modules.hdf5_tools.get_mass_data(f)
unidec.modules.hdf5_tools.get_metadata(f, key)
unidec.modules.hdf5_tools.get_num(f)
unidec.modules.hdf5_tools.get_param(f, parameter)
unidec.modules.hdf5_tools.read_attr(thing, string, config)
unidec.modules.hdf5_tools.replace_dataset(group, name, data)
unidec.modules.hdf5_tools.replace_dataset_strings(group, name, data)

unidec.modules.hramtools module

class unidec.modules.hramtools.HRAMResult

Bases: object

to_df()
class unidec.modules.hramtools.HRAMSearchSpace(searchspace=None, efile=None)

Bases: object

filter_indexes()
generate_masses()
limit_search_space(mintarget, maxtarget=None, tolerance=100)
match_to_target(target, tolerance=5, silent=True)
unidec.modules.hramtools.calc_fromula_from_mass(targets, Searcher=None, tolerance=5)

unidec.modules.html_writer module

unidec.modules.html_writer.array_to_html(array, outfile=None, cols=None, rows=None, colors=None, index=True, sortable=True)
unidec.modules.html_writer.df_to_html(df, outfile=None, colors=None, index=True, sortable=True)
unidec.modules.html_writer.dict_to_html(indict, outfile=None)
unidec.modules.html_writer.fig_to_html_mpld3(fig, outfile=None)
unidec.modules.html_writer.gen_style_str()
unidec.modules.html_writer.html_cleaner(outfile)
unidec.modules.html_writer.html_close(outfile)
unidec.modules.html_writer.html_open(outfile)
unidec.modules.html_writer.html_pagebreak(outfile=None)
unidec.modules.html_writer.html_title(outtitle, outfile=None)
unidec.modules.html_writer.png_to_html(png_str, outfile=None)
unidec.modules.html_writer.to_html_collapsible(text, title='Click to expand', canopen=True, outfile=None, htmltext=False)

Create HTML collapsible from text. :param text: Text to be displayed in collapsible :param title: Title of collapsible :param canopen: Whether collapsible can be opened or not :param outfile: File output :param htmltext: :return:

unidec.modules.html_writer.to_html_paragraph(text, outfile=None)
unidec.modules.html_writer.wrap_to_grid(inputlist, outfile=None)
unidec.modules.html_writer.write_to_html(html_str, outfile, mode='a')

unidec.modules.i2ms_importer module

class unidec.modules.i2ms_importer.I2MSImporter(file)

Bases: object

grab_data()
invinjtime
try:

self.invinjtime = np.where(self.keys[:, 1] == “InverseInjectionTimeSeconds”)[0][0]

except:

self.invinjtime = None

unidec.modules.isotopetools module

unidec.modules.isotopetools.calc_averagine_isotope_dist(mass, mono=False, charge=None, adductmass=1.007276467, crop=False, **kwargs)
unidec.modules.isotopetools.correct_avg(dist, mass)

Note, switched from weighted average to peak correction

unidec.modules.isotopetools.get_apex_mono_diff(mass)
unidec.modules.isotopetools.isojim(isolist, length=700)

Thanks to Jim Prell for Sketching this Code

unidec.modules.isotopetools.makemass(testmass)
unidec.modules.isotopetools.predict_apex_mono_diff(mass)

unidec.modules.mainwindow module

class unidec.modules.mainwindow.Mainwindow(parent, title, config, iconfile=None, tabbed=None)

Bases: MainwindowBase

Main UniDec GUI Window.

resize()

self.plotpanel.SetSize(self.splitterwindow.GetSize()) self.plotpanel.SetMinSize(self.splitterwindow.GetSize()) self.plotpanel.SetVirtualSize(self.splitterwindow.GetSize()) self.plotpanel.SetVirtualSizeWH(*self.splitterwindow.GetSize()) #self.plotpanel.SetBestVirtualSize(self.splitterwindow.GetSize()) #self.sizerplot.SetMinSize(self.splitterwindow.GetSize())

self.plotpanel.SetSizer(self.sizerplot) self.sizerplot.FitInside(self.splitterwindow) self.sizerplot.RepositionChildren(wx.Size(10, 10))

setup_main_panel()

Lays Out Main Panel. Binds some functions to presenter. :return: None

class unidec.modules.mainwindow.MyFileDropTarget(window)

Bases: FileDropTarget

OnDropFiles(x, y, filenames)

When files are dropped, either open a single file or run in batch.

unidec.modules.masstools module

class unidec.modules.masstools.CommonMasses(parent, panel, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, TextEditMixin, ColumnSorterMixin

GetListCtrl()
add_line(name=None, mass='0', type='User')

Add a line to the list. :return: None

clear(e=None)

Clear the list :return: None

get_list()
Returns:

List items in a nested list

get_selection()
on_delete(event)

Delete the selected item. :param event: Unused event. :return: None

on_right_click(event)

Open a right click menu :param event: Unused event :return: None

on_transfer(e)
on_transfer_site(e)
populate(data1, data2, data3)

Populate the list of matches from four arrays :param data1: The first column, the measured mass :param data2: The second column, the simulated mass :param data3: The third column, the error between measured and simulated. :return: None

repopulate(e)
class unidec.modules.masstools.DummyPanel(parent)

Bases: Panel

class unidec.modules.masstools.MassListCtrl(parent, panel, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=32, coltitle='Mass (Da)')

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line()

Add a new line, default of 0. :return: None

clear()

Clear the list. :return: None

get_list()

Return the list as a list of mass values :return: List of mass values

on_biopolymer(e=0)
on_masslist_delete(event)

Delete the selected item. :param event: Unused event. :return: None

on_right_click_masslist(event=None)

Create a right click menu. :param event: Unused event :return: None

populate(listctrldata)

Populate the the listctrl from a list of mass values :param listctrldata: mass value list :return: None

class unidec.modules.masstools.MassSelection(*args, **kwargs)

Bases: Dialog

add_line_to_ss(name='Free', mass=0)
add_to_common_masses(name, mass, type)
get_site_df()
get_site_headers()
get_site_masses_names()
import_sites(path)
init_dialog(config, pks, massdat=None)

Creates the dialog window and displays it. :param config: UniDecConfig object :param pks: Peaks object :param massdat: Mass distribution :return: None

load_common_masses(file)
on_add_col(event=None, newcolindex=None)
on_add_mass(e)

Adds a blank line to the mass list. :param e: Unused Event :return: None

on_add_new_common_mass(e)
on_add_oligomer(e)

Adds a blank line to the oligomer list. :param e: Unused event :return: None

on_add_site(e)

Adds a blank line to the site list. :param e: Unused event :return: None

on_add_to_ss(e=None)
on_autocorr_window(e)

Opens up an autocorrelation window for the purpose of figuring out mass differences. :param e: Unused event :return: None

on_check_for_alt_match(e=None)
on_clear_masslist(e)

Clears the mass list. :param e: Unused event :return: None

on_clear_oligolist(e)

Clears the oligomer list. :param e: Unused Event :return: None

on_clear_sites(e)

Clears the site list. :param e: Unused Event :return: None

on_close(e)

Close the dialog and apply the changes.

Sets self.config.masslist to the defined mass list. Sets self.config.oligomerlist to the defined oligomers. Sets self.config.matchlist to the matched values :param e: Unused event :return: None

on_close_cancel(e)

Close the dialog but do not modify any of the values. :param e: Unused event :return: None

on_common_to_oligo(e)
on_import_masses(e)

Opens a dialog to import mass list files. :param e: Unused event :return: None

on_import_oligos(e)

Open a file dialog to import oligomer files. :param e: Unused event :return: None

on_import_sites(e=None)

Open a file dialog to import sites files. :param e: Unused event :return: None

on_load_common_masses(e)
on_match(type='all')
on_match_all(e=None)

Match the peaks in self.pks to all possible combination of oligomers in the oligomerlist. Uses ud.make_all_matches function. Populated the matchlistbox with the results of the matching. :param e: Unused event :return: None

on_match_isolated(e)

Match the peaks in self.pks to possible combination of isolated rows of oligomers in the oligomerlist. Uses ud.make_isolated_match function. Populated the matchlistbox with the results of the matching. :param e: Unused event :return: None

on_match_sites(e=None)

Match the peaks in self.pks to all possible combination of oligomers in the oligomerlist. Uses ud.make_all_matches function. Populated the matchlistbox with the results of the matching. :param e: Unused event :return: None

on_save_common_masses(e)
on_simulate(e)

Replaces the peaks in self.pks with the masses defined in the self.masslistbox. The intensity information comes from interpolating the mass distribution in self.massdat. It flags self.pks.changes as 1, which is picked up downstream to say that these new peaks should be replotted. :param e: Unused event :return: None

on_view_alt(index=None)
pop_from_peaks(e)

Populate the mass list from the peak masses in self.pks :param e: Unused event :return: None

pop_oligo_all(e)

Populates the mass list with all possible oligomers. :param e: Unused event :return: None

pop_oligo_iso(e)

Populate the mass list with isolated oligomer rows. :param e: Unused event :return: None

pop_oligo_sites(e)

Populates the mass list with all possible oligomers. :param e: Unused event :return: None

read_tolerance()
set_tolerance(tol=1000)
class unidec.modules.masstools.MatchListCtrl(parent, panel, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

clear()

Clear the list :return: None

color_item(i, color)
get_list()
Returns:

List items in a nested list

on_right_click(event)

Create a right click menu. :param event: Unused event :return: None

on_view_alt(e=None)
populate(data1, data2, data3, data4)

Populate the list of matches from four arrays :param data1: The first column, the measured mass :param data2: The second column, the simulated mass :param data3: The third column, the error between measured and simulated. :param data4: The fourth column, the match name. :return: None

class unidec.modules.masstools.OligomerListCtrl(parent, panel, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

Bases: ListCtrl, ListCtrlAutoWidthMixin, TextEditMixin

add_line(a=0, b=0, c=0, d=1, e=None)

Add a blank line to the list. :return: None

clear()

Clear the list. :return: None

get_items(indexes)
get_list()

Return the values on the apanel as a nested list. :return: List of values in N x 5 format.

on_add_to_common(event)

Delete the selected item. :param event: Unused event :return: None

on_biopolymer(e=0)
on_oligo_delete(event)

Delete the selected item. :param event: Unused event :return: None

on_right_click_oligolist(event)

Open a right click menu :param event: Unused event :return: None

populate(data)

Populate from an N x 4 or N x 5 array into the listctrl. :param data: Array :return: None

unidec.modules.matchtools module

unidec.modules.matchtools.UPP_check_peaks(row, pks, tol, vmoddf=None, fmoddf=None, favor='Closest', integrate=False)
unidec.modules.matchtools.calc_bispecific_correct(row, a_code='BsAb (Correct)', b_code='LC1 Mispair (Incorrect)', c_code='LC2 Mispair (Incorrect)')

Calculate the correct bispecific pairing from three columns of heights. Ref: http://dx.doi.org/10.1080/19420862.2016.1232217 :param row: df row with the three columns :param a_code: the code for the first column with the correct pairing :param b_code: the code for the second column with the incorrect pairing :param c_code: the code for the third column with the incorrect pairing :return: x, y, the fraction of the a peak that is correctly paired and light chain scrambled, respectively.

unidec.modules.matchtools.calc_pairs(row, remove_zeros=True, fmoddf=None, keywords=None)

For use with UniDec Processing Pipeline Calculate the potential pairs from a row. :param row: Row from a df with Sequence N in the column heading designating the sequence. Seq N + Seq M will look for a pair. :param remove_zeros: Boolean to remove the pairs with masses of 0 from the output. Default is True. :param fmoddf: DataFrame of the Fixed Modifications to use for the sequences. If None, will not use any. :return: Masses of pairs, labels of potential pairs

unidec.modules.matchtools.check_string_for_seq(redstring, pair)
unidec.modules.matchtools.dar_calc(pks, protein_mass, drug_mass, min_drugs, max_drugs, tolerance, integrate=False)

Calculate the DAR for a given ADC. This is the weighted average of the number of drugs conjugated to the antibody. :param pks: The peaklist object :param protein_mass: The mass of the protein :param drug_mass: The mass of the drug :param min_drugs: The minimum number of drugs conjugated :param max_drugs: The maximum number of drugs conjugated :param tolerance: The tolerance for matching the ADC mass to a peak :return: The DAR

unidec.modules.matchtools.file_to_df(path)
unidec.modules.matchtools.get_sitematch_list(gdf, sites=None, probs_cutoff=0, masscolumn='Monoisotopic mass', namecolumn='Glycan', percent=True, sort='mass')

Function to generate a list of potential mass matches from a DataFrame with different potential sites. The dataframe should include three+ columns. One column is the name of the species, specified by namecolumn. A second column with the mass of the species, specified by masscolumn. A third or more columns specifying the probabilities of finding a particular species at that site. The names of the columns specifying each site are specified by the sites parameter. :param gdf: A pandas DataFrame with the species as rows and the mass, name, and probabilities for each site as columns :param sites: A list of the column names for each of the sites. Probabilites are provided in each column for each species row at that site. :param probs_cutoff: Cutoff to remove probabilities below a certain value. Specified in percent. :param masscolumn: The name of the mass :param namecolumn: The name of the column in the DF specifying the species. Default is “Glycan”. :param percent: True/False, specifies whether to assume probabilities are provided in percent and thus to divide by 100. :param sort: None to leave lists unsorted, “mass” to sort by mass, “prob” to sort by probabilities :return: indexes, masses, probs, names. Lists, all the same length. Each row a possible combination of site mods. Indexes is the index from the possible mods of each site for combination. Masses is the mass of that possible combination. Probs is the probability of that possible combination based on the product of each site. Names is the list of names in each site.

unidec.modules.matchtools.index_to_sname(index, names, sitenames)
unidec.modules.matchtools.parse_fmoddf(fmoddf)
unidec.modules.matchtools.parse_global_fixed_mod(row)
unidec.modules.matchtools.parse_vmoddf(vmoddf)
unidec.modules.matchtools.site_match(pks, oligomasslist, oligoindexes, onames, sitenames, tolerance=None)
unidec.modules.matchtools.sitematch_to_excel(indexes, masses, probs, names, peakmasses, protmass, sites, outfile)

Write out an Excel file with the potential matches for each peak :param indexes: Indexes list from get_sitematch_list :param masses: Masses list from get_sitematch_list :param probs: Probs list from get_sitematch_list :param names: Names list from get_sitematch_list :param peakmasses: List of peak masses to match against. Each will have its own sheet of potential masses in the excel file :param protmass: Mass of the constant protein to add to each possible mod to :param sites: List of site names to output. Doesn’t need to match the get_sitematch_list above. :param outfile: Excel file path to write to. :return: None

unidec.modules.matchtools.sitematch_to_target(targetmass, indexes, masses, probs, tolerance=5)

Function to match a particular target mass to combinations provided :param targetmass: Mass to match to :param indexes: Indexes from get_sitematch_list :param masses: Masses from get_sitematch_liist :param probs: Probabilities from get_sitematch_list :param tolerance: Tolerance (in mass units) of the match. :return: Selected indexes, masses, and probs arrays where all masses in the returned arrays are +/- tolerance away from the targetmass

unidec.modules.matchtools.sort_sitematches_by(indexes, masses, probs, type='mass')

Simple function for sorting by either mass or probability :param indexes: The indexes array :param masses: The masses array :param probs: The probability array :param type: Either “mass” (default) or “prob” to sort by mass or probability respectively :return: indexes, masses, probabilities (all sorted)

unidec.modules.miscwindows module

class unidec.modules.miscwindows.AdditionalParameters(*args, **kwargs)

Bases: Dialog

initialize_interface(config)

Initialize the GUI. :param config: UniDecConfig object :return: None

on_close(e)

Update parameters in self.config from the GUI. Close the window. :param e: Unused Event :return: None

on_close_cancel(e)

Close the window but don’t update the parameters in self.config. :param e: Unused event :return: None

class unidec.modules.miscwindows.DoubleInputDialog(*args, **kwargs)

Bases: Dialog

initialize_interface(title='', message='', defaultvalue='', message2='', default2='')
on_close(e)
class unidec.modules.miscwindows.FileNameDialog(*args, **kwargs)

Bases: Dialog

initialize_interface(config)

Initialize the interface. :param config: UniDecConfig object :return: None

on_close(e)

Get the new filenames from the window. If each is not blank, update self.config. Close the window. :param e: Unused event :return: None

on_close_cancel(e)

Close the window but don’t update any of the parameters. :param e: Unused event :return: None

class unidec.modules.miscwindows.MultiInputDialog(*args, **kwargs)

Bases: Dialog

initialize_interface(messages, title='', defaultvalues=None)
on_close(e)
class unidec.modules.miscwindows.SaveFigureDialog(*args, **kwargs)

Bases: Dialog

initialize_interface(config)

Initialize the GUI. :param config: UniDecConfig :return:

on_choose_dir(e)

Open a dialog to choose the directory. :param e: Unused event :return: None

on_close(e)

Close the window and save the parameters to the class. :param e: Unused event :return: None

on_close_cancel(e)

Destroy the window without setting anything. :param e: Unused event :return: None

class unidec.modules.miscwindows.SingleInputDialog(*args, **kwargs)

Bases: Dialog

initialize_interface(title='', message='', defaultvalue='')

Create a simple dialog window interface. :param title: Title for the frame. :param message: Message inside the window. :param defaultvalue: String default value for the window. :return: None

on_close(e)

Close the window and set self.value to the value returned by the inputbox. :param e: Unused event :return: self.value

unidec.modules.miscwindows.setup_tab_box(tab, plot)

Shortcut function for adding an object (plot) to a box sizer and fitting it to a notebook tab. :param tab: wx.Notebook tab :param plot: Object to add to box sizer :return: None

unidec.modules.mzMLimporter module

unidec.modules.mzMLimporter.auto_gzip(mzml_path)
unidec.modules.mzMLimporter.fit_line(x, a, b)
unidec.modules.mzMLimporter.get_data_from_spectrum(spectrum, threshold=-1)
unidec.modules.mzMLimporter.get_im_data_from_spectrum(spectrum, threshold=-1)
unidec.modules.mzMLimporter.get_longest_index(datalist)
unidec.modules.mzMLimporter.get_resolution(testdata)

Get the median resolution of 1D MS data. :param testdata: N x 2 data (mz, intensity) :return: Median resolution (float)

unidec.modules.mzMLimporter.gzip_files(mzml_path, out_path)

Create and indexed gzip mzML file from a plain mzML.

unidec.modules.mzMLimporter.merge_im_spectra(datalist, mzbins=None, type='Integrate')

Merge together a list of ion mobility data. Interpolates each data set in the list to a new nonlinear axis with the median resolution of the first element. Optionally, allows mzbins to create a linear axis with each point spaced by mzbins. Then, adds the interpolated data together to get the merged data. :param datalist: M x N x 2 list of data sets :return: Merged N x 2 data set

unidec.modules.mzMLimporter.merge_spectra(datalist, mzbins=None, type='Interpolate')

Merge together a list of data. Interpolates each data set in the list to a new nonlinear axis with the median resolution of the first element. Optionally, allows mzbins to create a linear axis with each point spaced by mzbins. Then, adds the interpolated data together to get the merged data. :param datalist: M x N x 2 list of data sets :return: Merged N x 2 data set

class unidec.modules.mzMLimporter.mzMLimporter(path, gzmode=False, nogz=False, *args, **kwargs)

Bases: object

Imports mzML data files.

get_data(scan_range=None, time_range=None)

Returns merged 1D MS data from mzML import :return: merged data

get_data_fast_memory_heavy(scan_range=None, time_range=None)
get_data_memory_safe(scan_range=None, time_range=None)
get_dts()
get_im_data(scan_range=None, time_range=None, mzbins=None)
get_inj_time(spectrum)
get_inj_time_array()
get_max_scans()
get_max_time()
get_polarity(scan=1)
get_property(s, name)
get_scans_from_times(time_range)
get_tic()
get_times_from_scans(scan_range)
grab_data(threshold=-1)
grab_im_data()
unidec.modules.mzMLimporter.nonlinear_axis(start, end, res)

Creates a nonlinear axis with the m/z values spaced with a defined and constant resolution. :param start: Minimum m/z value :param end: Maximum m/z value :param res: Resolution of the axis ( m / delta m) :return: One dimensional array of the nonlinear axis.

unidec.modules.mzMLimporter.search_by_id(obo, id)

unidec.modules.mzXML_importer module

unidec.modules.mzXML_importer.get_data_from_spectrum(spectrum, threshold=-1)
class unidec.modules.mzXML_importer.mzXMLimporter(path, *args, **kwargs)

Bases: object

Imports mzXML data files.

get_data(scan_range=None, time_range=None)

Returns merged 1D MS data from mzML import :return: merged data

get_data_fast_memory_heavy(scan_range=None, time_range=None)
get_data_memory_safe(scan_range=None, time_range=None)
get_max_scans()
get_max_time()
get_polarity()
get_scans_from_times(time_range)
get_tic()
get_times_from_scans(scan_range)
grab_data(threshold=-1)

unidec.modules.mzmlparse_auto module

unidec.modules.mzmlparse_auto.extract(file, directory, timestep=1.0, output='txt')
unidec.modules.mzmlparse_auto.extract_scans(file, directory, scanbins=1, output='txt')
unidec.modules.mzmlparse_auto.extract_scans_multiple_files(files, dirs, startscan=1.0, endscan=1.0, outputname='Combined', existing_path=None, vars=None, keys=None)
unidec.modules.mzmlparse_auto.extract_timepoints(files, directories, starttp=None, endtp=None, timestep=1.0, outputname='Combined')
unidec.modules.mzmlparse_auto.get_files(directory, timestep=1.0, output='txt')
unidec.modules.mzmlparse_auto.parse(path, times, timestep, volts, outputheader, directory, output='txt')
unidec.modules.mzmlparse_auto.parse_multiple(paths, timestep, newdir, starttp, endtp, voltsarr=None, outputname=None)

unidec.modules.nativez module

class unidec.modules.nativez.ColorList(parent)

Bases: Panel

add_empty_line()

Add an empty line by adding a default Zoffset object. :return: None

add_line(zoff)

Adds a new line from a Zoffset object. :param zoff: Zoffset object. :return:

return_data()

Make each line from the listctrl into a Zoffset object and return the list. :return: List of Zoffset objects

super_delete()

Delete all items in the ultimate list control. :return: None

class unidec.modules.nativez.NativeZ(*args, **kwargs)

Bases: Dialog

extract(e)

Extract the mass distribution at each offset value, plot it, and write the outputs. Call self.peak_extract :param e: Unused event :return: None

fast_extract(f, width, eshape)

Extract the intensity data for a specific charge offset from self.igrid. Mask all of the other data. :param f: Charge offset :param width: Width of the extraction (+/- from charge offset) :param eshape: Shape of the extraction 0 = Box (+/- is a hard cutoff) 1 = Gaussian (+/- is std deviation of Gaussian) :return: masked intensity values from self.igrid for a specific charge offset

fit(e)

Fit the offset totals to a series of overlapping Gaussians. Update the plots and listctrl from the result. :param e: Unused event :return: None

get_maxima()

Detect peaks in self.offset_totals (the total extracted intensitites) and set default parameters. Plot the results. :return: None

initialize_interface(massaxis, chargeaxis, igrid, config, pks)

Initialize the parameters, setup the GUI, and plot the intial results. :param massaxis: Mass axis values :param chargeaxis: Charge axis value :param igrid: Intensities at each mass and charge point :param config: UniDecConfig object :param pks: Peaks object :return: None

make_f_array(minval, maxval, zwidth=1)

Get the global offset parameters for the massaxis and chargeaxis. Create a grid of mass and charge value. Calculate the charge offset at each point and store it at self.offset_grid. Calculate the total intensity for each charge offset value +/- zwidth (default is 1). :param minval: Minimum charge offset value :param maxval: Maximum charge offset value :param zwidth: Tolerance window for the offset to be summed. :return: None

make_plot_7(e)

Plot the 2D mass v. charge plot. Add colored charge offset bands on top of the plot. :param e: Unused event :return: None

on_add(e)

Add a blank line to self.zlistctrl. :param e: Unused event :return: None

on_close(e)

Close the window and update the parameters :param e: :return:

on_close_cancel(e)

Close the window but do not update the parameters. :param e: Unused event :return: None

on_delete(event)

Delete item from the list ctrl. :param event: wx.Button event :return: None

on_replot(e)

Update the parameters and replot the results. :param e: Unused event :return: None

on_reset(e)

Reset the listctrl and plots to the default states. :param e: Unused event :return: None

peak_extract()

Extract the values for local max (height) and area for peaks in pks from each zoff.extract. Plot the results. Write the results to files. :return: None

plot_zoffs()

Plot the total charge offsets along with fits. Call self.make_plot_7. :return: None

populate_list(e)

Add data from self.zoffs to self.zlistctrl. :param e: Unused event :return: None

save_figures(e)

Save the figures as pdfs in the unidec folder. :param e: Unused event :return: None

update(e)

Update self.zoffs from the self.zlistctrl. Update the intensities for each zoffset value. :param e: :return:

update_list()

Update self.zlistctrl from self.zoffs. :return: None

class unidec.modules.nativez.Zoffset

Bases: object

make(offset, intensity, index, color, marker)

Add details to the charge offset species. :param offset: Charge offset value :param intensity: Intensity :param index: Index in the list :param color: Color :param marker: Marker for the plot :return: None

unidec.modules.peakstructure module

class unidec.modules.peakstructure.Peak

Bases: object

Class for a single peak. Contains all key parameters for describing and plotting the peak.

line_out(type='Full')
class unidec.modules.peakstructure.Peaks

Bases: object

Class containing all useful data about peaks.

The peaks themselves are of the Peak class and contained within the self.peaks list.

add_peaks(parray, massbins=0, scores_included=False)

Create peak objects from an array :param parray: N x 2 array containing (mass, height) of each peak. :param massbins: Describes the precision of the mass inputs by describing the bin size on the mass axis. :return: None

auto_format()
color_by_score(e=0)
copy(type='Full')
default_params(cmap='rainbow')

Set default parameters for peaks, such as color, label, and marker :param cmap: Colormap from matplotlib.cm :return: None

diffs_consecutive()
diffs_from(target)
get_bool()
get_mass_defects(kendrickmass, mode=0)

Get the mass defects and mass number for each peak :param kendrickmass: Kendrick reference mass :param mode: Select range of defects 1=(0,1), 0=(-0.5,0.5) :return: None

integrate(data, lb=None, ub=None)
merge_in_peaks(pks, filename=None, filenumber=None)
to_df(type='Full', drop_zeros=True)

unidec.modules.peakwidthtools module

class unidec.modules.peakwidthtools.PeakTools1d(*args, **kwargs)

Bases: Dialog

initialize_interface(config, data)

Create the GUI, import the paramters, and plot the intial data. :param config: UniDecConfig Object :param data: Data array (N x 2) :return: None

on_center(e)

Crop the range to the values from the plot and replot the cropped data. Note this is a bit clumsy. Hopefully someone will come along and make this more eligant someday… :param e: Unused event :return: None

on_close(e)

Close the window and update self.config.psfun and self.config.mzsig from the parameters in the GUI. :param e: Unused event :return: None

on_close_cancel(e)

Close the window but do not update the parameters. :param e: Unused event :return: None

on_fit(e)

Perform the fit, update the GUI, and plot the results. :param e: Unused event :return: None

on_plot(e)

For the sigma value in the self.ctrlmzsig, plot a simulated peak. :param e: Unused event :return: None

on_reset(e)

Reset the plot to the full range. :param e: Unused event :return:

class unidec.modules.peakwidthtools.PeakTools2d(*args, **kwargs)

Bases: Dialog

initialize_interface(data3, data2, config)

Initialize the parameters, create the interface, plot the initial data. :param data3: 2D IM-MS data :param data2: 1D MS data :param config: UniDecConfig Object :return: None

on_center(e)

Gets the range from the current plot zoom, cuts the data, and plots the cut data. :param e: Unused event :return: None

on_close(e)

Close the window and update self.config from the new values. :param e: Unused event :return: None

on_close_cancel(e)

Close the window but do not update self.config. :param e: Unused event :return: None

on_fit(e)

Fits the spectrum and outputs the results. :param e: :return:

on_flip(e)

Flip from m/z to arrival time at the previously fit m/z value. :param e: Unused event :return: None

on_plot(e)

Plot a predicted peak shape based on the values input into the control. :param e: Unused event :return: None

on_reset(e)

Resets the plot. :param e: Unused event :return: None

unidec.modules.plateplot module

class unidec.modules.plateplot.PlateFrame(parent)

Bases: Frame

change_type(e=None)
draw()
load_eng(eng)
make_plot(data=None)
onmove(e=None)
replot(e=None)
class unidec.modules.plateplot.PlatePlot(*args, **kwargs)

Bases: PlottingWindowBase

Plotting class for 3D Waterfall plots.

make_plate(type=96)
onmove(e=None)
populate(positions, colors=None)
unidec.modules.plateplot.cc(arg)

unidec.modules.plot1d module

class unidec.modules.plot1d.Plot1dBase(*args, **kwargs)

Bases: PlotBase

barplottop(xarr, yarr, peakval, colortab, xlabel='', ylabel='', title='', zoom='box', repaint=True)

Create a bar plot. :param xarr: x value array :param yarr: y value array :param peakval: Bar labels to be listed below bars :param colortab: List of colors for the various bars :param xlabel: Label for x axis :param ylabel: Label for y axis :param title: Plot title :param zoom: Type of zoom (‘box’ or ‘span) :param repaint: Boolean, whether to repaint or not when done. :return: None

barplottoperrors(xarr, yarr, peakval, colortab, xlabel='', ylabel='', title='', zoom='box', repaint=True, xerr=0, yerr=0)

Create a bar plot. :param xarr: x value array :param yarr: y value array :param peakval: Bar labels to be listed below bars :param colortab: List of colors for the various bars :param xlabel: Label for x axis :param ylabel: Label for y axis :param title: Plot title :param zoom: Type of zoom (‘box’ or ‘span) :param repaint: Boolean, whether to repaint or not when done. :param xerr: for error bars :param yerr: for error bars :return: None

colorplotMD(xvals, yvals, cvals, title='', xlabel='', ylabel='', clabel='Mass Defect', cmap='hsv', config=None, color='black', max=1, marker=None, zoom='box', nopaint=False, test_kda=False, integerticks=False, **kwargs)
errorbars(xvals, yvals, xerr=None, yerr=None, color='black', newlabel='', nopaint=True, **kwargs)
filledplot(x, y, color='black')

Creates a plot filled between the y values and the y axis :param x: x values :param y: y values :param color: color :return: None

histogram(xarray, labels=None, xlab='', ylab='', title='')

Creates a histogram plot. :param xarray: Array of values in (N x M) array :param labels: Labels for value :param xlab: x axis label :param ylab: y axis label :param title: Plot Title :return: None

insetplot(x, y, a, b)
multiplot(x, y, a, b)
plotadd(xvals, yvals, colval='black', newlabel='', nopaint=True, **kwargs)

Adds a plot. :param xvals: x values :param yvals: y values :param colval: Color :param newlabel: Label :param nopaint: Boolean, whether to repaint or not :return: None

plotrefreshtop(xvals, yvals, title='', xlabel='', ylabel='', label='', config=None, color='black', marker=None, zoom='box', nopaint=False, test_kda=False, integerticks=False, zoomout=False, **kwargs)

Create a new 1D plot. :param xvals: x values :param yvals: y values :param title: Plot title :param xlabel: x axis label :param ylabel: y axis label :param label: label for legend :param config: UniDecConfig object :param color: Plot color :param marker: Marker type :param zoom: zoom type (‘box’ or ‘span’) :param nopaint: Boolean, whether to repaint or not :param test_kda: Boolean, whether to attempt to plot kDa rather than Da :param integerticks: Boolean, whether to use inter tickmarks only :param zoomout: Boolean, whether to zoom out :param kwargs: Keywords :return: None

scatterplottop(xarr, yarr, color=None, xlabel='', ylabel='', title='', zoom='box', repaint=True)

Create a bar plot. :param xarr: x value array :param yarr: y value array :param color: List of colors for the various dots :param xlabel: Label for x axis :param ylabel: Label for y axis :param title: Plot title :param zoom: Type of zoom (‘box’ or ‘span) :param repaint: Boolean, whether to repaint or not when done. :return: None

unidec.modules.plot2d module

class unidec.modules.plot2d.Plot2dBase(*args, **kwargs)

Bases: PlotBase

Plotting class for 2D contour plots

contourplot(dat=None, config=None, xvals=None, yvals=None, zgrid=None, xlab='m/z (Th)', ylab='Charge', title='', normflag=1, normrange=None, repaint=True, nticks=None, test_kda=False, discrete=None, ticloc=None, ticlab=None, order=None)

Make 2D plot.

Data can be added using two methods:
  1. If dat is specified, it will look for an N x 3 list of x,y,z values

  2. If xvals, yvals, and zgrid are filled, it will plot zgrid assuming its shape is (len(xvals),len(yvals))

Parameters:
  • dat – N x 3 list in [x,y,z] format of data to be plotted

  • config – UniDecConfig object

  • xvals – x-axis values

  • yvals – y-axis values

  • zgrid – numpy array of shape (len(xvals),len(yvals))

  • xlab – Label for x-axis

  • ylab – Label for y-axis

  • title – Plot title

  • normflag – Set to 1 to normalize the plot range from min to max. If 0, will not normalize.

  • normrange – Range to normalize to if normflag is 0.

  • repaint – If true, will repaint the plot after it is done.

  • nticks – Number of ticks on the x-axis. If None, will use default.

  • test_kda – If true, will decide if the x-axis is better displayed in Da or kDa units.

Returns:

None

hist2d(xvals, yvals, bins, config=None, xlab='m/z (Th)', ylab='Charge', title='', repaint=True, nticks=None, test_kda=False)
plot_native_z(offset, col, xvals, width=0, alpha=1, shape=0)

Plots a showing the native charge offsets. :param offset: Offset value :param col: Color :param xvals: x-axis (mass) :param width: Width of charge distribution. :param alpha: Transparency of plot overlay :param shape: Indicates whether the width defines a step function of a Gaussian distribution :return: None

unidec.modules.plot3d module

class unidec.modules.plot3d.CubePlot(*args, **kwargs)

Bases: PlottingWindowBase

Plotting class for cube plots. Performs isometric projections of three 2D plots onto three faces of a cube.

cubeplot(xaxis, yaxis, zaxis, C, C2, C3, xlab='', ylab='', zlab='', cmap='jet')

Make 2D isometric projection plot of three cube faces :param xaxis: X-axis values :param yaxis: Y-axis values :param zaxis: Z-axis values :param C: Intensity grid for X v. Y face :param C2: Intensity grid for X v. Z face :param C3: Intensity grid for Y v. Z face :param xlab: X-axis label :param ylab: Y-axis label :param zlab: Z-axis label :param cmap: Colormap for 2D plot :return: None

isogrids()

Sets jsometric projections of X, Y, and Z axis grids :return: None

isolabels(xticlab, yticlab, zticlab, ax, col)

Draw isometric projection of axis labels :param xticlab: X-axis label (string) :param yticlab: Y-axis label (string) :param zticlab: Z-axis label (string) :param ax: Axis object :param col: Color (not presently used) :return: None

isolines()

Draw isometric projection of lines at the edge of the cube. :return: None

isometric_projection(x, y, z)

Give the isometric projection of a given (x,y,z) onto a plane set by self.alpha and self.beta :param x: x value (float) :param y: y value (float) :param z: z value (float) :return: o, isometric projection vector

isoticks(ax, col)

Draws isometric projection of tick marks. :param ax: Axis object :param col: Color of ticks :return: None

make_isomatrices()

Make projection matrix, self.pc, for calculating isometric projection :return: None

unidec.modules.plot_waterfall module

class unidec.modules.plot_waterfall.Waterfall3DPlot(*args, **kwargs)

Bases: PlottingWindowBase

Plotting class for 3D Waterfall plots.

get_angle()
onmove(e=None)
set_angle(elevation, azimuth)
waterfall(xgrid, ygrid, zarray, colors=None, xlabel='Mass', ylabel='')
class unidec.modules.plot_waterfall.WaterfallFrame(parent)

Bases: Frame

change(e=None)
change_type(e=None)
draw()
make_plot(data=None)
onmove(e=None)
unidec.modules.plot_waterfall.cc(arg)

unidec.modules.unidec_enginebase module

class unidec.modules.unidec_enginebase.UniDecEngine(*args, **kwargs)

Bases: object

auto_polarity(path=None, importer=None)
check_badness()

Check for problematic variables, such as upper bounds less than lower bounds and raise warning if found. :return:

check_isomode()
clear_history()
export_config(f_name=None)

Export UniDec Configuration File :param f_name: File name, Default of None will using config.confname :return: None

gen_html_report(event=None, outfile=None, plots=None, interactive=False, open_in_browser=True, results_string=None, del_columns=None)

Generate an HTML report of the current UniDec run. :param event: Unused Event :param outfile: Output file name. Default is None, which will use the default name. :param plots: List of plots to include in the report. Must be 2D with row and column format. :param interactive: If True, will include interactive plots. Default is False. :param open_in_browser: If True, will open the report in the default browser. Default is True. :param results_string: String to include in the report. Default is None. :param del_columns: List of columns to delete from the report. Default is None. :return: None

get_alts(tolerance=100)
get_auto_peak_width(set_it=True)
get_summed_match_intensities(index, alts=True, normmode=0, probarray=None, get_2d=False)
initialize()

Initialize Config, DataContainer, and Peaks :return: None

integrate(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

linear_regression_peaks()
load_config(f_name)

Import UniDec Configuration File :param f_name: File name :return: None

load_default()

Loads config from default location set at self.config.defaultconfig :return: None

load_ofile(file=None)
load_peaks(pfile)
make_oligomers(isolated=False, oligomerlist=None, minsites=None, maxsites=None)
makeplot2(plot=None, data=None, pks=None, config=None, silent=False)

Plot mass data and peaks if possible in self.view.plot2 :param plot: Plot object. Default is None, which will set plot to creating a new plot :param data: 2D data with mass in the first column and intensity in the second. Default is self.data.massdat :param pks: Peaks object. Default is self.pks :param config: Config objet. Default is self.config :return plot: The Plot object

makeplot3(plot=None, data=None, config=None)

Plot m/z vs charge grid. :param plot: Plot object to use :param data: Data to plot :param config: Config object to use :return: plot object

makeplot4(plot=None, data=None, pks=None, config=None, silent=False)

Plots isolated peaks against the data in self.view.plot4. Will plot dots at peak positions. If possible, will plot full isolated spectra. :param plot: Plot object. Default is None, which will set plot to creating a new plot :param data: 2D data with m/z in the first column and intensity in the second. Default is self.data.data2 :param pks: Peaks object. Default is self.pks :param config: Config objet. Default is self.config :return plot: The Plot object

makeplot5(plot=None, xdata=None, ydata=None, zdata=None, config=None)

Plot mass vs charge grid :param plot: Plot object to use :param xdata: x data (2D array) default is eng.data.massdat :param ydata: y data (1D array) default is eng.data.ztab :param zdata: z data (1D array) default is eng.data.massgrid :param config: Config object to use :return: plot object

makeplot6(plot=None, pks=None, show='height', config=None)

Plots bar chart of peak heights or areas in self.view.plot6. :param plot: plot object to use. If none, will create one :param pks: peak structure to use. If none, will use self.pks :param show: What parameter to plot “height” will plot p.height for p in self.eng.pks.peaks “integral” will plot p.integral :param config: config object to use. If none, will use self.config :return: plot object

match(tolerance=100, isolated=False, glyco=False, minsites=None, maxsites=None)
oxidation_analysis(e=None)
polydispersity_index(e=None)
read_hdf5()
redo()
reset_config()

Resets UniDec config to default. Should not reset paths or filenames. :return: None

save_default()

Saves existing config in default location set at self.config.defaultconfig :return: None

undo()
update_history()
write_hdf5()
unidec.modules.unidec_enginebase.copy_config(config)

unidec.modules.unidec_presbase module

class unidec.modules.unidec_presbase.UniDecPres(ignore_args=False, *args, **kwargs)

Bases: object

Main UniDec GUI Application.

Presenter contains UniDec engine at self.eng and main GUI window at self.view

auto_refresh_stop(e=None)
check_badness()

Check for any bad parameters and warn the user if something is off. :return: code (see unidecstructure.check_badness)

cleanup_recent_file(recent_files)
copy_to_clipboard(outstring)
create_timer(e=None)
create_timer2(e=None)
export_config(file_name=None)

Get configuration from GUI and (if file_name is specified) write from engine to file_name :param file_name: Path of file to save config to :return: None

fpop(e=0)
import_config(file_name=None)

Import configuration from file to engine (if file_name is specified) and from engine to GUI. :param file_name: Path of file to import :return: None

makeplot2(e=None, plot=None, data=None, pks=None)

Plot mass data and peaks if possible in self.view.plot2 :param e: unused event :param plot: Plot object. Default is None, which will set plot to self.view.plot2 :param data: Data to plot. Default is None, which will set data to self.eng.data.massdat :param pks: Peaks to plot. Default is None, which will set pks to self.eng.pks :return: None

makeplot3(e=None, plot=None)

Plot m/z vs charge data in 2D in self.view.plot3 :param e: unused event :param plot: Plot object. Default is None, which will set plot to self.view.plot3 :return: None

makeplot4(e=None, plot=None, data=None, pks=None)

Plots isolated peaks against the data in self.view.plot4. Will plot dots at peak positions. If possible, will plot full isolated spectra. :param e: unused event :param plot: Plot object. Default is None, which will set plot to self.view.plot4 :return: None

makeplot5(e=None, plot=None)

Plot mass vs charge data in 2D in self.view.plot5 :param e: unused event :param plot: Plot object. Default is None, which will set plot to self.view.plot5 :return: None

on_auto_peak_width(e=None, set=True)
on_autocorr_window(e=None)

Opens the autocorrelation window. Feed the config and massdat from the engine. :param e: Unused event :return: None

on_biopolymer(e=0)
on_charge_states(e=None, mass=None, plot=None, peakpanel=None, data=None)

Triggered by right click “plot charge states” on self.view.peakpanel. Plots a line with text listing the charge states of a specific peak. :param e: unused event :return: None

on_color_peaks(e=None, plot2=None, plot4=None, mass=None, peakpanel=None, pks=None, filled=True)

Color the peaks in plot2 and plot4. Will also plot the integral under the peak. :param e: Unused event :param plot2: Plot object. Default is None, which will set plot to self.view.plot2 :param plot4: Plot object. Default is None, which will set plot to self.view.plot4 :param mass: Mass list to color. Default is None, which will set mass to self.view.peakpanel.selection2. If set, it will override peakpanel. :param peakpanel: Peak panel object. Default is None, which will set peakpanel to self.view.peakpanel. :param pks: Peaks object. Default is None, which will set pks to self.eng.pks :param filled: Whether to fill the integral under the peak :return: None

on_dataprep_button()
on_differences(e=None, pks=None, plot=None, massdat=None)

Triggered by right click “Display Differences” on self.view.peakpanel. Plots a line with text listing the difference between each mass and a specific peak. Updates the peakpanel to show the differences. :param e: unused event :return: None

on_filter_peaks(e=None)
on_gen_html_report(e=None)

Generates an HTML report of the current data and parameters. :param e: unused event :return: None

on_get_mzlimits()
on_integrate()
on_label_integral(e=None, peakpanel=None, pks=None, plot=None, dataobj=None)

Triggered by right click “Label Masses” on self.view.peakpanel. Plots a line with text listing the mass of each specific peak. Updates the peakpanel to show the masses. :param e: unused event :return: None

on_label_masses(e=None, peakpanel=None, pks=None, plot=None, dataobj=None)

Triggered by right click “Label Masses” on self.view.peakpanel. Plots a line with text listing the mass of each specific peak. Updates the peakpanel to show the masses. :param e: unused event :return: None

on_label_names(e=None, peakpanel=None, pks=None, plot=None, dataobj=None)

Triggered by right click “Label Masses” on self.view.peakpanel. Plots a line with text listing the mass of each specific peak. Updates the peakpanel to show the masses. :param e: unused event :return: None

on_linreg(e=0)
on_load_conf_file(e=None)

Opens a file dialog and then imports a new _conf.dat config file :param e: unused space for event :return: None

on_load_default(e=None)

Resets the configuration then loads the default config file from self.eng.config.defaultconfig. Ignores min and max data cutoffs. :param e: unused space for event :return: None

on_manual(e=None)

Opens window for setting manual assignments. Window directly modifies self.eng.config. :param e: unused event :return: None

on_mass_tools(e=None, show=True)
on_match(e=None)

Automatic matching to present oligomer list.

Opens masstools window but doesn’t make it visible. Matches results to any combination of oligomers. Hits ok and plots results.

Parameters:

e

Returns:

on_open_file(file_name, file_directory, time_range=None, refresh=False)
on_peak_width_tool(e=None)

Open peak width tool window. After it has returned, update the GUI to reflect the new peak widths. :param e: unused event :return: None

on_replot(e=None, plotsums=True)
on_reset(e=None)

Resets UniDecConfig to default and then loads to self.view. :param e: unused space for event :return:

on_save_default(e=None)

Saves the default config file to self.eng.config.defaultconfig :param e: unused space for event :return: None

on_smash_window(e=None)

Opens window for selecting peaks to smash. Window directly modifies self.eng.config. :param e: unused event :return: None

on_timer(e=None)
on_timer2(e=None)
on_unidec_button()
open_most_recent(e=None)
peak_plots(e=None)
plot_integral(limits, color=None, filled=True, plot=None, repaint=False)

Plot a filled integral under a peak. :param limits: Limits of integration :param color: Color of fill and plot :param filled: If True, will fill the area under the curve :param plot: Plot object. Default is None, which will set plot to self.view.plot2 :param repaint: If True, will repaint the plot :return: None

plot_theo_mass(e=0)
quick_auto(e=None)
quit_application()
read_recent()
register(e=None)
start()

Launch view and start MainLoop :return:

sub_div(e=0)
sub_div_window(e=None)
warn(message, caption='Warning!')

Send the user a message box. :param message: Message string :param caption: Caption string :return: None

write_to_recent(path=None)

unidec.modules.unidecstructure module

class unidec.modules.unidecstructure.Chromatogram

Bases: object

to_row()
class unidec.modules.unidecstructure.ChromatogramContainer

Bases: object

add_chromatogram(data, decondat=None, ccsdat=None, label=None, color='#000000', index=None, mzrange=None, zrange=None, massrange=None, massmode=False, mode='DM', sarray=None)
clear()
to_array()
class unidec.modules.unidecstructure.DataContainer

Bases: object

read_hdf5(file_name)
write_hdf5(file_name)
class unidec.modules.unidecstructure.OligomerContainer

Bases: object

get_alts(pks, tolerance=10)
make_oligomers(isolated=False, oligomerlist=None, minsites=None, maxsites=None)
pair_glyco()
class unidec.modules.unidecstructure.UniDecConfig

Bases: object

Class containing all options and configurations for UniDec GUI and Program. Contains methods to export and import config to text file for running UniDec core binaries and for storing parameters for GUI.

check_badness()

Test for a few things that will crash the program: Min is greater than Max for m/z, charge, mass, native charge, ccs, native ccs, dt Bad IM-MS calibration values. Peak width is zero m/z resolution is really small. :return: None

check_new(other)
config_export(name)

Writes config to file give in name. Typically in format: name value.

Also exports manuallist, masslist, and oligomerlist to text files. :param name: File name to write to. :return: None

config_import(name)

Imports configuration from txt file. Also imports masslist, manuallist, and oligomerlist. :param name: File to import from. :return: None

default_colormaps()

Get default matplotlib colormaps and set names to self.cmaps. A more list is set as self.cmaps2. For some reason, matplotlib v.1.5.0 allows viridis and other new colormaps with the colormaps() but not cm.datad. Even weirder, they work for some things and not others. Solution, two lists, one for the 2D plots and the other for the linear colors. :return: None

default_decon_params()
default_file_names()

Sets the default file names. For things comming into and out of the program. In theory these can be modified, but it might be risky. :return: None

default_high_res()

Sets some defaults for high resolution spectra. Leaves other values unchanged. :return: None

default_isotopic_res()

Sets some defaults for isotopic resolution spectra. Leaves other values unchanged. :return: None

default_low_res()

Sets some defaults for high resolution spectra. Leaves other values unchanged. :return: None

default_nanodisc()

Sets some defaults for high resolution spectra. Leaves other values unchanged. :return: None

default_zero_charge()

Sets some defaults for when the zero-charge mass spectrum itself is to be deisotoped. Leaves other values unchanged. :return: None

get_colors(n, cmap=None)
get_config_dict()
get_preset_list()
import_smashfile(filename=None)
initialize()

Initialize configuration parameters but not paths. Runs self.default_colormaps :return: None

initialize_system_paths()

Initialize initial paths for UniDec directories :return: None

print_config()

Simple debugging command to read in the config file and print out its contents. :return: None

read_hdf5(file_name=None)
write_hdf5(file_name=None)
unidec.modules.unidecstructure.ofile_reader(path)
unidec.modules.unidecstructure.read_attr(thing, string, config_group)

Module contents