OpenSWATH - GUI Models¶
The main models used by the GUI are the PeptideTree and the
MSData.DataModel models. Internally, PeptideTree
uses ChromatogramTransition to store access to single rows in the
tree data structure while MSData.DataModel uses
SwathRunCollection to keep track of multiple SWATH-MS runs.
TreeModels Module¶
Contains classes that provide access to the hierarhical tree container protein, precursor, peptide and transition level data.
While TreeNode and TreeModel are generic models for trees
and nodes, the derived classes PeptideTreeNode and
PeptideTree are implementations specific to TAPIR.
TreeNode¶
TreeModel¶
PeptideTreeNode¶
PeptideTree¶
SWATH MS Run Module¶
Raw chromatographic data is handled using the SwathRunCollection class which can either hold references to mzML or to SqMass data.
SwathRunCollection¶
SqMass¶
-
class
openswathgui.models.SqlSwathRun.SqlSwathRun(runid, filename, load_in_memory=False, precursor_mapping=None, sequences_mapping=None, protein_mapping={})¶ Data Model for a single sqMass file.
TODO: each file may contain multiple runs!
-
runid¶ Current run id
- Private Attributes:
- _run: A
SqlDataAccessobject - _filename: Original filename
- _basename: Original filename basename
- _precursor_mapping: Dictionary { FullPrecursorName : [transition_id, transition_id] }
- _sequences_mapping: Dictionary { StrippedSequence : [FullPrecursorName, FullPrecursorName]}
- _run: A
-
add_peakgroup_data(precursor_id, leftWidth, rightWidth, fdrscore, intensity, assay_rt)¶
-
getTransitionCount()¶ Get total number of transitions
-
get_all_peptide_sequences()¶ Get all (stripped) sequences
-
get_all_precursor_ids()¶ Get all precursor ids (full sequence + charge)
-
get_all_proteins()¶
-
get_assay_data(precursor)¶
-
get_data_for_precursor(precursor)¶ Retrieve raw data for a specific precursor - data will be as list of pairs (timearray, intensityarray)
-
get_data_for_transition(transition_id)¶ Retrieve raw data for a specific transition
-
get_id()¶
-
get_intensity_data(precursor)¶
-
get_precursors_for_sequence(sequence)¶ Get all precursors mapping to one stripped sequence
-
get_range_data(precursor)¶
-
get_score_data(precursor)¶
-
get_sequence_for_protein(protein)¶
-
get_transitions_for_precursor(precursor)¶ Return the transition names for a specific precursor
-
get_transitions_for_precursor_display(precursor)¶
-
remove_precursors(toremove)¶ Remove a set of precursors from the run (this can be done to filter down the list of precursors to display).
-
-
class
openswathgui.models.SqlDataAccess.SqlDataAccess(filename)¶ Bases:
object-
getDataForChromatogram(myid)¶ Get data from a single chromatogram
- compression is one of 0 = no, 1 = zlib, 2 = np-linear, 3 = np-slof, 4 = np-pic, 5 = np-linear + zlib, 6 = np-slof + zlib, 7 = np-pic + zlib
- data_type is one of 0 = mz, 1 = int, 2 = rt
- data contains the raw (blob) data for a single data array
-
getDataForChromatogramFromNativeId(native_id)¶ Get data from a single chromatogram
- compression is one of 0 = no, 1 = zlib, 2 = np-linear, 3 = np-slof, 4 = np-pic, 5 = np-linear + zlib, 6 = np-slof + zlib, 7 = np-pic + zlib
- data_type is one of 0 = mz, 1 = int, 2 = rt
- data contains the raw (blob) data for a single data array
-
getDataForChromatograms(ids)¶ Get data from multiple chromatograms chromatogram
- compression is one of 0 = no, 1 = zlib, 2 = np-linear, 3 = np-slof, 4 = np-pic, 5 = np-linear + zlib, 6 = np-slof + zlib, 7 = np-pic + zlib
- data_type is one of 0 = mz, 1 = int, 2 = rt
- data contains the raw (blob) data for a single data array
-
MzML File¶
-
class
openswathgui.models.SingleChromatogramFile.SingleChromatogramFile(run, filename, load_in_memory=False, precursor_mapping=None, sequences_mapping=None, protein_mapping={})¶ Data Model for a single file from one run.
One run may contain multiple mzML files
-
runid¶ Current run id
- Private Attributes:
- _run: A pymzml.run.Reader object
- _filename: Original filename
- _basename: Original filename basename
- _precursor_mapping: Dictionary { FullPrecursorName : [transition_id, transition_id] }
- _sequences_mapping: Dictionary { StrippedSequence : [FullPrecursorName, FullPrecursorName]}
-
getTransitionCount()¶ Get total number of transitions
-
get_all_peptide_sequences()¶ Get all (stripped) sequences
-
get_all_precursor_ids()¶ Get all precursor ids (full sequence + charge)
-
get_data_for_precursor(precursor)¶ Retrieve raw data for a specific precursor - data will be as list of pairs (timearray, intensityarray)
-
get_data_for_transition(transition_id)¶ Retrieve raw data for a specific transition
-
get_id()¶
-
get_precursors_for_sequence(sequence)¶ Get all precursors mapping to one stripped sequence
-
get_sequence_for_protein(protein)¶
-
get_transitions_for_precursor(precursor)¶ Return the transition names for a specific precursor
-
get_transitions_with_mass_for_precursor(precursor)¶ Return the transition names prepended with the mass for a specific precursor
-
ChromatogramTransition Module¶
ChromatogramTransition¶
-
class
openswathgui.models.ChromatogramTransition.ChromatogramTransition(name, charge, subelements, peptideSequence=None, fullName=None, datatype='Precursor')¶ Bases:
objectInternal tree structure object representing one row in the in the left side tree.
This is the bridge between the view and the data model
Pointers to objects of
ChromatogramTransitionare passed to callback functions when the selection of the left side tree changes. The object needs to have store information about all the column present in the rows (PeptideSequence, Charge, Name) which are requested by thePeptideTreemodel.Also it needs to know how to access the raw data as well as meta-data for a certain transition. This is done through getData, getLabel etc.
-
getAssayRT(run)¶ Get the intensity for a specific run and current precursor
Parameters: run ( SwathRun) – SwathRun object which will be used to retrieve dataReturns: The intensity for a specific run and current precursor Return type: float
-
getCharge()¶ Get charge of precursor
Returns: Charge Return type: int
-
getData(run)¶ Get raw data for a certain object
If we have a single precursors or a peptide with only one precursor, we show the same data as for the precursor itself. For a peptide with multiple precursors, we show all precursors as individual curves. For a single transition, we simply plot that transition.
Parameters: run ( SwathRunorSqlSwathRun) – SwathRun object which will be used to retrieve dataReturns: Returns the raw data of the chromatograms for a given run. The dataformat is a list of transitions and each transition is a pair of (timearray,intensityarray) Return type: list of pairs (timearray, intensityarray)
-
getIntensity(run)¶ Get the intensity for a specific run and current precursor
Parameters: run ( SwathRun) – SwathRun object which will be used to retrieve dataReturns: The intensity for a specific run and current precursor Return type: float
-
getLabel(run)¶ Get the labels for a curve (corresponding to the raw data from getData call) for a certain object.
If we have a single precursors or a peptide with only one precursor, we show the same data as for the precursor itself. For a peptide with multiple precusors, we show all precursors as individual curves. For a single transition, we simply plot that transition.
Parameters: run ( SwathRun) – SwathRun object which will be used to retrieve dataReturns: The labels to display for each line in the graph Return type: list of str
-
getName()¶ Get name of precursor
Returns: Name of precursor Return type: str
-
getPeptideSequence()¶
-
getProbScore(run)¶ Get the probabilistic score for a specific run and current precursor
Parameters: run ( SwathRun) – SwathRun object which will be used to retrieve dataReturns: The probabilistic score for a specific run and current precursor Return type: float
-
getRange(run)¶ Get the data range (leftWidth/rightWidh) for a specific run
Parameters: run ( SwathRun) – SwathRun object which will be used to retrieve dataReturns: A pair of floats representing the data range (leftWidth/rightWidh) for a specific run Return type: list of float
-
getSubelements()¶
-
getType()¶
-