MSAnalysis

class MSAnalysis.MS_Analysis(MS_FilePath=None, MS_FilePaths=[], MS_FileType=None, Annotation_FilePath=None, logger=None, ingui=True, longtable=False, longtable_annot=False)

A class to set up the right configurations before performing data analysis

Parameters:
  • MS_FilePath (str) – File path of the input MRM transition name file

  • MS_FilePaths (str) – File paths of the input MRM transition name file (multiple)

  • MS_FileType (str) – File type of the input MRM transition name file

  • Annotation_FilePath (str) – The file path to the MS Template Creator annotation file if provided

  • Area_df (pandas DataFrame) – A data frame of sample as rows and transition names as columns with area as values

  • logger (object) – logger object created by start_logger in MSOrganiser

  • ingui (bool) – if True, print analysis status to screen

  • longtable (bool) – if True, prepare a dataframe to store results in long table

  • longtable_annot (bool) – if True, prepare a dataframe to store annotation details in long table

get_Long_Table(allow_multiple_istd=False, concatenation_type=None)

Function to get the long table of the extracted or calculated MRM transition name data.

Parameters:
  • allow_multiple_istd (bool) – if True, allow Transition_Annot data by to have mulitple internal standards (in development)

  • concatenation_type (str) – “rows or columns or None” to indicate if how Sample_Annot should be cleaned before merging with the Long_Table.

Returns:

Output_df (pandas DataFrame) – A long data frame of with column name Sample_Name, Transition_Name and other relevant data

get_from_Input_Data(column_name, outputdata=True, allow_multiple_istd=False)

Function to get a specific column from the input MRM transition name data.

Parameters:
  • column_name (str) – The name of the column given in the Output_Options.

  • outputdata (bool) – if True, return the results as a pandas dataframe. Else, nothing is returned

  • allow_multiple_istd (bool) – if True, allow normalisation of peak area by mulitple internal standards which leads to an expansion of the Output_df

Returns:

Output_df (pandas DataFrame) – A data frame of sample as rows and transition names as columns with values from the chosen column name

get_Normalised_Area(analysis_name, outputdata=True, allow_multiple_istd=False, using_multiple_input_files=False, concatenation_type='rows')

Function to calculate the normalised area from the input MRM transition name data and MS Template Creator annotation file.

Parameters:
  • analysis_name (str) – The name of the column given in the Output_Options. Should be “normArea by ISTD”

  • outputdata (bool) – if True, return the results as a pandas dataframe. Else, nothing is returned

  • allow_multiple_istd (bool) – if True, allow normalisation of peak area by mulitple internal standards (in development)

  • using_multiple_input_files (bool) – if True, the Area df will be constructed from multiple input files, denoted in MS_FilePaths (in development)

  • concatenation_type (str) – “rows or columns” to indicate if the Area_df is to be concatenated by row wise or column wise respectively

Returns:

(list)

list containing:

  • norm_Area_df (pandas DataFrame): A data frame of sample as rows and transition names as columns with the normalised area as values

  • ISTD_Area (pandas DataFrame): A data frame of sample as rows and transition names as columns with the ISTD area as values. Output as excel only at testing mode

  • ISTD_map_df (pandas DataFrame): A data frame of showing the transition names annotation

  • ISTD_Report (pandas DataFrame): A data frame of with transition names, its corresponding ISTD as columns. This will be converted to a pdf file page

get_Analyte_Concentration(analysis_name, outputdata=True, allow_multiple_istd=False, using_multiple_input_files=False, concatenation_type='rows')

Function to calculate the transition names concentration from the input MRM transition name data and MS Template Creator annotation file.

Parameters:
  • analysis_name (str) – The name of the column given in the Output_Options. Should be “normConc by ISTD”

  • outputdata (bool) – if True, return the results as a pandas dataframe. Else, nothing is returned

  • allow_multiple_istd (bool) – if True, allow normalisation of peak area by mulitple internal standards

  • using_multiple_input_files (bool) – if True, the Area df will be constructed from multiple input files, denoted in MS_FilePaths (in development)

  • concatenation_type (str) – “rows or columns” to indicate if the Area_df is to be concatenated by row wise or column wise respectively

Returns:

(list)

list containing:

  • norm_Conc_df (pandas DataFrame): A data frame of sample as rows and transition names as columns with the transition name concentration as values

  • ISTD_Conc_df (pandas DataFrame): A data frame of sample as rows and transition names as columns with the ISTD concentration as values

  • ISTD_Samp_Ratio_df (pandas DataFrame): A data frame of with transition names, its corresponding ISTD and ISTD to Sample ratio as columns

  • Sample_Annot_df (pandas DataFrame): A data frame showing the samples annotation