FeatureMap#
- class pyopenms.FeatureMap(*args, **kwargs)#
Bases:
FeatureMap- __init__(*args, **kwargs)#
Overload:
- __init__(self) None
Overload:
- __init__(self, in_0: FeatureMap) None
Methods
__init__(*args, **kwargs)Overload:
Overload:
clearMetaInfo(self)Removes all meta values
clearRanges(self)Resets all range dimensions as empty
clearUniqueId(self)Clear the unique id.
ensureUniqueId(self)Assigns a valid unique id, but only if the present one is invalid.
getDataProcessing(self)getIdentifier(self)Retrieve document identifier (e.g.
getKeys(self, keys)Fills the given vector with a list of all keys for which a value is set
getLoadedFilePath(self)Returns the file_name which is the absolute path to the file loaded
getLoadedFileType(self)Returns the file_type (e.g.
getMaxIntensity(self)Returns the maximum intensity
getMaxMZ(self)Returns the maximum m/z
getMaxRT(self)Returns the maximum RT
getMetaValue(self, in_0)Returns the value corresponding to a string, or
getMinIntensity(self)Returns the minimum intensity
getMinMZ(self)Returns the minimum m/z
getMinRT(self)Returns the minimum RT
getPrimaryMSRunPath(self, toFill)Returns the file path to the first MS run
getUniqueId(self)Returns the unique id
Generates a list with peptide identifications assigned to a feature.
get_df([meta_values, ...])Generates a pandas DataFrame with information contained in the FeatureMap.
hasInvalidUniqueId(self)Returns whether the unique id is invalid.
hasValidUniqueId(self)Returns whether the unique id is valid.
isMetaEmpty(self)Returns if the MetaInfo is empty
isValid(self, unique_id)Returns true if the unique_id is valid, false otherwise
metaRegistry(self)Returns a reference to the MetaInfoRegistry
metaValueExists(self, in_0)Returns whether an entry with the given name exists
Overload:
removeMetaValue(self, in_0)Removes the DataValue corresponding to name if it exists
setDataProcessing(self, in_0)Sets the description of the applied data processing
setIdentifier(self, id)Sets document identifier (e.g.
setLoadedFilePath(self, file_name)Sets the file_name according to absolute path of the file loaded, preferably done whilst loading
setLoadedFileType(self, file_name)Sets the file_type according to the type of the file loaded from, preferably done whilst loading
setMetaValue(self, in_0, in_1)Sets the DataValue corresponding to a name
Overload:
setProteinIdentifications(self, in_0)Sets the protein identifications
setUnassignedPeptideIdentifications(self, in_0)Sets the unassigned peptide identifications
setUniqueId(self, rhs)Assigns a new, valid unique id.
size(self)Overload:
sortByMZ(self)Sorts features by m/z position
sortByOverallQuality(self)Sorts features by ascending overall quality.
sortByPosition(self)Sorts features by position.
sortByRT(self)Sorts features by RT position
swap(self, in_0)swapFeaturesOnly(self, swapfrom)Swaps the feature content (plus its range information) of this map
updateRanges(self)- clear()#
Overload:
- clear(self) None
Clears all data and meta data
Overload:
- clear(self, clear_meta_data: bool) None
Clears all data and meta data. If ‘true’ is passed as an argument, all meta data is cleared in addition to the data
- clearMetaInfo(self) None#
Removes all meta values
- clearRanges(self) None#
Resets all range dimensions as empty
- clearUniqueId(self) int#
Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise
- ensureUniqueId(self) int#
Assigns a valid unique id, but only if the present one is invalid. Returns 1 if the unique id was changed, 0 otherwise
- getDataProcessing(self) List[DataProcessing]#
- getKeys(self, keys: List[bytes]) None#
Fills the given vector with a list of all keys for which a value is set
- getLoadedFilePath(self) bytes | str | String#
Returns the file_name which is the absolute path to the file loaded
- getLoadedFileType(self) int#
Returns the file_type (e.g. featureXML, consensusXML, mzData, mzXML, mzML, …) of the file loaded
- getMaxIntensity(self) float#
Returns the maximum intensity
- getMaxMZ(self) float#
Returns the maximum m/z
- getMaxRT(self) float#
Returns the maximum RT
- getMetaValue(self, in_0: bytes | str | String) int | float | bytes | str | List[int] | List[float] | List[bytes]#
Returns the value corresponding to a string, or
- getMinIntensity(self) float#
Returns the minimum intensity
- getMinMZ(self) float#
Returns the minimum m/z
- getMinRT(self) float#
Returns the minimum RT
- getPrimaryMSRunPath(self, toFill: List[bytes]) None#
Returns the file path to the first MS run
- getProteinIdentifications(self) List[ProteinIdentification]#
- getUnassignedPeptideIdentifications(self) List[PeptideIdentification]#
- getUniqueId(self) int#
Returns the unique id
- get_assigned_peptide_identifications()#
Generates a list with peptide identifications assigned to a feature.
Adds ‘ID_native_id’ (feature spectrum id), ‘ID_filename’ (primary MS run path of corresponding ProteinIdentification) and ‘feature_id’ (unique ID of corresponding Feature) as meta values to the peptide hits. A DataFrame from the assigned peptides generated with peptide_identifications_to_df(assigned_peptides) can be merged with the FeatureMap DataFrame with: merged_df = _pd.merge(feature_df, assigned_peptide_df, on=[‘feature_id’, ‘ID_native_id’, ‘ID_filename’])
Returns: [PeptideIdentification]: list of PeptideIdentification objects
- get_df(meta_values: None | List[str] | str = None, export_peptide_identifications: bool = True)#
Generates a pandas DataFrame with information contained in the FeatureMap.
Optionally the feature meta values and information for the assigned PeptideHit can be exported.
Parameters: meta_values: meta values to include (None, [custom list of meta value names] or ‘all’)
export_peptide_identifications (bool): export sequence and score for best PeptideHit assigned to a feature. Additionally the ID_filename (file name of the corresponding ProteinIdentification) and the ID_native_id (spectrum ID of the corresponding Feature) are exported. They are also annotated as meta values when collecting all assigned PeptideIdentifications from a FeatureMap with FeatureMap.get_assigned_peptide_identifications(). A DataFrame from the assigned peptides generated with peptide_identifications_to_df(assigned_peptides) can be merged with the FeatureMap DataFrame with: merged_df = pd.merge(feature_df, assigned_peptide_df, on=[‘feature_id’, ‘ID_native_id’, ‘ID_filename’])
Returns: pandas.DataFrame: feature information stored in a DataFrame
- hasInvalidUniqueId(self) int#
Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise
- hasValidUniqueId(self) int#
Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise
- isMetaEmpty(self) bool#
Returns if the MetaInfo is empty
- isValid(self, unique_id: int) bool#
Returns true if the unique_id is valid, false otherwise
- metaRegistry(self) MetaInfoRegistry#
Returns a reference to the MetaInfoRegistry
- metaValueExists(self, in_0: bytes | str | String) bool#
Returns whether an entry with the given name exists
- push_back()#
Overload:
- push_back(self, spec: Feature) None
Overload:
- push_back(self, spec: MRMFeature) None
- removeMetaValue(self, in_0: bytes | str | String) None#
Removes the DataValue corresponding to name if it exists
- setDataProcessing(self, in_0: List[DataProcessing]) None#
Sets the description of the applied data processing
- setLoadedFilePath(self, file_name: bytes | str | String) None#
Sets the file_name according to absolute path of the file loaded, preferably done whilst loading
- setLoadedFileType(self, file_name: bytes | str | String) None#
Sets the file_type according to the type of the file loaded from, preferably done whilst loading
- setMetaValue(self, in_0: bytes | str | String, in_1: int | float | bytes | str | List[int] | List[float] | List[bytes]) None#
Sets the DataValue corresponding to a name
- setPrimaryMSRunPath()#
Overload:
- setPrimaryMSRunPath(self, s: List[bytes]) None
Sets the file path to the primary MS run (usually the mzML file obtained after data conversion from raw files)
Overload:
- setPrimaryMSRunPath(self, s: List[bytes], e: MSExperiment) None
Sets the file path to the primary MS run using the mzML annotated in the MSExperiment argument e
- setProteinIdentifications(self, in_0: List[ProteinIdentification]) None#
Sets the protein identifications
- setUnassignedPeptideIdentifications(self, in_0: List[PeptideIdentification]) None#
Sets the unassigned peptide identifications
- setUniqueId(self, rhs: int) None#
Assigns a new, valid unique id. Always returns 1
- setUniqueIds()#
- size(self) int#
- sortByIntensity()#
Overload:
- sortByIntensity(self) None
Sorts the peaks according to ascending intensity
Overload:
- sortByIntensity(self, reverse: bool) None
Sorts the peaks according to ascending intensity. Order is reversed if argument is true ( reverse = true )
- sortByMZ(self) None#
Sorts features by m/z position
- sortByOverallQuality(self) None#
Sorts features by ascending overall quality. Order is reversed if argument is true ( reverse = true )
- sortByPosition(self) None#
Sorts features by position. Lexicographical comparison (first RT then m/z) is done
- sortByRT(self) None#
Sorts features by RT position
- swap(self, in_0: FeatureMap) None#
- swapFeaturesOnly(self, swapfrom: FeatureMap) None#
Swaps the feature content (plus its range information) of this map
- updateRanges(self) None#