Pooled QC samples within injection sequences are very important to control the quality of untargeted analysis. I added some function in `enviGCMS`

package to visualize or analysis Pooled QC samples.

For each sample, the peaksâ€™ density distribution will tell us if certain samples show large shift.

Relative Log Abundance (RLA) plots could be another way to show the intensity shift.

```
data(list)
plotrla(list$data,as.factor(list$group))
#> Warning in bplt(at[i], wid = width[i], stats = z$stats[, i], out = z$out[z$group
#> == : Outlier (-Inf) in boxplot 5 is not drawn
#> Warning in bplt(at[i], wid = width[i], stats = z$stats[, i], out = z$out[z$group
#> == : Outlier (-Inf) in boxplot 6 is not drawn
#> Warning in bplt(at[i], wid = width[i], stats = z$stats[, i], out = z$out[z$group
#> == : Outlier (-Inf) in boxplot 7 is not drawn
#> Warning in bplt(at[i], wid = width[i], stats = z$stats[, i], out = z$out[z$group
#> == : Outlier (-Inf) in boxplot 10 is not drawn
#> Warning in bplt(at[i], wid = width[i], stats = z$stats[, i], out = z$out[z$group
#> == : Outlier (-Inf) in boxplot 11 is not drawn
```

Relative Log Abundance Ridge (RLAR) plots could also be used to show the intensity shift.

The sum of all peaksâ€™ intensity or total usable signal(TUS) could show the general trends for each sample while peaks with lower ionization energy will dominated such value. Here I introduced a density weighted TUS to make the values robust to low frequency high intensity peaks. You could use `getdwtus`

to calculate DWTUS for samples.

\[DWTUS = \sum peak\ intensity * peak\ density\]

For LC/GC-MS analysis, the run order will affect the intensity of single peak until the instrument is stable. The intensity will decrease/increase with initial run order and researcher need to evaluate how many samples are enough to eliminated run order effects. Here I introduced a pooled QC linear index to show such trends in the sequence.

As shown in above figure, for one peak repeated analyzed in one sequence, the intensity would become stable in long term. In math, the slope of every 5 samples along the run order would become 0. Then we could define the percentage of stable peaks as pooled QC index. Such index would be a value between 0 and 1. The higher of such index, more peaks within the QC would be affected by run order effect. You could use such function to check the QC samples to see if run order effects would influence the samples at the beginning of sequences.

```
order <- 1:12
# n means how many points to build a linear regression model
n = 5
idx <- getpqsi(list$data,order,n = n)
plot(idx~order[-(1:(n-1))],pch=19)
```

In this case, we could see at 5th sample, 30% peaks show correlation with the run order. However, ever since 6th sample, the run order effects could be ignore.