#' A function that takes a protein dataframe produces by the countPTMs function along with the PTM data frame to return predicted molecular weight.
#'
#'
#'This function takes a protein dataframe produces by the countPTMs function along with the PTM data frame to return predicted molecular weight. It uses the conversion data frame
#'to map the PTMs to the correct molecular weight and to produce a predicted molecular weight based on the experimentally verfied PTM data from Uniprot.
#'
#'
#' @param proteindf Data frame of protein data generated by the fetchGenebank function.
#' @param ptmdf Dataframe of PTM data generated by the PTM function.
#' @export
#' @examples
#'
#' finaldf <- predictedMW(proteindf, ptmdf)
#'
predictedMW <- function(proteindf, ptmdf){
conversion <- read.csv(file = 'conversion.csv')
PTMchange <- data.frame(PTMs = unique(conversion$New), PTMweightchange = unique(conversion$Weight))
gly <- grepl(x = ptmdf$type, pattern = 'Glycosylation')
ptmdf <- subset(ptmdf, !gly)
PTMchange <- subset(PTMchange, PTMchange$PTMs %in% ptmdf$type )
st_values <- split(PTMchange$PTMweightchange, PTMchange$PTMs)
col <- colnames(proteindf)
proteindf$PredictedMWALL <- proteindf$molecularweight
for(i in 1:length(proteindf$protienName)){
for(j in 12:length(col)){
proteindf$PredictedMWAll[i] <- proteindf[j][i,] * st_values[names(proteindf[j])][[1]] + proteindf$PredictedMWAll[i]
}
}
return(proteindf)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.