Adaptors

adaptors._parse_evidence_and_format_fixed_labels(data=None)

Reformats input params to pyQms compatible params. Additionally evidence files are read in and the fixed labels are reformatted (stripped from the modifications if peptides are read in) as required by pyQms. This is especially required if data/samples contains Carbamidomethylation as modification and the sample was e.g. 15N labeled. This ensures that the nitrogens pools of the peptides (which are 15N labeled) do not mix up with the nitrogen pool of the Carbamidomethylation (14N since intriduced during sample preparation). All fixed modifications needs to be specified so that is can be ignored from the input evidence file but correctly formatted for the parameters.

Example format:

{
    'molecules' : {'PEPTIDEA',...},
    'evidences' : {
        'C18H36O18N9' : {
            'PEPTIDEA' : {
                'evidences' : [
                    {
                        'RT':13.37,
                        'score':0.01,
                        'score_field':'PEP'
                    },
                    ...
                ],
                'trivial_names':[
                    'PROTEIN_NAME',
                    'PATHWAY_NAME',
                    ...
                ]
        },
    },
    'charges'   : {1,2,...},
    'params'    : {
        'MACHINE_OFFSET_IN_PPM':0,
        ...
    },

}

Example of data passed:

{
    'params': {'measurement_and_reporting': {'NAME': 'default'}},
    'fixed_labels': [
        {
            'modification': {
                'unimodID': '4',
                'specificity_sites': ['C'],
                'mono_mass': 57.021464,
                'element': {'O': 1, 'H': 3, 'N': 1, 'C': 2},
                'name': 'Carbamidomethyl'
            },
            'AA': 'C'
        }
    ],
    'molecules': 'AA',
    'metabolic_labels': [{'modification': '0, 0.99', 'atom': '15N'}],
    'charges': [1, 2, 3, 4, 5],
    'file': '/BSA1.mzML'
}

Returns:
dict: molecules, evidences, correctly fomatted fixed labels, charges and
    parameters
adaptors.parse_evidence(fixed_labels=None, evidence_files=None, molecules=None, evidence_score_field=None, return_raw_csv_data=False)

Reads in the evidence file and returns the final formatted fixed labels, the evidence lookup, which is passed to the isotopologue library and the final formatted molecules (fixed labels are stripped form the molecules).

Note

Output .csv files from Ursgal (Documentation) can directly be used. Also mzTab files can be used as input.

Parameters:
  • fixed_labels (dict) – dict with fixed labels, example format is shown below.
  • evidence_files (list) – list of evidence file paths.
  • molecules (list) – list of additional molecules
  • evidence_score_field (str) – specify fieldname which holds the search engine score (Default is “PEP”)

Example fixed label format:

{
    'C' : [
        {
            'element': {
                'O': 1,
                'H': 3,
                '14N': 1,
                'C': 2
            },
            'evidence_mod_name': 'Carbamidomethyl'
        },
    ]
}
Returns:final formatted fixed label dict, evidence lookup, list of molecules
Return type:tuple
adaptors.calc_amount_function(obj_for_calc_amount)

Calculates actual molecule amounts. Three types of amounts are calculated for a matched isotope chromatogram (MIC), maximum intensity, summed up intensity and area under curve. Additionally the score and the retention time at the maximum intensity are determined.

A test function exists to check correct amount determination.

Returned keys in amound dict:

  • ‘max I in window’
  • ‘max I in window (rt)’
  • ‘max I in window (score)’
  • ‘auc in window’
  • ‘sum I in window’
Returns:amount dict with keys shown above.
Return type:dict