Chapter 3 MS2 preprocessing targeted

Please copy the template of excel file which fits your data LCMS_library_template1.xlsx or LCMS_library_template2.xlsx under the folder J:\CBMR\SUN-CBMR-Metabolomics\Workflow\utils\utils_MS2_preprocessing\LCMS_library_template.xlsx and fill in the information related to the standards which you would like to preprocess. You must fill the columns with the column name in red color. Regarding the filled filenames, they are without extension

3.1 XCMS_check retention time

Check if the retention time of each standard from MS2 is similar to that from MS1

The script 2b.Pipeline_XCMS_checkRT.R is available under the folder of J:\CBMR\SUN-CBMR-Metabolomics\Workflow\Script\modules\MS2_preprocessing

3.1.1 Source paths on the server

source("H:/From_SUND/Scripts/utils/utils_MS2_set_up/set_up_paths.R")

3.1.2 Provide polarity πŸ•΅

polarity <- "POS"

3.1.3 Path of storing .mzML files without filenames πŸ•΅

path_files_mzML <- "H:/From_SUND/Scripts/test/MS2pos_target/mzML_openms_MS2_POS"

3.1.4 Path of storing outputs πŸ•΅

path_outputs <- "H:/From_SUND/Scripts/outputs"

3.1.5 Filename for containing information of standards including absolute path (Please fill in the provided template) as well as the sheet name πŸ•΅

xlsx_std_info <- "H:/From_SUND/Projects/MP163/0220/INFO/LCMS_library_template.xlsx"
xlsx_std_sheetname <- "compound_table"

3.1.6 Colname of retention time πŸ•΅

colname_rt <- "Library.rt.RF" # or "Library.rt.HILLIC"

3.1.7 Threshold for retention time (minutes) and m/z for ploting chromatogram πŸ•΅

thre_rt = 2
thre_mz = 0.01

3.1.7.1 Conducting

source(paste0(path_utils_prepro, "/XCMS_checkRT.R"))

3.2 Extraction of MS2-spectra

If you skip the previous step, please make sure the retention time to be as correct as possible and fill in information related to the standards in the excel file as mentioned in the previous step

The script 3b.Pipeline_extract_MS2_std.R is available under the folder of J:\CBMR\SUN-CBMR-Metabolomics\Workflow\Script\modules\MS2_preprocessing

3.2.1 Source paths on the server

source("H:/From_SUND/Scripts/utils/utils_MS2_set_up/set_up_paths.R")

3.2.2 Provide polarity πŸ•΅

polarity <- "NEG"

3.2.3 Path of storing .mzML files without filenames πŸ•΅

path_files_mzML <- "H:/From_SUND/Projects/MP163/0220/NEG/mzML_DA_NEG/mzML_openms_MS2_NEG"

3.2.4 Path of storing outputs πŸ•΅

path_outputs <- "H:/From_SUND/Projects/MP163/0220/outputs"

3.2.5 Absolute path of template with essential information of standards πŸ•΅

xlsx_std_info <- "H:/From_SUND/Projects/MP163/0220/outputs_NEG/metadata_for_MS2.xlsx"

3.2.6 colname of retention time πŸ•΅

colname_rt <- "rt_detected" # or "Library.rt.RF" # or "Library.rt.HILLIC" 

3.2.7 Parameters for extracting MS2 spectra πŸ•΅

3.2.7.1 Extraction: Threshold of rt and m/z for extraction πŸ•΅

params <- list()
params$expandRt <- 5 #seconds
params$expandMz <- 0.01

3.2.7.2 How many maximal number of scans you would like to keep for further getting combined spectrum for each std πŸ•΅

n_scans <- 6 # (5 CEs * 6/ 1 CE * 3)

3.2.7.3 Combining: Threshold of mz, proportion among all samples, type for combining, function for combining mz and intensity πŸ•΅

#To get consensus spectra for each feature at each collision energy
params$tolerance <- 0.005
params$peaks <- "intersect"  #"union" #report all peaks from all input spectra 
params$minProp <- 0.7
params$intfun <- max
params$mzfun <- median

3.2.8 Conducting

if (grepl("ku_00007", path_files_mzML)) {
     
     source("")
     
} else {source(paste0(path_utils_prepro, "/extract_MS2_std.R"))}