pyms.Experiment

Models a GC-MS experiment, represented by a list of signal peaks.

Classes:

Experiment(expr_code, peak_list)

Models an experiment.

Functions:

load_expr(file_name)

Loads an experiment saved with pyms.Experiment.Experiment.dump().

read_expr_list(file_name)

Reads the set of experiment files and returns a list of pyms.Experiment.Experiment objects.

class Experiment(expr_code, peak_list)[source]

Bases: pymsBaseClass

Models an experiment.

Parameters
  • expr_code (str) – A unique identifier for the experiment.

  • peak_list (Sequence[Peak])

Author

Vladimir Likic, Andrew Isaac, Dominic Davis-Foster (type assertions, properties and pathlib support)

Methods:

__copy__()

Returns a new Experiment object containing a copy of the data in this object.

__deepcopy__([memodict])

Returns a new Experiment object containing a copy of the data in this object.

__eq__(other)

Return whether this Experiment object is equal to another object.

__len__()

Returns the number of peaks in the Experiment.

dump(file_name[, protocol])

Dumps an object to a file through pickle.dump().

sele_rt_range(rt_range)

Discards all peaks which have the retention time outside the specified range.

Attributes:

expr_code

Returns the expr_code of the experiment.

peak_list

Returns the peak list.

__copy__()[source]

Returns a new Experiment object containing a copy of the data in this object.

Return type

Experiment

__deepcopy__(memodict={})[source]

Returns a new Experiment object containing a copy of the data in this object.

Return type

Experiment

__eq__(other)[source]

Return whether this Experiment object is equal to another object.

Parameters

other – The other object to test equality with.

Return type

bool

__len__()[source]

Returns the number of peaks in the Experiment.

Return type

int

dump(file_name, protocol=3)

Dumps an object to a file through pickle.dump().

Parameters
  • file_name (Union[str, Path, PathLike]) – Filename to save the dump as.

  • protocol (int) – The pickle protocol to use. Default 3.

Authors

Vladimir Likic, Dominic Davis-Foster (pathlib and pickle protocol support)

property expr_code

Returns the expr_code of the experiment.

Return type

str

property peak_list

Returns the peak list.

Return type

List[Peak]

sele_rt_range(rt_range)[source]

Discards all peaks which have the retention time outside the specified range.

Parameters

rt_range (Sequence[str]) – Min, max retention time given as a sequence [rt_min, rt_max].

load_expr(file_name)[source]

Loads an experiment saved with pyms.Experiment.Experiment.dump().

Parameters

file_name (Union[str, Path, PathLike]) – Experiment file name.

Return type

Experiment

Returns

The loaded experiment.

Author

Vladimir Likic, Andrew Isaac, Dominic Davis-Foster (type assertions and pathlib support)

read_expr_list(file_name)[source]

Reads the set of experiment files and returns a list of pyms.Experiment.Experiment objects.

Parameters

file_name (Union[str, Path, PathLike]) – The name of the file which lists experiment dump file names, one file per line.

Return type

List[Experiment]

Returns

A list of Experiment instances.

Author

Vladimir Likic