OpenMSToffee: Python

Working with toffee files

Calculating RT normalisation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 $ toffee_openms_rt_normalisation --help
 usage: toffee_openms_rt_normalisation [-h]
                                       toffee_filename alignment_filename
                                       transformation_xml_filename

 Calculate the retention time normalisation for a toffee file using OpenMS as
 the wrapper

 positional arguments:
   toffee_filename       The output filename (*.tof)
   alignment_filename    The input alignment library (iRT) filename (*.tsv)
   transformation_xml_filename
                         The output transformation XML file (*.trafoXML)

 optional arguments:
   -h, --help            show this help message and exit

Converting SRLs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 $ srl_peakview_to_openms --help
 usage: srl_peakview_to_openms [-h] [-output_dir OUTPUT_DIR]
                               [-minimum_number_of_transitions MINIMUM_NUMBER_OF_TRANSITIONS]
                               [-maximum_number_of_transitions MAXIMUM_NUMBER_OF_TRANSITIONS]
                               [-mz_cutoff MZ_CUTOFF]
                               [-precursor_product_limit PRECURSOR_PRODUCT_LIMIT]
                               [--drop_modifications] [--make_pqp]
                               [--keep_intermediate_files] [--debug]
                               sciex_filename

 Convert a Sciex ProteinPilot/PeakView/OneOmics SRL into a format that can be
 used by OpenMS

 positional arguments:
   sciex_filename        The input filename (*.txt)

 optional arguments:
   -h, --help            show this help message and exit
   -output_dir OUTPUT_DIR
                         The directory to save the output files. By default it
                         will be the same as the input file.
   -minimum_number_of_transitions MINIMUM_NUMBER_OF_TRANSITIONS
                         Define the minimum number of transitions for any PSM
   -maximum_number_of_transitions MAXIMUM_NUMBER_OF_TRANSITIONS
                         Define the maximum number of transitions for any PSM
   -mz_cutoff MZ_CUTOFF  Filter out any precursor ions with a mass over charge
                         below this threshold
   -precursor_product_limit PRECURSOR_PRODUCT_LIMIT
                         Filter out any product ions with a mass over charge
                         with this many Da of the precursor ion
   --drop_modifications  Remove all modifications from the final SRL
   --make_pqp            Create the new PQP sqlite format in addition the TSV
   --keep_intermediate_files
                         Remove intermediate files that were created
   --debug               Switch on more detailed logging

Internal Class Structure

OpenMSToffee.log.set_stream_logger(name='OpenMSToffee', level=20, format_string=None, fname=None)

Add a stream handler for the given name and level to the logging module. By default, this logs all boto3 messages to stdout.

>>> import OpenMSToffee as omt
>>> omt.log.set_stream_logger(name='OpenMSToffee', level=logging.INFO)
Parameters:
  • name (string) – Log name
  • level (int) – Logging level, e.g. logging.INFO
  • format_string (str) – Log message format
class OpenMSToffee.srl_peakview_to_openms.OpenSwathLibraryFromPeakview(peakview_fname, output_basename=None, output_dir='', minimum_number_of_transitions=3, maximum_number_of_transitions=6, mz_cutoff=400.0, precursor_product_limit=10.0, modifications_to_keep='CAM', make_pqp=False, clean_up_files=True, debug=True)

Convert SRL file formats between PeakView and OpenMS. Furthermore, run the decoy generation on the OpenMS data once it has been generated

DROP_TEXT = 'DROP'
OPENSWATH_INDEX_COLS = ['TransitionGroupId']
OPENSWATH_SORT_ASCENDING = [True, False]
OPENSWATH_SORT_COLS = ['TransitionGroupId', 'LibraryIntensity']
PEAKVIEW_HEADERS = ['Q1', 'Q3', 'iRT', 'stripped_sequence', 'relative_intensity', 'uniprot_id', 'modification_sequence', 'prec_z', 'frg_type', 'frg_z', 'frg_nr']
PEAKVIEW_RTCAL_PROTEIN = '[ RT-Cal protein ]'
PV_TO_OS_COL_MAPPING = {'Annotation': 'Annotation', 'CE': 'CollisionEnergy', 'Decoy': 'Decoy', 'PeptideGroupLabel': 'PeptideGroupLabel', 'ProteinId': 'ProteinId', 'Q1': 'PrecursorMz', 'Q3': 'ProductMz', 'TransitionGroupId': 'TransitionGroupId', 'TransitionId': 'TransitionId', 'frg_nr': 'FragmentSeriesNumber', 'frg_type': 'FragmentType', 'frg_z': 'ProductCharge', 'iRT': 'NormalizedRetentionTime', 'modification_sequence': 'ModifiedPeptideSequence', 'prec_z': 'PrecursorCharge', 'relative_intensity': 'LibraryIntensity', 'stripped_sequence': 'PeptideSequence', 'uniprot_id': 'UniprotId'}
convert()
convert_peakview_to_openswath(df)

Internal class method, exposed only for testing

classmethod create_calibration(df_irt, basename)

Internal class method, exposed only for testing

create_decoys(df_library, basename)

Internal class method, exposed only for testing

filter_and_normalise_openswath(df)

Internal class method, exposed only for testing

open_peak_view()

Internal class method, exposed only for testing

remove_minimum_fragments(df)

Internal class method, exposed only for testing

rename_modifications(mod_peptide_col)

Internal class method, exposed only for testing. Convert the modification format of PeakView into UniMod format

classmethod split_to_srl_and_alignment(df)

Internal class method, exposed only for testing