mzPointer <- mzPlotter::getMzPointer(path = params$path) mzXMLHeader <- mzPlotter::readMzSpec(mzPointer)
knitr::kable(as.data.frame(mzR::instrumentInfo(mzPointer)[1:5]))
msLevels <- unique(mzXMLHeader$msLevel) lows <- round(sapply(split(mzXMLHeader$lowMZ, mzXMLHeader$msLevel), min), 1) highs <- round(sapply(split(mzXMLHeader$highMZ, mzXMLHeader$msLevel), max), 1) spectra <- lengths(split(mzXMLHeader$msLevel, mzXMLHeader$msLevel)) a <- t(rbind(`MS level` = msLevels, `low mass` = lows, `high mass` = highs, `number of spectra` = spectra)) knitr::kable(a)
mzRpolarity <- unique(mzXMLHeader$polarity) if(all(c(0, 1) %in% mzRpolarity)) { polarity <- c("Positive and Negative") } else { if(0 %in% mzRpolarity) { polarity <- c("Negative") } if(1 %in% mzRpolarity) { polarity <- c("Positive") } if(-1 %in% mzRpolarity) { polarity <- c("Unknown") } } cat("Detected Polarity: ", polarity)
Positive Mode:
if (1 %in% mzRpolarity) { mzPlotter::figure1(mzPointer = mzPointer, pol = mzRpolarity) }
Negative Mode:
if (0 %in% mzRpolarity) { mzPlotter::figure1(mzPointer = mzPointer, pol = mzRpolarity) }
Positive Mode:
if (2 %in% msLevels) { if (1 %in% mzRpolarity) { mzPlotter::figure2(mzPointer = mzPointer, pol = 1) } } else { print("Please double-check that your sample has MS2 spectra.") }
Negative Mode:
if (2 %in% msLevels) { if (0 %in% mzRpolarity) { mzPlotter::figure2(mzPointer = mzPointer, pol = 0) } } else { print("Please double-check that your sample has MS2 spectra.") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.