Sample#

class pyopenms.Sample#

Bases: MetaInfoInterface

Meta information about the sample

__init__() → None#
__init__(arg: pyopenms.Sample, /) → None

Methods

__init__()

clearMetaInfo()

Removes all meta values

getAllNamesOfSampleState()

Returns all sample state names known to OpenMS

getComment()

Returns the comment (default "")

getConcentration()

Returns the concentration (in g/l) (default 0.0)

getKeys(keys)

Fills the given list with all meta value keys

getMass()

Returns the mass (in gram) (default 0.0)

getMetaValue(name)

Returns the value corresponding to a string, or DataValue::EMPTY if not found

getMetaValues()

Returns all meta values as a dictionary of {name: value}

getName()

getNumber()

Returns the sample number

getOrganism()

getState()

Returns the state of aggregation (default SAMPLENULL)

getSubsamples()

Returns a copy of the vector of subsamples that were combined to create this sample

getVolume()

Returns the volume (in ml) (default 0.0)

isMetaEmpty()

Returns if the MetaInfo is empty

metaRegistry()

Returns a reference to the MetaInfoRegistry

metaValueExists(name)

Returns whether an entry with the given name exists

removeMetaValue(name)

Removes the DataValue corresponding to name if it exists

sampleStateToString(state)

Convert a SampleState enum to string.

setComment(comment)

Sets the comment (may contain newline characters)

setConcentration(concentration)

Sets the concentration (in g/l)

setMass(mass)

Sets the mass (in gram)

setMetaValue(name, value)

Sets the DataValue corresponding to a name

setMetaValues(values)

Sets multiple meta values from a dictionary of {name: value}

setName(name)

setNumber(number)

Sets the sample number (e.g. sample ID).

setOrganism(organism)

setState(state)

Sets the state of aggregation

setSubsamples(subsamples)

Sets the vector of subsamples that were combined to create this sample

setVolume(volume)

Sets the volume (in ml)

toSampleState(name)

Convert a string to SampleState enum.

class SampleState(*values)#

Bases: Enum

EMULSION = 5#
GAS = 3#
LIQUID = 2#
SAMPLENULL = 0#
SIZE_OF_SAMPLESTATE = 7#
SOLID = 1#
SOLUTION = 4#
SUSPENSION = 6#
getMapping()#

Returns a dict mapping int values to enum member name strings.

clearMetaInfo() → None#

Removes all meta values

static getAllNamesOfSampleState() → list[str]#

Returns all sample state names known to OpenMS

getComment() → str#

Returns the comment (default “”)

getConcentration() → float#

Returns the concentration (in g/l) (default 0.0)

getKeys(keys: list) → None#

Fills the given list with all meta value keys

getMass() → float#

Returns the mass (in gram) (default 0.0)

getMetaValue(name: str) → None | int | float | str | bytes | list[str] | list[int] | list[float]#
getMetaValue(name: str, default_value: None | int | float | str | bytes | list[str] | list[int] | list[float]) → None | int | float | str | bytes | list[str] | list[int] | list[float]
getMetaValue(index: int) → None | int | float | str | bytes | list[str] | list[int] | list[float]
getMetaValue(index: int, default_value: None | int | float | str | bytes | list[str] | list[int] | list[float]) → None | int | float | str | bytes | list[str] | list[int] | list[float]

Returns the value corresponding to a string, or DataValue::EMPTY if not found

getMetaValues() → dict#

Returns all meta values as a dictionary of {name: value}

getName() → str#
getNumber() → str#

Returns the sample number

getOrganism() → str#
getState() → pyopenms.Sample.SampleState#

Returns the state of aggregation (default SAMPLENULL)

getSubsamples() → list[pyopenms.Sample]#

Returns a copy of the vector of subsamples that were combined to create this sample

getVolume() → float#

Returns the volume (in ml) (default 0.0)

isMetaEmpty() → bool#

Returns if the MetaInfo is empty

static metaRegistry() → pyopenms.MetaInfoRegistry#

Returns a reference to the MetaInfoRegistry

metaValueExists(name: str) → bool#
metaValueExists(index: int) → bool

Returns whether an entry with the given name exists

removeMetaValue(name: str) → None#
removeMetaValue(index: int) → None

Removes the DataValue corresponding to name if it exists

static sampleStateToString(state: pyopenms.Sample.SampleState) → str#

Convert a SampleState enum to string. Throws Exception::InvalidValue if state is SIZE_OF_SAMPLESTATE

setComment(comment: str) → None#

Sets the comment (may contain newline characters)

setConcentration(concentration: float) → None#

Sets the concentration (in g/l)

setMass(mass: float) → None#

Sets the mass (in gram)

setMetaValue(name: str, value: None | int | float | str | bytes | list[str] | list[int] | list[float]) → None#
setMetaValue(index: int, value: None | int | float | str | bytes | list[str] | list[int] | list[float]) → None

Sets the DataValue corresponding to a name

setMetaValues(values: dict) → None#

Sets multiple meta values from a dictionary of {name: value}

setName(name: str) → None#
setNumber(number: str) → None#

Sets the sample number (e.g. sample ID)

setOrganism(organism: str) → None#
setState(state: pyopenms.Sample.SampleState) → None#

Sets the state of aggregation

setSubsamples(subsamples: collections.abc.Sequence[pyopenms.Sample]) → None#

Sets the vector of subsamples that were combined to create this sample

setVolume(volume: float) → None#

Sets the volume (in ml)

static toSampleState(name: str) → pyopenms.Sample.SampleState#

Convert a string to SampleState enum. Throws Exception::InvalidValue if name is not found