process

class amimspy.process.Scans(run, well, well_scans, id_snr, id_tol)[source]

Bases: object

The Scans class.

This class is used to extract high quality scan data from a given sample using a user defined method.

Parameters
  • run – Spectral data from multiple samples contained in a single *.mzML file

  • well – Well label as provided in the corresponding metadata *.txt file

  • well_scans – Scan IDs for all scans in a given well

  • id_snr – User provided SNR threshold for differentiating between on and off scans

  • id_tol – User provided number of features with SNR > id_snr to tolerate in off scans for labelling the scan type

peaklists(well_scans)[source]

Peak lists are generated for all scan IDs provided as input. The peak lists include the spectral data (mz, intensity, snr, flags) for each scan. The peak lists havea hard SNR filter applied to diffeentiate between scan types - this is set to 15 by default.

Parameters

method – well_scans: List of scan IDs from all scans in the given well.

Returns

List of peaklist objects

dictionary()[source]

A dictionary is generated using the scan IDs as keys and a binary identifier of the scan types as values (1 = ‘on-scan’ and 0 = ‘off-scan’). The scan type is dertemined by the number of features with SNR above the applied SNR, by default >3 features needed to be labelled as ‘on-scan’.

Returns

Dictionary object

padding()[source]

Converts the binary values in the dictionary to a string of binary values and adds padding (00) to either side. This padding enables on/off cycles to be identified at the start and end of each well.

:return String object

extract(method)[source]

Generates a dictionary of possible on/off scan cycles (as binary patterns) from AMI-MS data as keys and the indices of the scans within each cycle to be extracted for the user defined method. The dictionary is then used to search the AMI-MS data for the provided scan cycles and extract the scan IDs required for downstream processing by calling the relavent function for the defined method. The scan IDs are returned as a list object.

Parameters

method

Method to define which scans to extract data from. The following options are available:

  • all_scans - Extracts data from all scans from the given well.

  • on_scans - Extracts data from only the on scans from the given well.

  • off_scans - Extracts data from only the off scans from the given well.

  • on_scan_no_edge - Extracts data from only the on scans from the given well that are not immediately preceded or followed by an off-scan. For the unusual case of only two consecutive on scans, the single scan with the highest intensity is extracted. This is the default method.

Returns

List object