mh_utils.worklist_parser.classes

Main classes for the worklist parser.

Classes:

Attribute(attribute_id, attribute_type, …)

Represents an Attribute.

Checksum(SchemaVersion, ALGO_VERSION, HASHCODE)

Represents a checksum for a worklist.

JobData(id, job_type, run_status[, sample_info])

Represents an entry in the worklist.

Macro(project_name, procedure_name, …)

Represents a macro in a worklist.

Worklist(version, locked_run_mode, …)

Class that represents an Agilent MassHunter worklist.

class Attribute(attribute_id, attribute_type, field_type, system_name, header_name, data_type, default_data_value, reorder_id, show_hide_status, column_width)[source]

Represents an Attribute.

Parameters
  • attribute_id (int)

  • attribute_type (AttributeType) – The attribute type identifier.

  • field_type (int) – The field type identifier.

  • system_name (str)

  • header_name (str)

  • data_type (int)

  • default_data_value (str)

  • reorder_id (int)

  • show_hide_status (Union[str, bool])

  • column_width (int) – end{multicols}

Attributes:

attribute_id

attribute_type

The attribute type identifier.

column_width

data_type

default_data_value

field_type

The field type identifier.

header_name

reorder_id

show_hide_status

system_name

Methods:

from_dict(d)

Construct an instance of Attribute from a dictionary.

from_xml(element)

Construct an Attribute object from an XML element.

to_dict([convert_values])

Returns a dictionary containing the contents of the Attribute object.

attribute_id

Type:    int

attribute_type

Type:    AttributeType

The attribute type identifier.

Can be System Defined (0), System Used (1), or User Added (2).

column_width

Type:    int

data_type

Type:    Any

default_data_value

Type:    str

field_type

Type:    int

The field type identifier.

Each of the system defined columns have a field type starting from sampleid = 0 to reserved6 = 24.

The system used column can be ‘compound param’ = 35, ‘optim param’ = 36, ‘mass param’ = 37 and ‘protein param’ = 38.

The User added columns start from 45.

classmethod from_dict(d)

Construct an instance of Attribute from a dictionary.

Parameters

d (Mapping[str, Any]) – The dictionary.

classmethod from_xml(element)[source]

Construct an Attribute object from an XML element.

Return type

Attribute

header_name

Type:    str

reorder_id

Type:    int

show_hide_status

Type:    bool

system_name

Type:    str

to_dict(convert_values=False)

Returns a dictionary containing the contents of the Attribute object.

Parameters

convert_values (bool) – Recursively convert values into dictionaries, lists etc. as appropriate. Default False.

Return type

MutableMapping[str, Any]

class Checksum(SchemaVersion, ALGO_VERSION, HASHCODE)[source]

Represents a checksum for a worklist.

The format of the checksum is unknown.

Parameters
  • SchemaVersion (int)

  • ALGO_VERSION (int)

  • HASHCODE (str)

Attributes:

ALGO_VERSION

HASHCODE

SchemaVersion

Methods:

from_dict(d)

Construct an instance of Checksum from a dictionary.

from_xml(element)

Construct a Checksum object from an XML element.

to_dict([convert_values])

Returns a dictionary containing the contents of the Checksum object.

ALGO_VERSION

Type:    int

HASHCODE

Type:    str

SchemaVersion

Type:    int

classmethod from_dict(d)

Construct an instance of Checksum from a dictionary.

Parameters

d (Mapping[str, Any]) – The dictionary.

classmethod from_xml(element)[source]

Construct a Checksum object from an XML element.

Return type

Checksum

to_dict(convert_values=False)

Returns a dictionary containing the contents of the Checksum object.

Parameters

convert_values (bool) – Recursively convert values into dictionaries, lists etc. as appropriate. Default False.

Return type

MutableMapping[str, Any]

class JobData(id, job_type, run_status, sample_info=None)[source]

Bases: Dictable

Represents an entry in the worklist.

Parameters
  • id (Union[str, UUID]) – The ID of the job.

  • job_type (int) – The type of job. TODO: enum of values

  • run_status (int) – The status of the analysis. TODO: enum of values

  • sample_info (Optional[dict]) – Optional key: value mapping of information about the sample. Default None.

Methods:

from_xml(element[, user_columns])

Construct a JobData object from an XML element.

classmethod from_xml(element, user_columns=None)[source]

Construct a JobData object from an XML element.

Parameters
  • element (ObjectifiedElement) – The XML element to parse the data from

  • user_columns (Optional[Dict[str, Column]]) – Optional mapping of user column labels to Column objects. Default None.

Return type

JobData

class Macro(project_name, procedure_name, input_parameter, output_data_type, output_parameter, display_string)[source]

Represents a macro in a worklist.

Parameters
  • project_name (str)

  • procedure_name (str)

  • input_parameter (str)

  • output_data_type (int)

  • output_parameter (str) –

    .

  • display_string (str)

Attributes:

display_string

input_parameter

output_data_type

output_parameter

procedure_name

project_name

undefined

Returns whether the macro is undefined.

Methods:

from_dict(d)

Construct an instance of Macro from a dictionary.

from_xml(element)

Construct a Macro object from an XML element.

to_dict([convert_values])

Returns a dictionary containing the contents of the Macro object.

display_string

Type:    str

classmethod from_dict(d)

Construct an instance of Macro from a dictionary.

Parameters

d (Mapping[str, Any]) – The dictionary.

classmethod from_xml(element)[source]

Construct a Macro object from an XML element.

Return type

Macro

input_parameter

Type:    str

output_data_type

Type:    int

output_parameter

Type:    str

procedure_name

Type:    str

project_name

Type:    str

to_dict(convert_values=False)

Returns a dictionary containing the contents of the Macro object.

Parameters

convert_values (bool) – Recursively convert values into dictionaries, lists etc. as appropriate. Default False.

Return type

MutableMapping[str, Any]

property undefined

Returns whether the macro is undefined.

Return type

bool

class Worklist(version, locked_run_mode, instrument_name, params, user_columns, jobs, checksum)[source]

Bases: XMLFileMixin, Dictable

Class that represents an Agilent MassHunter worklist.

Parameters
  • version (float) – WorklistInfo version number

  • locked_run_mode (bool) – Flag to indicate whether the data was acquired in locked mode. Yes = -1. No = 0.

  • instrument_name (str) – The name of the instrument.

  • params (dict) – Mapping of parameter names to values. TODO: Check

  • user_columns (dict) – Mapping of user columns to ??? TODO

  • jobs (Sequence[JobData])

  • checksum (Checksum) – The checksum of the worklist file. The format is unknown.

Methods:

__repr__()

Return a string representation of the Worklist.

as_dataframe()

Returns the Worklist as a pandas.DataFrame.

from_xml(element)

Construct a Worklist object from an XML element.

__repr__()[source]

Return a string representation of the Worklist.

Return type

str

as_dataframe()[source]

Returns the Worklist as a pandas.DataFrame.

Return type

DataFrame

classmethod from_xml(element)[source]

Construct a Worklist object from an XML element.

Return type

Worklist