Skip to content

Commit

Permalink
exporting Grp2Analysis class
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed Aug 17, 2016
1 parent f2bf101 commit 1b692a6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 43 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Generated by roxygen2: do not edit by hand

export(Grp2Analysis)
export(MQtoMSstatsFormat)
export(SRMService)
export(getIntensities)
export(getRequiredColumns)
export(piwotPiw)
export(plotNicely)
exportClasses(Grp2Analysis)
exportClasses(SRMService)
import(DBI)
import(methods)
import(parallel)
import(quantable)
import(reshape2)
4 changes: 1 addition & 3 deletions R/Grp2Analysis.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
annotationColumns <- c("Raw.file","Condition", "BioReplicate", "Run","IsotopeLabelType")
proteinColumns <- c("ProteinName","TopProteinName","nrPeptides")

#'
#' Perform 2 group analysis with visualization
#' @export Grp2Analysis
#' @exportClass Grp2Analysis
#'
#' @examples
#' Grp2Analysis()
Grp2Analysis <- setRefClass("Grp2Analysis",
fields = list( proteinIntensity = "data.frame",
annotation = "data.frame",
Expand Down
10 changes: 8 additions & 2 deletions R/SRMService.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,19 @@ SRMService <- setRefClass("SRMService",
)
return(int_)
},
stripLabel=function(int_,light=FALSE){
label<-if(light){.self$lightLabel}else{.self$heavyLabel}
rownames(int_) <- gsub(paste("_",label,"$",sep=""),"",rownames(int_))
invisible(int_)
}
,
getMatchingIntensities = function(){
"get matrix with intensities, where nr of NAs in row < maxNA"
intLight_ <- .self$getTransitionIntensities(light=TRUE)
intHeavy_ <- .self$getTransitionIntensities()

rownames(intLight_) <- gsub("_light$","",rownames(intLight_))
rownames(intHeavy_) <- gsub("_heavy$","",rownames(intHeavy_))
intLight_ <- stripLabel(intLight_, light=TRUE)
intHeavy_ <- stripLabel(intHeavy_)

idx <-intersect(rownames(intLight_),rownames(intHeavy_))

Expand Down
18 changes: 3 additions & 15 deletions inst/samples/grp2analysisTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ rm(list=ls())

protein <- read.csv("d:/googledrive/DataAnalysis/p2084/215579/proteinGroups.txt",sep="\t",stringsAsFactors = F)

colnames(protein)

rawF <-gsub("Intensity\\.", "", grep("Intensity\\.",colnames(protein),value=T) )

Expand All @@ -13,24 +14,11 @@ annotation <-data.frame(Raw.file = rawF,
IsotopeLabelType = rep("L",length(condition)), stringsAsFactors = F)


library(SRMService)

source("R/Grp2Analysis.R")


grp2 <- Grp2Analysis(annotation, "p2084BlaBla", maxNA=8 , nrPeptides=3)
grp2$setHeatmap("red")

grp2 <- Grp2Analysis(annotation, "p2084BlaBla", maxNA=8 , nrPeptides=2)
grp2$setMQProteinGroups(protein)

grp2$getDesignMatrix()


library(dScipa)
idx <-grep("SL9B2_MOUSE",rownames(grp2$proteinIntensity))
grp2$proteinIntensity[idx,]
res.eb <- grp2$getPValues()
head(res.eb)
grep("SL9B2_MOUSE",rownames(res.eb))

rmarkdown::render("inst/reports/Grp2Analysis.Rmd",output_format = "pdf_document", output_file = "Grp2Analysis.pdf")

22 changes: 22 additions & 0 deletions man/Grp2Analysis-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 27 additions & 23 deletions man/SRMService-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1b692a6

Please sign in to comment.