diff --git a/R/runPDTMTAnalysis.R b/R/runPDTMTAnalysis.R index 8a42fdb..eb72c9a 100644 --- a/R/runPDTMTAnalysis.R +++ b/R/runPDTMTAnalysis.R @@ -205,20 +205,30 @@ #' #' @examples #' if (interactive()) { -#' # sampleAnnot <- read.delim( -#' # system.file("extdata/mq_example/1356_sampleAnnot.txt", -#' # package = "einprot")) -#' # ## Basic analysis -#' # out <- runPDTMTAnalysis( -#' # outputDir = tempdir(), -#' # outputBaseName = "PD_TMT_basic", -#' # species = "mouse", -#' # iColPattern = "", -#' # sampleAnnot = sampleAnnot, -#' # stringIdCol = NULL -#' # ) -#' # ## Output file -#' # out +#' ## Basic analysis +#' out <- runPDTMTAnalysis( +#' outputDir = tempdir(), +#' outputBaseName = "PD_TMT_basic", +#' species = "baker's yeast", +#' iColPattern = "^Abundance.F.+.Sample.", +#' pdOutputFolder = system.file("extdata", "pdtmt_example", +#' package = "einprot"), +#' pdResultName = "Fig2_m23139_RTS_QC_varMods", +#' inputLevel = "Proteins", +#' pdAnalysisFile = system.file("extdata", "pdtmt_example", +#' "Fig2_m23139_RTS_QC_varMods.pdAnalysis", +#' package = "einprot"), +#' sampleAnnot = data.frame( +#' sample = c("HIS4KO_S05", "HIS4KO_S06", "HIS4KO_S07", "HIS4KO_S08", +#' "MET6KO_S01", "MET6KO_S02", "MET6KO_S03", "MET6KO_S04", +#' "URA2KO_S09", "URA2KO_S10", "URA2KO_S11", "URA2KO_S12", +#' "WT_S13", "WT_S14", "WT_S15", "WT_S16"), +#' group = c(rep("HIS4KO", 4), rep("MET6KO", 4), rep("URA2KO", 4), +#' rep("WT", 4))), +#' stringIdCol = NULL +#' ) +#' ## Output file +#' out #' } #' #' @returns Invisibly, the path to the compiled html report. diff --git a/R/seqLogoApp.R b/R/seqLogoApp.R index 6921b9d..f469b94 100644 --- a/R/seqLogoApp.R +++ b/R/seqLogoApp.R @@ -17,6 +17,14 @@ #' files exported from the shiny app. #' @param ... Additional arguments passed to \code{utils::read.csv}. #' +#' @examples +#' tbl <- data.frame(id = c("seq1", "seq2", "seq3"), +#' seqWindow = c("LITKDHE", "RQMKQPE", "LSNKVHG")) +#' tfile <- tempfile(fileext = "_seq.csv") +#' write.table(tbl, file = tfile, row.names = FALSE, +#' col.names = TRUE, quote = TRUE, sep = ",") +#' seqLogoApp(tfile) +#' #' @importFrom shiny fluidPage fluidPage sidebarLayout sidebarPanel #' mainPanel downloadButton plotOutput renderPlot reactive downloadHandler #' shinyApp textOutput renderText diff --git a/R/subtractBaseline.R b/R/subtractBaseline.R index 4181272..3baf46f 100644 --- a/R/subtractBaseline.R +++ b/R/subtractBaseline.R @@ -20,6 +20,20 @@ #' #' @returns Matrix with baseline-subtracted abundances. #' +#' @examples +#' sce <- readRDS(system.file("extdata", "mq_example", "1356_sce.rds", +#' package = "einprot")) +#' +#' ## Introduce artificial batch column +#' sce$batch <- rep(c("B1", "B2", "B3"), 3) +#' SummarizedExperiment::colData(sce) +#' mat <- getMatSubtractedBaseline(sce, assayName = "log2_LFQ.intensity", +#' baselineGroup = "RBC_ctrl", +#' sceFull = sce) +#' ## After the subtraction, the baseline samples are equalized across the +#' ## different batches +#' head(mat) +#' #' @importFrom SummarizedExperiment assay assayNames #' getMatSubtractedBaseline <- function(sce, assayName, baselineGroup, sceFull) { diff --git a/man/getMatSubtractedBaseline.Rd b/man/getMatSubtractedBaseline.Rd index cf37b64..7d877e0 100644 --- a/man/getMatSubtractedBaseline.Rd +++ b/man/getMatSubtractedBaseline.Rd @@ -28,6 +28,21 @@ subtract the average value across a set of reference/background/baseline samples, and add the average across all the baseline samples to retain information about overall abundance. Typically used to adjust for varying baselines between batches, when a reference sample is included in each batch. +} +\examples{ +sce <- readRDS(system.file("extdata", "mq_example", "1356_sce.rds", + package = "einprot")) + +## Introduce artificial batch column +sce$batch <- rep(c("B1", "B2", "B3"), 3) +SummarizedExperiment::colData(sce) +mat <- getMatSubtractedBaseline(sce, assayName = "log2_LFQ.intensity", + baselineGroup = "RBC_ctrl", + sceFull = sce) +## After the subtraction, the baseline samples are equalized across the +## different batches +head(mat) + } \author{ Charlotte Soneson diff --git a/man/runPDTMTAnalysis.Rd b/man/runPDTMTAnalysis.Rd index 3b2b027..7928e0d 100644 --- a/man/runPDTMTAnalysis.Rd +++ b/man/runPDTMTAnalysis.Rd @@ -342,20 +342,30 @@ Launch a workflow on quantifications obtained with } \examples{ if (interactive()) { -# sampleAnnot <- read.delim( -# system.file("extdata/mq_example/1356_sampleAnnot.txt", -# package = "einprot")) -# ## Basic analysis -# out <- runPDTMTAnalysis( -# outputDir = tempdir(), -# outputBaseName = "PD_TMT_basic", -# species = "mouse", -# iColPattern = "", -# sampleAnnot = sampleAnnot, -# stringIdCol = NULL -# ) -# ## Output file -# out + ## Basic analysis + out <- runPDTMTAnalysis( + outputDir = tempdir(), + outputBaseName = "PD_TMT_basic", + species = "baker's yeast", + iColPattern = "^Abundance.F.+.Sample.", + pdOutputFolder = system.file("extdata", "pdtmt_example", + package = "einprot"), + pdResultName = "Fig2_m23139_RTS_QC_varMods", + inputLevel = "Proteins", + pdAnalysisFile = system.file("extdata", "pdtmt_example", + "Fig2_m23139_RTS_QC_varMods.pdAnalysis", + package = "einprot"), + sampleAnnot = data.frame( + sample = c("HIS4KO_S05", "HIS4KO_S06", "HIS4KO_S07", "HIS4KO_S08", + "MET6KO_S01", "MET6KO_S02", "MET6KO_S03", "MET6KO_S04", + "URA2KO_S09", "URA2KO_S10", "URA2KO_S11", "URA2KO_S12", + "WT_S13", "WT_S14", "WT_S15", "WT_S16"), + group = c(rep("HIS4KO", 4), rep("MET6KO", 4), rep("URA2KO", 4), + rep("WT", 4))), + stringIdCol = NULL + ) + ## Output file + out } } diff --git a/man/seqLogoApp.Rd b/man/seqLogoApp.Rd index bf55c65..5664311 100644 --- a/man/seqLogoApp.Rd +++ b/man/seqLogoApp.Rd @@ -28,6 +28,15 @@ A shiny app object. Launch a shiny app that displays the provided csv file as an interactive table, and generates a sequence logo for the sequences in the \code{seqWindow} column. +} +\examples{ +tbl <- data.frame(id = c("seq1", "seq2", "seq3"), + seqWindow = c("LITKDHE", "RQMKQPE", "LSNKVHG")) +tfile <- tempfile(fileext = "_seq.csv") +write.table(tbl, file = tfile, row.names = FALSE, + col.names = TRUE, quote = TRUE, sep = ",") +seqLogoApp(tfile) + } \author{ Charlotte Soneson