Base operator#
Abstract base operator.
- pydantic model tidyms2.core.operators.base.BaseOperator#
Bases:
ABC,BaseModel,Generic[ProcessType]TidyMS base operator which all other operators inherit from.
Provides functionality to: - set default parameters using instrument type, separation type and polarity. - set parameters using a dictionary. - get default parameters.
- field id: str = ''#
The Operator id.
- abstractmethod classmethod from_defaults(instrument, separation, polarity)#
Create a new operator with sane defaults for the specified MS instrument, separation mode and polarity.
- Parameters:
instrument (
MSInstrument) – The MS instrument used to measure the samplesseparation (
SeparationMode) – The analytical method used for separationpolarity (
Polarity) – The polarity in which the samples where measured
- Return type:
Self- Returns:
A new operator instance
- check_status(status)#
Raise an exception if data status is not compatible with operator required status.
- Return type:
None
- abstractmethod get_expected_status_in()#
Get the expected sample status before applying the operator.
- Return type:
TypeVar(ProcessType,SampleProcessStatus,AssayProcessStatus,DataMatrixProcessStatus)
- abstractmethod get_expected_status_out()#
Get the expected sample status after applying the operator.
- Return type:
TypeVar(ProcessType,SampleProcessStatus,AssayProcessStatus,DataMatrixProcessStatus)
- update_status(status_in)#
Update the sample process status to the status after applying the operator.
Sample operators#
Abstract sample operators.
- pydantic model tidyms2.core.operators.sample.FeatureExtractor#
Bases:
SampleOperatorExtract features from ROIs.
Must implement the extract_rois method, which takes a single ROI and creates a list of features.
Provides descriptor based filtering of features using the
bounds.- field bounds: dict[str, tuple[pydantic.NonNegativeFloat | None, pydantic.NonNegativeFloat | None]] = {}#
Define valid boundaries for each feature descriptor. Boundaries are expressed by mapping descriptor names to a tuple lower and upper bounds. If only a lower/upper bound is required,
Nonemust be used (e.g.(None, 10.0)to use only an upper bound).
- get_expected_status_in()#
Get the expected status before performing ROI extraction.
- Return type:
- get_expected_status_out()#
Get the expected status after performing ROI extraction.
- Return type:
- pydantic model tidyms2.core.operators.sample.FeatureTransformer#
Bases:
SampleOperatorApply a transformation to individual features.
Must implement the transform_feature method, which takes a single feature and transform it inplace.
- get_expected_status_in()#
Get the expected status before performing ROI extraction.
- Return type:
- get_expected_status_out()#
Get the expected status after performing ROI extraction.
- Return type:
- pydantic model tidyms2.core.operators.sample.RoiExtractor#
Bases:
SampleOperatorExtract ROIs from raw sample data.
- get_expected_status_in()#
Get the expected status before performing ROI extraction.
- Return type:
- get_expected_status_out()#
Get the expected status after performing ROI extraction.
- Return type:
- pydantic model tidyms2.core.operators.sample.RoiTransformer#
Bases:
SampleOperatorTransform ROIs from raw sample data.
Must implement the transform_roi method, which takes a single ROI and transform it inplace.
If transform_roi returns
None, the ROI is removed from the sample storage.- get_expected_status_in()#
Get the expected status before performing ROI extraction.
- Return type:
- get_expected_status_out()#
Get the expected status after performing ROI extraction.
- Return type:
Assay operators#
Abstract assay operators.
- pydantic model tidyms2.core.operators.assay.AnnotationPatcher#
Bases:
AssayOperatorPatches feature annotation data from an assay.
Must Implement the compute_patches method, which takes an assay storage and returns a list of patches that will be applied to the assay.
- abstractmethod compute_patches(data)#
Compute feature descriptor patches.
- Return type:
list[AnnotationPatch]
- get_expected_status_in()#
Get expected status of input data.
- Return type:
- get_expected_status_out()#
Get status of output data.
- Return type:
- pydantic model tidyms2.core.operators.assay.DescriptorPatcher#
Bases:
AssayOperatorPatches descriptor data from an assay.
Must Implement the compute_patches method, which takes an assay storage and returns a list of patches that will be applied to the assay.
- abstractmethod compute_patches(data)#
Compute feature descriptor patches.
- Return type:
list[DescriptorPatch]
- get_expected_status_in()#
Get expected status of input data.
- Return type:
- get_expected_status_out()#
Get status of output data.
- Return type:
- pydantic model tidyms2.core.operators.assay.MissingImputer#
Bases:
AssayOperatorAdd values that will be used as fill in missing data matrix entries.
Must Implement the add_fill_values method, which takes an assay storage and returns a list of fill values.
- abstractmethod compute_fill_values(data)#
Compute fill values in a sample.
- Parameters:
sample – the sample to search missing values
groups – the feature groups where the sample did not contribute a feature.
- Return type:
list[FillValue]
- get_expected_status_in()#
Get expected status of input data.
- Return type:
- get_expected_status_out()#
Get status of output data.
- Return type:
Matrix operators#
Abstract matrix operators.
- pydantic model tidyms2.core.operators.matrix.ColumnFilter#
Bases:
MatrixOperatorRemove data matrix features based on a specific condition.
MUST implement the method _create_remove_list that takes the data matrix and produce a list of feature groups to remove.
- field exclude: list[int] | None = None#
A list of feature groups to ignore during filtering.
- pydantic model tidyms2.core.operators.matrix.ColumnTransformer#
Bases:
MultiProcessTransformerTransform a data matrix columns based on an arbitrary transformation.
MUST implement the method _transform_column that takes a feature vector and creates a transformed vector.
- field exclude: list[int] | None = None#
A list of feature groups to ignore during filtering.
- pydantic model tidyms2.core.operators.matrix.MatrixOperator#
Bases:
BaseOperator[DataMatrixProcessStatus]Base operator for data matrix transformation.
- apply(data)#
Apply the operator function to the data.
- Return type:
None
- pydantic model tidyms2.core.operators.matrix.MatrixTransformer#
Bases:
MatrixOperatorApply an arbitrary transformation to a data matrix.
MUST implement transform_matrix which takes a data matrix and produces a 2D array that will replace the matrix data.
- pydantic model tidyms2.core.operators.matrix.RowFilter#
Bases:
MatrixOperatorRemove data matrix samples based on a specific condition.
MUST implement the method _create_remove_list that takes the data matrix and produce a list of feature groups to remove.
- field exclude: list[str] | None = None#
A list of sample ids to ignore during filtering.
- pydantic model tidyms2.core.operators.matrix.RowTransformer#
Bases:
MultiProcessTransformerTransform a data matrix rows based on an arbitrary transformation.
MUST implement the method _transform_row that takes a sample vector and creates a transformed vector.
- field exclude: list[str] | None = None#
A list of sample ids to exclude from the transformation