## Basic loading and filtering of MultiQuant output.
## This may or may not become a helper function in the future.
## This function will likely call other functions to filter the MultiQuant
## output like deisotoping, removing dehydrations and dimers, etc.
filterMQ <- function(nameMQ){
# Load MultiQuant output file
MQ <- fread(nameMQ, sep = "\t", header = T,
na.strings = "N/A", select = c(2,4,21,56),
strip.white = T)
# Proper column names to be scanned in
properNames <- c("Sample Index", "Sample Name", "Mass Info", "Retention Time")
properNospace <- c("Sample.Index", "Sample.Name", "Mass.Info", "Retention.Time")
# Check MultiQuant column headers; return error if they don't match
if (any(colnames(MQ) != properNames) == TRUE){
stop("The column names or orders do not match the following:
\"Sample Index\",
\"Sample Name\",
\"Mass Info\",
\"Retention Time\"")
}
# Rename columns to remove whitespace which interferes with Data.Table package
setnames(MQ, properNospace)
## Do we need to do any checks to clean the data or warn the user about
## potential issues?
## Ex. Retention Time is < 5 minutes?
## Remove peaks that were not found (identified by a 'Retention.Time' of NA)
MQ <- MQ[is.na(Retention.Time) == F]
## Split "Mass.Info" into Q1 and Q3 as numerics
MQ <- MQ[, c("MQ.Q1", "Q3") := tstrsplit(Mass.Info, " / ")]
MQ[, MQ.Q1 := as.numeric(MQ.Q1)]
MQ[, Q3 := as.numeric(Q3)]
## Remove "Mass.Info" column and re-order columns
MQ[,"Mass.Info":=NULL]
setcolorder(MQ, c("Sample.Index", "MQ.Q1", "Q3", "Retention.Time"))
## Create an index of filtered MultiQuant peaks
MQ[, ID := .I]
## Call |.cleanMQ| function
MQ <- .isotopeMQ(MQ)
return(MQ)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.