knitr::opts_chunk$set( collapse = TRUE, comment = "#>", out.width = "100%" )
This step is used to get the relative quantification data of internal standards and lipids in all samples. If you have not finished the previous step, please click here:
Get retention time of internal standards.
If you have finished this step, click here to next step:
We should have finished step 1. Then we combine the internal standard information from positive and negative mode.
library(lipidflow) library(tidyverse) library(openxlsx)
is_info_table_new_pos = readxl::read_xlsx("example/POS/IS_info_new.xlsx") is_info_table_new_neg = readxl::read_xlsx("example/NEG/IS_info_new.xlsx") is_info_table_new = is_info_table_new_pos %>% dplyr::left_join(is_info_table_new_neg[, c("name", "rt_neg_second", "rt_neg_min", "adduct_neg", "mz_neg")], by = "name")
head(is_info_table_new)
Then we output the is_info_table_new
into the example/Result
folder.
We first create a folder named as Result
:
dir.create("example/Result")
dir.create("example/Result") openxlsx::write.xlsx(is_info_table_new, file = "example/Result/IS_info_table.xlsx")
We need to get the sample information of samples first.
sample_info_pos = generate_sample_info(path = "example/POS")
head(sample_info_pos)
Get the Cholesterol
retention time:
if (any(is_info_table_new$name == "Cholesterol")) { idx = which(is_info_table_new$name == "Cholesterol") chol_rt2 = c(is_info_table_new$rt_pos_second[idx], is_info_table_new$rt_neg_second[idx]) chol_rt2 = chol_rt2[!is.na(chol_rt2)] if (length(chol_rt2) > 0) { chol_rt = chol_rt2[1] } } else{ chol_rt = 1169 }
chol_rt
Then run get_relative_quantification()
to get the relative quantification data of internal standards:
get_relative_quantification( path = "example/POS", output_path_name = "is_relative_quantification", targeted_table_name = "IS_info_new.xlsx", sample_info = sample_info_pos, targeted_table_type = "is", polarity = "positive", chol_rt = chol_rt, output_eic = TRUE, ppm = 40, rt.tolerance = 180, threads = 5, rerun = FALSE )
The meanings of parameters:
path
: Work directory. Here we set as example/POS
.
targeted_table_name
: The name of internal standard information.
sample_info
: sample information of samples.
targeted_table_type
: The type of extracted peaks, "is" (internal standard) or "lipid" (lipids).
polarity
: "positive" or negative
.
chol_rt
: Cholesterol retention time (second).
output_eic
: Output EICs of peaks or not.
ppm
: peak detection ppm.
rt.tolerance
: peak detection retention time tolerance (second).
threads
: Number of cores to run.
rerun
: Rerun peak detection or not.
Then all the results are outputted into a folder named as example/POS/is_relative_quantification
. The relative quantification table is is_quantification_table.xlsx
and all the peak shapes are in peak_shape
.
is_quantification_table.xlsx
is:
One example of peak shape (15_0-18_1(d7) PC):
Rectangle region means the integrate of peak region.
htmltools::tags$iframe( title = "Internal standard", src = "../man/figures/15_0_18_1_d7_PC.html", width = "100%", height = "600", scrolling = "no", seamless = "seamless", frameBorder = "0" )
Then run get_relative_quantification()
for lipids:
get_relative_quantification( path = "example/POS", output_path_name = "lipid_relative_quantification", targeted_table_name = "lipid_annotation_table_pos.xlsx", sample_info = sample_info_pos, targeted_table_type = "lipid", polarity = "positive", chol_rt = chol_rt, output_eic = TRUE, ppm = 40, rt.tolerance = 180, threads = 5, rerun = FALSE )
Here the targeted_table_name
is the annotation table from lipidsearch
. It should be placed in POS
and NEG
folders, respectively.
The results are outputted in example/POS/lipid_relative_quantification
folder. These results are similar with internal standards.
Negative mode is same with positive mode.
sample_info_neg = generate_sample_info(path = "example/NEG")
get_relative_quantification( path = "example/NEG", output_path_name = "is_relative_quantification", targeted_table_name = "IS_info_new.xlsx", sample_info = sample_info_neg, targeted_table_type = "is", polarity = "negative", chol_rt = chol_rt, output_integrate = TRUE, output_eic = TRUE, ppm = 40, rt.tolerance = 180, threads = 5, rerun = FALSE )
Then run get_relative_quantification()
for lipids:
get_relative_quantification( path = "example/NEG", output_path_name = "lipid_relative_quantification", targeted_table_name = "lipid_annotation_table_neg.xlsx", sample_info = sample_info_neg, targeted_table_type = "lipid", polarity = "negative", chol_rt = chol_rt, output_eic = TRUE, ppm = 40, rt.tolerance = 180, threads = 5, rerun = FALSE )
Sometimes, the peak detection maybe not accurate, so we need to manually check the peak shape of all the internal standards and then detect peak and integrate peak shape again.
For example, the internal standard 18_1_d7_ Lyso PC in positive mode (example/POS/is_relative_quantification/peak_shape/18_1_d7_ Lyso PC.html
), the peak shape is like below figure shows:
htmltools::tags$iframe( title = "Internal standard", src = "../man/figures/figure31.html", width = "100%", height = "600", scrolling = "no", seamless = "seamless", frameBorder = "0" )
From this figure, we can see that for the samples D25_1
, D25_2
and M19_2
, the integrate region (begin point) is not correct, so we need to manually correct that.
example/POS/is_relative_quantification/forced_targeted_peak_table_temple.xlsx
, like the below figure shows:example/POS/is_relative_quantification/peak_shape
. Then if you find that the peak integration is not correct, you can add the right begin and end retention time for peaks like below video shows:library(vembedr) embed_url("https://www.youtube.com/watch?v=OiUdqkw5KZc&feature=youtu.be") %>% use_align("center") %>% use_bs_responsive()
After check all the internal standards which are not normal, please rename it as forced_targeted_peak_table_temple_manual.xlsx
and rerun get_relative_quantification()
, and note that set forced_targeted_peak_table_name
as forced_targeted_peak_table_temple_manual.xlsx
:
get_relative_quantification( path = "example/POS", forced_targeted_peak_table_name = "forced_targeted_peak_table_temple_manual.xlsx", output_path_name = "is_relative_quantification", targeted_table_name = "IS_info_new.xlsx", sample_info = sample_info_pos, targeted_table_type = "is", polarity = "positive", chol_rt = chol_rt, output_integrate = TRUE, output_eic = TRUE, ppm = 40, rt.tolerance = 180, threads = 5, rerun = FALSE )
Then open the internal standard 18_1_d7_ Lyso PC in positive mode (example/POS/is_relative_quantification/peak_shape/18_1_d7_ Lyso PC.html
), the peak detection is good for now:
htmltools::tags$iframe( title = "Internal standard", src = "../man/figures/figure33.html", width = "100%", height = "600", scrolling = "no", seamless = "seamless", frameBorder = "0" )
For the negative mode, we can also manually check internal standards like this and rerun to get more accurate peak integration and relative quantification data.
Next we need to get the absolute quantification data of all lipids in all sample.
Please click here:
Step3: get absolute quantification data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.