
Whole workflow using tidymass
Xiaotao Shen (https://www.shenxt.info/)
Created on 2022-02-18 and updated on 2022-03-09
whole_workflow.Rmd
Data preparation
Download the demo data and refer this article.
We have positive and negative mode. For each mode, we have control
, case
and QC
groups. Control group have 110 samples, and case group have 110 samples as well.
Raw data processing
massprocesser
package is used to do the raw data processing. Please refer this website.
Positive mode
The code used to do raw data processing.
process_data(
path = "mzxml_ms1_data/POS",
polarity = "positive",
ppm = 10,
peakwidth = c(10, 60),
threads = 4,
output_tic = FALSE,
output_bpc = FALSE,
output_rt_correction_plot = FALSE,
min_fraction = 0.5,
group_for_figure = "QC"
)
#> Reading raw data, it will take a while...
#>
#> Use old saved data in Result.
#>
#> ✔ OK
#>
#> Detecting peaks...
#>
#> Use old saved data in Result.
#>
#> ✔ OK
#>
#> Correcting rentention time...
#>
#> Use old saved data in Result.
#>
#> ✔ OK
#>
#> Grouping peaks across samples...
#>
#> Use old saved data in Result.
#>
#> ✔ OK
#>
#> Outputting peak table...
#>
#> ✔ OK
#>
#> OK
#>
#> ✔ All done!
#>
All the results will be placed in the folder named mzxml_ms1_data/POS/Result
. More information about that can be found here.
You can just load the object
, which is a mass_dataset
class object.
load("mzxml_ms1_data/POS/Result/object")
object
#> --------------------
#> massdataset version: 0.99.8
#> --------------------
#> 1.expression_data:[ 10149 x 259 data.frame]
#> 2.sample_info:[ 259 x 4 data.frame]
#> 3.variable_info:[ 10149 x 3 data.frame]
#> 4.sample_info_note:[ 4 x 2 data.frame]
#> 5.variable_info_note:[ 3 x 2 data.frame]
#> 6.ms2_data:[ 0 variables x 0 MS2 spectra]
#> --------------------
#> Processing information (extract_process_info())
#> create_mass_dataset ----------
#> Package Function.used Time
#> 1 massdataset create_mass_dataset() 2022-02-22 16:37:06
#> process_data ----------
#> Package Function.used Time
#> 1 massprocesser process_data 2022-02-22 16:36:42
We can see that there are 10,149 metabolic features in positive mode.
You can use the plot_adjusted_rt()
function to get the interactive plot.
load("mzxml_ms1_data/POS/Result/intermediate_data/xdata2")
####set the group_for_figure if you want to show specific groups.
####And set it as "all" if you want to show all samples.
plot <-
massprocesser::plot_adjusted_rt(object = xdata2,
group_for_figure = "QC",
interactive = TRUE)
plot