library(quantable)
library(knitr)
opts_chunk$set(echo=FALSE, message=FALSE, results = 'hide', warnings=FALSE)

Transition Data Summary

srms$qValueHist()
par(mfrow=c(1,3))
srms$getNrNAs()
srms$getNrNAs(light=TRUE)
foldchanges <- srms$getLHLog2FoldChange()
all <-srms$getTransitionIntensities(100)
tmp <- quantable::setdiff.data.frame(all$ids[,1:(ncol(all$ids)-1)], foldchanges$ids)
if(nrow(tmp)> 0){
  knitr::kable(quantable::setdiff.data.frame(all$ids[,1:(ncol(all$ids)-1)], foldchanges$ids), row.names=FALSE, caption="Removed transitions (to many NA's). TODO : add number of missing as a column.")
}else{
  print("no transitins were removed because of NA's.")
}
foldchanges <- srms$getLHLog2FoldChange(plot=F)
filteredfc <- (foldchanges$filterData(minNrTransition = 2))
curatedTransitions <- filteredfc$removeDecorrelated(TransitionCorrelationThreshold)
curatedTransitions$plot()
allX <- unique(all$getPeptideIDs())
fc <- unique(curatedTransitions$getPeptideIDs())
tmp <- dplyr::setdiff(allX ,  fc)


if(nrow(tmp)>0){
  knitr::kable(tmp,
               row.names = FALSE,
               caption= "Summary of all dropped peptides. Peptides might have been removed since there were no quantified transtions (NA's), only a single transition was quantified or the transitions were uncorrelated.")
}else{
  cat("No peptides where removed.") 
}

Out of all r nrow(allX) peptides r nrow(tmp) where removed, leaving r nrow(fc) peptides.

There are r length(unique(curatedTransitions$getPeptideIDs()$Peptide.Sequence)) peptides which can be used for quantification.

knitr::kable(table(curatedTransitions$getPeptideIDs()[,2:3]),
             row.names = TRUE,
             caption = "Peptides available for protein quantification and Nr of transitions per peptide. Columns charge state.")

\newpage

Peptide Filtering

The following plots show Log2(H/L) of peptides belonging to the same proteins (y axis) given samples (x axis). These fold changes will be used to compute the fold H/L fold change of the protein in a sample. For protein quantification only peptides will be used which correlate for a protein.

peptides <- curatedTransitions$getPeptideIntensities()
correlatedPeptides <- peptides$removeDecorrelated(PeptideCorrelationThreshold)
correlatedPeptides$plot()
countrows <- function(x){if(is.null(x)){return(0)}else{nrow(x)}}
nrPepUnfiltered<-sapply(peptides$getProteinsAsList(),nrow)
nrPepFiltered <-sapply(correlatedPeptides$getProteinsAsList(),countrows)
xxData<- data.frame(nrPepUnfiltered = nrPepUnfiltered,nrPepFiltered= nrPepFiltered, names=names(nrPepUnfiltered))
xxDataRep <- xxData[nrPepUnfiltered!=nrPepFiltered,]
library(ggplot2)
library(ggrepel)

ggplot(xxData, aes(nrPepUnfiltered, nrPepFiltered)) +
  geom_point()+ ggrepel::geom_text_repel(data= xxDataRep, aes(nrPepUnfiltered,nrPepFiltered, label=names ))

\newpage

knitr::kable(setdiff.data.frame(peptides$getPeptideIDs() ,
                                correlatedPeptides$getPeptideIDs() ),
             row.names = FALSE,
             caption= "Peptides removed because of decorrelation on peptide level. ")

\newpage

knitr::kable(table(correlatedPeptides$getPeptideIDs()[,2:3]),row.names = TRUE,
             caption = "Peptides available for Quantification. Columns charge state.")

There are r length(unique(correlatedPeptides$getPeptideIDs()$Peptide.Sequence)) peptides available for protein quantification.

\newpage

Protein Intensities

correlatedPeptides$getProteinIntensities(scale=FALSE)
proteinslist <- correlatedPeptides$getProteinsAsList()
proteins <- data.frame( Portein = names(proteinslist), NrPeptides=  sapply(proteinslist, countrows))
proteins <- subset(proteins, NrPeptides > 0)

knitr::kable(proteins,caption="Quantified proteins with number of peptides used for quantification", row.names = FALSE)
remprot <- t(t(dplyr::setdiff(unique(all$ids$Protein.Name),rownames(proteins))))
colnames(remprot) <- "Proteins"
knitr::kable(data.frame(remprot), caption= "List of removed proteins", row.names = FALSE)

A total of r length(unique(all$ids$Protein.Name)) were measured, r nrow(remprot) were removed and r length(rownames(proteins)) were quantified.

Proteins and their Peptides

\newpage

xl <-peptides$getProteinsAsList()
length(xl)
x2 <-correlatedPeptides$getProteinsAsList()
x2<-x2[!sapply(x2,is.null)]

for(i in 1:length(xl)){
  plotNicely(xl[[i]],main=names(xl)[i])
}

Peptides and their transitions

\newpage

peplist <- filteredfc$getPeptidesAsList()

for(i in 1:length(peplist)){
  SRMService::plotNicely(peplist[[i]],main = names(peplist)[i] )  
}


protViz/SRMService documentation built on Nov. 13, 2021, 9:58 a.m.