MSDataOutput
- class MSDataOutput.MSDataOutput(output_directory, input_file_path, result_name='Results', logger=None, ingui=True)
A class to describe the general setup for Data Output.
- Parameters:
output_directory (str) – directory path to output the data
input_file_path (str) – file path of the input MRM transition name file. To be used for the output filename
logger (object) – logger object created by start_logger in MSOrganiser
ingui (bool) – if True, print analysis status to screen
- transpose_MSdata(allow_multiple_istd=False)
Function to transpose data
- Parameters:
MS_df (pandas DataFrame) – A panda data frame
allow_multiple_istd (bool) – if True, display the Transition_Name_ISTD as well besides the Transition_Name
- Returns:
MS_df (pandas DataFrame) – A panda data frame with data transposed
- start_writer()
Function to open a writer object
- df_to_file_preparation(df, transpose=False, logger=None, ingui=False, allow_multiple_istd=False)
Function to check and set up the settings needed before writing to a file.
- Parameters:
output_option (str) – the Output_Options value given to MSOrganiser.
df (pandas DataFrame) – A panda data frame to output
transpose (bool) – if True, transpose the dataframe first before writing to the Excel sheet
logger (object) – logger object created by start_logger in MSOrganiser
ingui (bool) – if True, print analysis status to screen
allow_multiple_istd (bool) – if True, display the Transition_Name_ISTD as well besides the Transition_Name
- Returns:
(list) –
list containing:
df (pandas DataFrame): A panda data frame to output. Transposed if transpose is set to True
output_option (str): Updated output options if changes are required E.g S/N to S_to_N
- df_to_file(output_option, df, transpose=False, allow_multiple_istd=False)
Funtion to write a df to a csv file named {input file name}_{output_option}_{result filename}.csv .
- Parameters:
output_option (str) – the name of the result csv file. MSOrganiser puts it as the Output_Options value
df (pandas DataFrame) – A panda data frame to output to csv
transpose (bool) – if True, transpose the dataframe first before writing to the Excel sheet
allow_multiple_istd (bool) – if True, display the Transition_Name_ISTD as well besides the Transition_Name
Note
For the output option S/N, it will be changed to S_to_N as filenames does not accept slashes. This is done in the function df_to_file_preparation
- class MSDataOutput.MSDataOutput_csv(output_directory, input_file_path, result_name='Results', logger=None, ingui=True)
A class to describe the general setup for Data Output to csv.
- Parameters:
output_directory (str) – directory path to output the data
input_file_path (str) – file path of the input MRM transition name file. To be used for the output filename
logger (object) – logger object created by start_logger in MSOrganiser
ingui (bool) – if True, print analysis status to screen
- df_to_file(output_option, df, transpose=False, allow_multiple_istd=False)
Funtion to write a df to an excel file.
- Parameters:
output_option (str) – the name of the sheet
df (pandas DataFrame) – A panda data frame to output to Excel
transpose (bool) – if True, transpose the dataframe first before writing to the Excel sheet
allow_multiple_istd (bool) – if True, display the Transition_Name_ISTD as well besides the Transition_Name
Note
For the output option S/N, it will be changed to S_to_N as excel does not accept slashes. This is done in the function df_to_file_preparation
- class MSDataOutput.MSDataOutput_Excel(output_directory, input_file_path, result_name='Results', logger=None, ingui=True)
A class to describe the general setup for Data Output to Excel.
- Parameters:
output_directory (str) – directory path to output the data
input_file_path (str) – file path of the input MRM transition name file. To be used for the output filename
logger (object) – logger object created by start_logger in MSOrganiser
ingui (bool) – if True, print analysis status to screen
- start_writer()
Function to open an Excel writer object using openpyxl
- end_writer(testing=False)
Function to close an Excel writer object
- df_to_file(output_option, df, transpose=False, allow_multiple_istd=False)
Funtion to write a df to an excel file.
- Parameters:
output_option (str) – the name of the sheet
df (pandas DataFrame) – A panda data frame to output to Excel
transpose (bool) – if True, transpose the dataframe first before writing to the Excel sheet
allow_multiple_istd (bool) – if True, display the Transition_Name_ISTD as well besides the Transition_Name
Note
For the output option S/N, it will be changed to S_to_N as excel does not accept slashes. This is done in the function df_to_file_preparation