Browse code

more warning clean up

sherman5 authored on 26/01/2018 20:18:09
Showing 51 changed files

... ...
@@ -31,7 +31,8 @@ Imports:
31 31
     reshape2
32 32
 Suggests:
33 33
     testthat,
34
-    lintr
34
+    lintr,
35
+    knitr
35 36
 LinkingTo: Rcpp, BH
36 37
 VignetteBuilder: knitr
37 38
 License: GPL (==2)
... ...
@@ -1,12 +1,12 @@
1 1
 #' CoGAPS Matrix Factorization Algorithm
2 2
 #' 
3 3
 #' @details calls the C++ MCMC code and performs Bayesian
4
-#'  matrix factorization returning the two matrices that reconstruct
5
-#'  the data matrix
4
+#' matrix factorization returning the two matrices that reconstruct
5
+#' the data matrix
6 6
 #' @param D data matrix
7 7
 #' @param S uncertainty matrix (std devs for chi-squared of Log Likelihood)
8 8
 #' @param nFactor number of patterns (basis vectors, metagenes), which must be
9
-#'  greater than or equal to the number of rows of FP
9
+#' greater than or equal to the number of rows of FP
10 10
 #' @param nEquil number of iterations for burn-in
11 11
 #' @param nSample number of iterations for sampling
12 12
 #' @param nOutputs how often to print status into R by iterations
... ...
@@ -16,16 +16,19 @@
16 16
 #' @param maxGibbmassA limit truncated normal to max size
17 17
 #' @param maxGibbmassP limit truncated normal to max size
18 18
 #' @param seed a positive seed is used as-is, while any negative seed tells
19
-#'  the algorithm to pick a seed based on the current time
19
+#' the algorithm to pick a seed based on the current time
20 20
 #' @param messages display progress messages
21 21
 #' @param singleCellRNASeq indicates if the data is single cell RNA-seq data
22 22
 #' @param whichMatrixFixed character to indicate whether A or P matric contains
23
-#'  the fixed patterns
23
+#' the fixed patterns
24 24
 #' @param fixedPatterns matrix of fixed values in either A or P matrix
25 25
 #' @param checkpointInterval time (in seconds) between creating a checkpoint
26 26
 #' @param ... keeps backwards compatibility with arguments from older versions
27 27
 #' @return list with A and P matrix estimates
28 28
 #' @importFrom methods new
29
+#' @examples
30
+#' data(SimpSim)
31
+#' result <- CoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nOutputs=250)
29 32
 #' @export
30 33
 CoGAPS <- function(D, S, nFactor=7, nEquil=1000, nSample=1000, nOutputs=1000,
31 34
 nSnapshots=0, alphaA=0.01, alphaP=0.01, maxGibbmassA=100, maxGibbmassP=100,
... ...
@@ -59,9 +62,13 @@ fixedPatterns = matrix(0), checkpointInterval=0, ...)
59 62
     result <- cogaps_cpp(D, S, nFactor, nEquil, nEquil/10, nSample, nOutputs,
60 63
         nSnapshots, alphaA, alphaP, maxGibbmassA, maxGibbmassP, seed, messages,
61 64
         singleCellRNASeq, whichMatrixFixed, fixedPatterns, checkpointInterval)
62
-
63
-    # backwards compatible with v2
64
-    return(v2CoGAPS(result, ...))
65
+    
66
+    patternNames <- paste('Patt', 1:nFactor, sep='')
67
+    rownames(result$Amean) <- rownames(result$Asd) <- rownames(D)
68
+    colnames(result$Amean) <- colnames(result$Asd) <- patternNames
69
+    rownames(result$Pmean) <- rownames(result$Psd) <- patternNames
70
+    colnames(result$Pmean) <- colnames(result$Psd) <- colnames(D)
71
+    return(v2CoGAPS(result, ...)) # backwards compatible with v2
65 72
 }
66 73
 
67 74
 #' Restart CoGAPS from Checkpoint File
... ...
@@ -82,6 +89,9 @@ CoGapsFromCheckpoint <- function(D, S, path)
82 89
 #'
83 90
 #' @details displays information about how the package was compiled, i.e. which
84 91
 #'  compiler/version was used, which compile time options were enabled, etc...
92
+#' @return display builds information
93
+#' @examples
94
+#'  CoGAPS::displayBuildReport()
85 95
 #' @export
86 96
 displayBuildReport <- function()
87 97
 {
... ...
@@ -116,10 +126,10 @@ numSnapshots=100, alphaA=0.01, nMaxA=100000, max_gibbmass_paraA=100.0,
116 126
 alphaP=0.01, nMaxP=100000, max_gibbmass_paraP=100.0, seed=-1, messages=TRUE)
117 127
 {
118 128
     #warning('gapsRun is deprecated with v3.0, use CoGAPS')
119
-    CoGAPS(D, S, nFactor=nFactor, nEquil=nEquil, nSample=nSample, nOutputs=nOutR,
120
-        nSnapshots=ifelse(sampleSnapshots,numSnapshots,0), alphaA=alphaA,
121
-        alphaP=alphaP, maxGibbmassA=max_gibbmass_paraA, messages=messages,
122
-        maxGibbmassP=max_gibbmass_paraP, seed=seed)
129
+    CoGAPS(D, S, nFactor=nFactor, nEquil=nEquil, nSample=nSample,
130
+        nOutputs=nOutR, nSnapshots=ifelse(sampleSnapshots,numSnapshots,0),
131
+        alphaA=alphaA, alphaP=alphaP, maxGibbmassA=max_gibbmass_paraA,
132
+        messages=messages, maxGibbmassP=max_gibbmass_paraP, seed=seed)
123 133
 }
124 134
 
125 135
 #' Backwards Compatibility with v2
... ...
@@ -141,18 +151,35 @@ max_gibbmass_paraA=100.0, alphaP=0.01, nMaxP=100000, max_gibbmass_paraP=100.0,
141 151
 seed=-1, messages=TRUE)
142 152
 {
143 153
     #warning('gapsMapRun is deprecated with v3.0, use CoGaps')
144
-    CoGAPS(D, S, nFactor=nFactor, nEquil=nEquil, nSample=nSample, nOutputs=nOutR,
145
-        nSnapshots=ifelse(sampleSnapshots,numSnapshots,0), alphaA=alphaA,
146
-        alphaP=alphaP, maxGibbmassA=max_gibbmass_paraA, messages=messages,
147
-        maxGibbmassP=max_gibbmass_paraP, seed=seed, whichMatrixFixed='P',
148
-        fixedPatterns=as.matrix(FP))
154
+    CoGAPS(D, S, nFactor=nFactor, nEquil=nEquil, nSample=nSample,
155
+        nOutputs=nOutR, nSnapshots=ifelse(sampleSnapshots,numSnapshots,0),
156
+        alphaA=alphaA, alphaP=alphaP, maxGibbmassA=max_gibbmass_paraA,
157
+        messages=messages, maxGibbmassP=max_gibbmass_paraP, seed=seed,
158
+        whichMatrixFixed='P', fixedPatterns=as.matrix(FP))
149 159
 }
150 160
 
161
+# helper function for backwards compatibility
151 162
 v2CoGAPS <- function(result, ...)
152 163
 {
153 164
     if (!is.null(list(...)$GStoGenes))
154 165
     {
155
-
166
+        if (is.null(list(...)$plot) | list(...)$plot)
167
+        {
168
+            plotGAPS(result$Amean, result$Pmean)
169
+        }
170
+        if (is.null(list(...)$nPerm))
171
+        {
172
+            nPerm <- 500
173
+        }
174
+        else
175
+        {
176
+            nPerm <- list(...)$nPerm
177
+        }
178
+        GSP <- calcCoGAPSStat(result$Amean, result$Asd, list(...)$GStoGenes,
179
+            nPerm)
180
+        result <- list(meanChi2=result$meanChi2, Amean=result$Amean,
181
+            Asd=result$Asd, Pmean=result$Pmean, Psd=result$Psd,
182
+            GSUpreg=GSP$GSUpreg, GSDownreg=GSP$GSDownreg, GSActEst=GSP$GSActEst)
156 183
     }
157 184
     return(result)
158 185
 }
159 186
\ No newline at end of file
... ...
@@ -1,13 +1,12 @@
1 1
 #' GWCoGAPS
2 2
 #'
3
-#'\code{GWCoGAPS} calls the C++ MCMC code and performs Bayesian
4
-#'matrix factorization returning the two matrices that reconstruct
5
-#'the data matrix for whole genome data;
6
-#'
3
+#' @details calls the C++ MCMC code and performs Bayesian
4
+#' matrix factorization returning the two matrices that reconstruct
5
+#' the data matrix for whole genome data;
7 6
 #' @param D data matrix
8 7
 #' @param S uncertainty matrix (std devs for chi-squared of Log Likelihood)
9 8
 #' @param nFactor number of patterns (basis vectors, metagenes), which must be
10
-#'  greater than or equal to the number of rows of FP
9
+#' greater than or equal to the number of rows of FP
11 10
 #' @param nSets number of sets for parallelization
12 11
 #' @param nCores number of cores for parallelization. If left to the default NA, nCores = nSets.
13 12
 #' @param saveBySetResults logical indicating whether to save by intermediary by set results. Default is FALSE.
... ...
@@ -16,12 +15,13 @@
16 15
 #' @param Cut number of branches at which to cut dendrogram used in patternMatch4Parallel
17 16
 #' @param minNS minimum of individual set contributions a cluster must contain
18 17
 #' @param ... additional parameters to be fed into \code{gapsRun} and \code{gapsMapRun}
18
+#' @return list of A and P estimates
19 19
 #' @seealso \code{\link{gapsRun}}, \code{\link{patternMatch4Parallel}}, and \code{\link{gapsMapRun}}
20 20
 #' @examples
21
-#' # Load the simulated data
22
-#' data('SimpSim')
21
+#' # Load the sample data from CoGAPS
22
+#' data(SimpSim)
23 23
 #' # Run GWCoGAPS
24
-#' GWCoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nSets=2, numSnapshots = 5)
24
+#' GWCoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nSets=2)
25 25
 #' @export
26 26
 GWCoGAPS <- function(D, S, nFactor, nSets, nCores=NA, saveBySetResults=FALSE,
27 27
 fname="GWCoGAPS.AP.fixed", PatternsMatchFN = patternMatch4Parallel, Cut=NA,
... ...
@@ -1,17 +1,18 @@
1 1
 #' Binary Heatmap for Standardized A Matrix
2 2
 #'
3 3
 #' @details creates a binarized heatmap of the A matrix
4
-#'  in which the value is 1 if the value in Amean is greater than
5
-#'  threshold * Asd and 0 otherwise
4
+#' in which the value is 1 if the value in Amean is greater than
5
+#' threshold * Asd and 0 otherwise
6 6
 #' @param Amean the mean estimate for the A matrix
7 7
 #' @param Asd the standard deviations on Amean
8 8
 #' @param threshold the number of standard deviations above zero
9
-#'  that an element of Amean must be to get a value of 1
9
+#' that an element of Amean must be to get a value of 1
10
+#' @return plots a heatmap of the A Matrix
10 11
 #' @examples
11
-#' # Load the outputs from gapsRun
12
-#' data('results')
12
+#' # Load the sample data from CoGAPS
13
+#' data(SimpSim)
13 14
 #' # Run binaryA with the correct arguments from 'results'
14
-#' binaryA(results$Amean,results$Asd,threshold=3)
15
+#' binaryA(SimpSim.result$Amean, SimpSim.result$Asd, threshold=3)
15 16
 #' @export
16 17
 binaryA <-function(Amean, Asd, threshold=3)
17 18
 {
... ...
@@ -1,19 +1,19 @@
1 1
 #' Calculate Gene Set Statistics
2 2
 #'
3 3
 #' @details calculates the gene set statistics for each
4
-#'  column of A using a Z-score from the elements of the A matrix,
5
-#'  the input gene set, and permutation tests
4
+#' column of A using a Z-score from the elements of the A matrix,
5
+#' the input gene set, and permutation tests
6 6
 #' @param Amean A matrix mean values
7 7
 #' @param Asd A matrix standard deviations
8 8
 #' @param GStoGenes data.frame or list with gene sets
9 9
 #' @param numPerm number of permutations for null
10
+#' @return gene set statistics for each column of A
10 11
 #' @examples
11
-#' # Load the simulated data
12
-#' data('SimpSim')
13
-#' # Load the outputs from gapsRun
14
-#' data('results')
12
+#' # Load the sample data from CoGAPS
13
+#' data(SimpSim)
15 14
 #' # Run calcCoGAPSStat with the correct arguments from 'results'
16
-#' calcCoGAPSStat(results$Amean,results$Asd,GStoGenes=GSets,numPerm=500)
15
+#' calcCoGAPSStat(SimpSim.result$Amean, SimpSim.result$Asd,
16
+#' GStoGenes=GSets, numPerm=500)
17 17
 #' @export
18 18
 calcCoGAPSStat <- function (Amean, Asd, GStoGenes, numPerm=500)
19 19
 {
... ...
@@ -1,21 +1,21 @@
1 1
 #' Probability Gene Belongs in Gene Set
2 2
 #'
3 3
 #' @details calculates the probability that a gene
4
-#'  listed in a gene set behaves like other genes in the set within
5
-#'  the given data set
4
+#' listed in a gene set behaves like other genes in the set within
5
+#' the given data set
6 6
 #' @param Amean A matrix mean values
7 7
 #' @param Asd A matrix standard deviations
8 8
 #' @param GSGenes data.frame or list with gene sets
9 9
 #' @param numPerm number of permutations for null
10 10
 #' @param Pw weight on genes
11
-#' @param nullGenes - logical indicating gene adjustment
11
+#' @param nullGenes logical indicating gene adjustment
12
+#' @return gene similiarity statistic
12 13
 #' @examples
13
-#' # Load the simulated data
14
+#' # Load the sample data from CoGAPS
14 15
 #' data('SimpSim')
15
-#' # Load the outputs from gapsRun
16
-#' data('results')
17 16
 #' # Run calcGeneGSStat with the correct arguments from 'results'
18
-#' calcGeneGSStat(results$Amean,results$Asd,GSGenes=GSets[[1]],numPerm=500)
17
+#' calcGeneGSStat(SimpSim.result$Amean, SimpSim.result$Asd, 
18
+#' GSGenes=GSets[[1]], numPerm=500)
19 19
 #' @export
20 20
 calcGeneGSStat  <- function(Amean, Asd, GSGenes, numPerm, Pw=rep(1,ncol(Amean)),
21 21
 nullGenes=FALSE)
... ...
@@ -56,10 +56,10 @@ nullGenes=FALSE)
56 56
 #' Compute Gene Probability
57 57
 #'
58 58
 #' @details Computes the p-value for gene set membership using the CoGAPS-based
59
-#'  statistics developed in Fertig et al. (2012).  This statistic refines set
60
-#'  membership for each candidate gene in a set specified in \code{GSGenes} by
61
-#'  comparing the inferred activity of that gene to the average activity of the
62
-#'  set.
59
+#' statistics developed in Fertig et al. (2012).  This statistic refines set
60
+#' membership for each candidate gene in a set specified in \code{GSGenes} by
61
+#' comparing the inferred activity of that gene to the average activity of the
62
+#' set.
63 63
 #' @param Amean A matrix mean values
64 64
 #' @param Asd A matrix standard deviations
65 65
 #' @param GSGenes data.frame or list with gene sets
... ...
@@ -67,7 +67,13 @@ nullGenes=FALSE)
67 67
 #' @param numPerm number of permutations for null
68 68
 #' @param PwNull - logical indicating gene adjustment
69 69
 #' @return A vector of length GSGenes containing the p-values of set membership
70
-#'  for each gene containined in the set specified in GSGenes.
70
+#' for each gene containined in the set specified in GSGenes.
71
+#' @examples
72
+#' # Load the sample data from CoGAPS
73
+#' data('SimpSim')
74
+#' # Run calcGeneGSStat with the correct arguments from 'results'
75
+#' calcGeneGSStat(SimpSim.result$Amean, SimpSim.result$Asd, 
76
+#' GSGenes=GSets[[1]], numPerm=500)
71 77
 #' @export
72 78
 computeGeneGSProb <- function(Amean, Asd, GSGenes, Pw=rep(1,ncol(Amean)),
73 79
 numPerm=500, PwNull=FALSE)
... ...
@@ -1,37 +1,23 @@
1 1
 #' Compute Z-Score Matrix
2 2
 #'
3 3
 #' @details calculates the Z-score for each element based on input mean
4
-#'  and standard deviation matrices
4
+#' and standard deviation matrices
5 5
 #' @param meanMat matrix of mean values
6 6
 #' @param sdMat matrix of standard deviation values
7
+#' @return matrix of z-scores
7 8
 #' @examples
8
-#' # Load the simulated data
9
-#' data('SimpSim')
9
+#' # Load the sample data from CoGAPS
10
+#' data(SimpSim)
10 11
 #' # Run calcZ
11
-#' calcZ(SimpSim.D,SimpSim.S)
12
+#' calcZ(SimpSim.result$Amean, SimpSim.result$Asd)
12 13
 #' @export
13 14
 calcZ <- function(meanMat, sdMat)
14 15
 {
15
-    # find matrix dimensions
16
-    nrows <- dim(meanMat)[1]
17
-    ncols <- dim(meanMat)[2]
16
+    if (nrow(meanMat) != nrow(sdMat) | ncol(meanMat) != ncol(sdMat))
17
+        stop("meanMat and sdMat dimensions don't match")
18 18
 
19
-    check <- dim(sdMat)[1]
20
-    if (nrows != check)
21
-    {
22
-        stop("Number of rows in the mean and standard deviation of A do not agree.")
23
-    }
24
-
25
-    check <- dim(sdMat)[2]
26
-    if (ncols != check)
27
-    {
28
-        stop("Number of columns in the mean and standard deviation of A do not agree.")
29
-    }
30
-
31
-    # compute the matrix of z scores
32
-    zMat <- meanMat/sdMat
19
+    zMat <- meanMat / sdMat
33 20
     rownames(zMat) <- rownames(meanMat)
34 21
     colnames(zMat) <- colnames(meanMat)
35
-
36 22
     return(zMat)
37 23
 }
... ...
@@ -8,10 +8,10 @@
8 8
 #' @param keep logical indicating whether or not to save gene set list.
9 9
 #' @return list with randomly generated sets of genes from whole genome data
10 10
 #' @examples
11
-#' # Load the simulated data
12
-#' data('SimpSim')
11
+#' # Load the sample data from CoGAPS
12
+#' data(SimpSim)
13 13
 #' # Run createGWCoGAPSSets
14
-#' createGWCoGAPSSets(SimpSim.D,nSets=2)
14
+#' createGWCoGAPSSets(SimpSim.D, nSets=2)
15 15
 #' @export
16 16
 createGWCoGAPSSets<-function(data=D, nSets=nSets,
17 17
 outRDA="GenesInCoGAPSSets.Rda", keep=TRUE)
... ...
@@ -1,6 +1,5 @@
1 1
 #Calculates significant genes in each pattern according to certain threshold
2 2
 #Returns the significant gene names as well as well as the correlation matrices between these genes and the means of these matrices
3
-
4 3
 gapsIntraPattern <- function(Amean, Asd, DMatrix, sdThreshold = 3)
5 4
 {
6 5
     #number of rows and cols of Asd
... ...
@@ -2,11 +2,11 @@
2 2
 #'
3 3
 #' @param chains number of seeds to generate (number of chains to run)
4 4
 #' @param seed positive values are kept, negative values will be overwritten
5
-#'  by a seed generated from the current time
5
+#' by a seed generated from the current time
6 6
 #' @return vector of randomly generated seeds
7
-#' @export
8 7
 #' @examples
9
-#' generateSeeds(chains=2, seed=-1)
8
+#' seeds <- generateSeeds(chains=2, seed=-1)
9
+#' @export
10 10
 generateSeeds <- function(chains=2, seed=-1)
11 11
 {
12 12
     if (chains < 2 || (as.integer(chains) != chains))
... ...
@@ -9,8 +9,8 @@
9 9
 #' @return By default a non-overlapping list of genes associated with each \code{lp}. If \code{full=TRUE} a data.frame of
10 10
 #' genes rankings with a column for each \code{lp} will also be returned.
11 11
 #' @examples
12
-#' # Load the outputs from gapsRun
13
-#' data('results')
12
+#' # Load the sample data from CoGAPS
13
+#' data(SimpSim)
14 14
 #' # Run patternMarkers with the correct arguments from 'results'
15 15
 #' patternMarkers(Amatrix=results$Amean,scaledPmatrix=FALSE,
16 16
 #' Pmatrix=results$Pmean,threshold="all",full=TRUE)
... ...
@@ -8,7 +8,6 @@
8 8
 #' @param ignore.NA logical indicating whether or not to ignore NAs from potential over dimensionalization. Default is FALSE.
9 9
 #' @param bySet logical indicating whether to return list of matched set solutions from \code{Ptot}
10 10
 #' @param ... additional parameters for \code{agnes}
11
-#'
12 11
 #' @return a matrix of concensus patterns by samples. If \code{bySet=TRUE} then a list of the set contributions to each
13 12
 #' concensus pattern is also returned.
14 13
 #' @export
... ...
@@ -4,158 +4,149 @@
4 4
 #' @param out optional name for saving output
5 5
 #' @param order optional vector indicating order of samples for plotting. Default is NULL.
6 6
 #' @param sample.color optional vector of colors of same length as colnames. Default is NULL.
7
-#'
8 7
 #' @return either an index of selected sets' contributions or the editted \code{PBySet} object
9 8
 #' @export
10
-#'
11
-#' @examples \dontrun{
12
-#' patternMatcher(PBySet,out,order,sample.color)
13
-#' }
14
-#'
15
-#'
16
-patternMatcher<-function(PBySet=NULL,out=NULL,order=NULL, sample.color=NULL) {
17
-
18
-runApp(list(
19
-  ui = pageWithSidebar(
20
-    # Application title
21
-    headerPanel('NMF Pattern Matching'),
22
-    # Side pannel with controls
23
-    sidebarPanel(
24
-      # to upload file
25
-      fileInput('file1',
26
-                'Choose .Rda File',
27
-                accept=c('.RData','.Rda','R data object','.rda')
28
-      ),
29
-      #
30
-      uiOutput("pickplot"),
31
-      uiOutput("checkbs"),
32
-      downloadButton('downloadData', 'Download'),
33
-      actionButton("end", "Return")
34
-    ),
35
-    # Main panel with plots
36
-    mainPanel(
37
-      plotOutput('plot1')
38
-    )
39
-  ),
40
-
41
-  server = function(input, output, session) {
42
-    #load in the data
43
-    df<-reactive({
44
-      if(!is.null(PBySet)){
45
-        df<-PBySet
46
-        return(df)
47
-      }
48
-      inFile <- input$file1 # get the path to the input file on the server
49
-      if (is.null(inFile)){return(NULL)}
50
-      load(inFile$datapath) #load it
51
-      df <- get(load(inFile$datapath))# get the name of the object that was loaded
52
-      return(df)
53
-    })
54
-
55
-    # get data name
56
-    datName<-reactive({
57
-      if(!is.null(out)){
58
-        datName<-paste(out,'.SelectedPatterns.Rda',sep="")
59
-        return(datName)
60
-      }
61
-      inFile <- input$file1
62
-      if (is.null(inFile) & is.null(out)){
63
-        datName<-"SelectedPatterns.Rda"
64
-        return(datName)
65
-      }
66
-      if (is.null(inFile)){return(NULL)}
67
-      fn<-strsplit(inFile$name,"[.]")[[1]][1]
68
-      datName<-paste(fn,'.SelectedPatterns.Rda',sep="")
69
-      return(datName)
70
-    })
71
-
72
-
73
-    mdf=reactive({# use that to give options for subsetting, some formatting may need to be removed
74
-      dfx=df()
75
-      if (is.null(dfx)){return(NULL)}
76
-      mdf=melt(dfx,stringsAsFactors=FALSE) # melt the elements of the list
77
-      colnames(mdf)<-c("BySet","Samples","value","Patterns")
78
-      mdf$BySet<-as.character(mdf$BySet) # change them to characters
79
-      mdf$Samples<-as.character(mdf$Samples)
80
-      mdf$value=as.numeric(mdf$value) #make sure value is numeric for plotting
81
-      str(mdf)
82
-      return(mdf)
83
-    })
84
-
85
-
86
-    output$pickplot <- renderUI({# menu to select which matrix to look at/edit
87
-      if (is.null(df())){return(NULL)}
88
-      mdf2=mdf()
89
-      selectInput("whichplot", "Select the Pattern to Plot",choices=unique(mdf2$Patterns))
90
-    })
91
-
92
-
93
-    output$checkbs <- renderUI({# make the checkboxes for each row of each matrix
94
-      if (is.null(df())){return(NULL)}
95
-      mdf2=mdf()
96
-      lapply(unique(mdf2$Patterns), function(i) {
97
-        subss <- unique(mdf2$BySet[mdf2$Patterns==i]) # find the rows (after it has been melted)
98
-        tmp=sprintf("input.whichplot ==  %g", i) # create the javascript code to make this a conditional panel
99
-        conditionalPanel(
100
-          condition = tmp,
101
-          checkboxGroupInput(paste("subs",i,sep=""), i, choices=subss, selected=subss) # the actual checkboxes for each, subs1, subs2, subsn
102
-        )
103
-      })
104
-    })
105
-
106
-
107
-    output$plot1 <- renderPlot({#plot the data, subset to the desired columns
108
-      # if there has not been an uploaded matrix yet, don't even try to make a plot
109
-      if (is.null(df())){return(NULL)}
110
-      if (is.null(input$whichplot)){return(NULL)}
111
-      par(mar = c(5.1, 4.1, 0, 1))
112
-      mdf2=mdf() # grab the melted data frame to use the ggplot2 plot
113
-      x=input$whichplot # which matrix to show
114
-      x=as.numeric(x)
115
-      tmp=input[[paste("subs",x,sep="")]] # get the rows that have been selected
116
-      mdf2x=mdf2[which(mdf2$BySet%in%tmp),]
117
-      if (!is.null(order) & !is.null(sample.color)){
118
-       ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
119
-        geom_line() + scale_x_discrete(limits=order) +
120
-        theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1,colour = sample.color))
121
-      } else if(!is.null(sample.color) & is.null(order)) {
122
-      ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
123
-          geom_line() +
124
-          theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1,colour = sample.color))
125
-      } else if(!is.null(order) & is.null(sample.color) ) {
126
-        ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
127
-          geom_line() + scale_x_discrete(limits=order) +
128
-          theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1))
129
-      } else {
130
-        ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
131
-          geom_line() +
132
-          theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1))
133
-      }
134
-      #pplot
135
-      #browser()
136
-    })
137
-
138
-    # create and download the final result file
139
-    output$downloadData <- downloadHandler(
140
-      filename = datName(), # set the file name
141
-      content = function(file) {
142
-        PatternsSelect <- lapply(1:length(mdf()), function(i) {input[[paste("subs",i,sep="")]]})
143
-        save(PatternsSelect, file=file) # generate the object to save
144
-      }
145
-    )
146
-    #stop app and return to R
147
-    observeEvent(input$end, {
148
-      mdf2=mdf()
149
-      PatternsSelect <- sapply(1:length(df()), function(i) {input[[paste("subs",i,sep="")]]})
150
-      selectPBySet <- mdf2[which(mdf2$BySet%in%PatternsSelect),]
151
-      stopApp(returnValue = selectPBySet)
152
-    })
153
-
154
-
155
-
156
-  }
157
-
158
-)
159
-)
160
-
9
+patternMatcher<-function(PBySet=NULL,out=NULL,order=NULL, sample.color=NULL)
10
+{
11
+    runApp(list(
12
+        ui = pageWithSidebar(
13
+            # Application title
14
+            headerPanel('NMF Pattern Matching'),
15
+            # Side pannel with controls
16
+            sidebarPanel(
17
+                # to upload file
18
+                fileInput('file1', 'Choose .Rda File',
19
+                    accept=c('.RData','.Rda','R data object','.rda')),
20
+                uiOutput("pickplot"),
21
+                uiOutput("checkbs"),
22
+                downloadButton('downloadData', 'Download'),
23
+                actionButton("end", "Return")
24
+            ),
25
+            # Main panel with plots
26
+            mainPanel(plotOutput('plot1'))
27
+        ),
28
+
29
+        server = function(input, output, session)
30
+        {
31
+            #load in the data
32
+            df<-reactive({
33
+                if(!is.null(PBySet))
34
+                {
35
+                    df<-PBySet
36
+                    return(df)
37
+                }
38
+                inFile <- input$file1 # get the path to the input file on the server
39
+                if (is.null(inFile)){return(NULL)}
40
+                load(inFile$datapath) #load it
41
+                df <- get(load(inFile$datapath))# get the name of the object that was loaded
42
+                return(df)
43
+            })
44
+
45
+            # get data name
46
+            datName<-reactive({
47
+                if(!is.null(out))
48
+                {
49
+                    datName<-paste(out,'.SelectedPatterns.Rda',sep="")
50
+                    return(datName)
51
+                }
52
+                inFile <- input$file1
53
+                if (is.null(inFile) & is.null(out))
54
+                {
55
+                    datName<-"SelectedPatterns.Rda"
56
+                    return(datName)
57
+                }
58
+                if (is.null(inFile)){return(NULL)}
59
+                fn<-strsplit(inFile$name,"[.]")[[1]][1]
60
+                datName<-paste(fn,'.SelectedPatterns.Rda',sep="")
61
+                return(datName)
62
+            })
63
+
64
+
65
+            mdf=reactive({# use that to give options for subsetting, some formatting may need to be removed
66
+                dfx=df()
67
+                if (is.null(dfx)){return(NULL)}
68
+                mdf=melt(dfx,stringsAsFactors=FALSE) # melt the elements of the list
69
+                colnames(mdf)<-c("BySet","Samples","value","Patterns")
70
+                mdf$BySet<-as.character(mdf$BySet) # change them to characters
71
+                mdf$Samples<-as.character(mdf$Samples)
72
+                mdf$value=as.numeric(mdf$value) #make sure value is numeric for plotting
73
+                str(mdf)
74
+                return(mdf)
75
+            })
76
+
77
+
78
+            output$pickplot <- renderUI({# menu to select which matrix to look at/edit
79
+                if (is.null(df())){return(NULL)}
80
+                mdf2=mdf()
81
+                selectInput("whichplot", "Select the Pattern to Plot",choices=unique(mdf2$Patterns))
82
+            })
83
+
84
+            output$checkbs <- renderUI({# make the checkboxes for each row of each matrix
85
+                if (is.null(df())){return(NULL)}
86
+                mdf2=mdf()
87
+                lapply(unique(mdf2$Patterns), function(i) {
88
+                    subss <- unique(mdf2$BySet[mdf2$Patterns==i]) # find the rows (after it has been melted)
89
+                    tmp=sprintf("input.whichplot ==  %g", i) # create the javascript code to make this a conditional panel
90
+                    conditionalPanel(
91
+                        condition = tmp,
92
+                        checkboxGroupInput(paste("subs",i,sep=""), i, choices=subss, selected=subss) # the actual checkboxes for each, subs1, subs2, subsn
93
+                    )
94
+                })
95
+            })
96
+
97
+
98
+            output$plot1 <- renderPlot({#plot the data, subset to the desired columns
99
+                # if there has not been an uploaded matrix yet, don't even try to make a plot
100
+                if (is.null(df())){return(NULL)}
101
+                if (is.null(input$whichplot)){return(NULL)}
102
+                par(mar = c(5.1, 4.1, 0, 1))
103
+                mdf2=mdf() # grab the melted data frame to use the ggplot2 plot
104
+                x=input$whichplot # which matrix to show
105
+                x=as.numeric(x)
106
+                tmp=input[[paste("subs",x,sep="")]] # get the rows that have been selected
107
+                mdf2x=mdf2[which(mdf2$BySet%in%tmp),]
108
+                if (!is.null(order) & !is.null(sample.color))
109
+                {
110
+                    ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
111
+                    geom_line() + scale_x_discrete(limits=order) +
112
+                    theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1,colour = sample.color))
113
+                }
114
+                else if(!is.null(sample.color) & is.null(order))
115
+                {
116
+                    ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
117
+                    geom_line() +
118
+                    theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1,colour = sample.color))
119
+                }
120
+                else if(!is.null(order) & is.null(sample.color) )
121
+                {
122
+                    ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
123
+                    geom_line() + scale_x_discrete(limits=order) +
124
+                    theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1))
125
+                }
126
+                else
127
+                {
128
+                    ggplot(mdf2x, aes(x=Samples, y=value, col=BySet,group=BySet))+
129
+                    geom_line() +
130
+                    theme(axis.text.x = element_text(angle=45,family="Helvetica-Narrow", hjust = 1))
131
+                }
132
+            })
133
+
134
+            # create and download the final result file
135
+            output$downloadData <- downloadHandler(
136
+                filename = datName(), # set the file name
137
+                content = function(file) {
138
+                    PatternsSelect <- lapply(1:length(mdf()), function(i) {input[[paste("subs",i,sep="")]]})
139
+                    save(PatternsSelect, file=file) # generate the object to save
140
+                }
141
+            )
142
+
143
+            #stop app and return to R
144
+            observeEvent(input$end, {
145
+                mdf2=mdf()
146
+                PatternsSelect <- sapply(1:length(df()), function(i) {input[[paste("subs",i,sep="")]]})
147
+                selectPBySet <- mdf2[which(mdf2$BySet%in%PatternsSelect),]
148
+                stopApp(returnValue = selectPBySet)
149
+            })
150
+        }
151
+    ))
161 152
 }
162 153
\ No newline at end of file
... ...
@@ -1,14 +1,15 @@
1 1
 #' Plot Number of Atoms
2 2
 #'
3 3
 #' @details a simple plot of the number of atoms
4
-#'  from one of the vectors returned with atom numbers
4
+#' from one of the vectors returned with atom numbers
5 5
 #' @param gapsRes the list resulting from applying GAPS
6 6
 #' @param type the atoms to plot, values are "sampA", "sampP" ,
7
-#'  "equilA", or "equilP" to plot sampling or equilibration teop
8
-#'  atom numbers
7
+#' "equilA", or "equilP" to plot sampling or equilibration teop
8
+#' atom numbers
9
+#' @return plot
9 10
 #' @examples
10
-#' # Load the outputs from gapsRun
11
-#' data('results')
11
+#' # Load the sample data from CoGAPS
12
+#' data(SimpSim)
12 13
 #' # Run plotAtoms
13 14
 #' plotAtoms(results,type="sampA")
14 15
 #'@export
... ...
@@ -2,11 +2,12 @@
2 2
 #'
3 3
 #' @details plots a series of diagnostic plots
4 4
 #' @param gapsRes list returned by CoGAPS
5
+#' @return plot
5 6
 #' @examples
6
-#' # Load the outputs from gapsRun
7
-#' data('results')
7
+#' # Load the sample data from CoGAPS
8
+#' data(SimpSim)
8 9
 #' # Run plotDiag
9
-#' plotDiag(results)
10
+#' plotDiag(SimpSim.result)
10 11
 #' @export
11 12
 plotDiag <-function(gapsRes)
12 13
 {
... ...
@@ -5,12 +5,13 @@
5 5
 #' @param A the mean A matrix
6 6
 #' @param P the mean P matrix
7 7
 #' @param outputPDF optional root name for PDF output, if
8
-#'  not specified, output goes to screen
8
+#' not specified, output goes to screen
9
+#' @return plot
9 10
 #' @examples
10
-#' # Load the outputs from gapsRun
11
-#' data('results')
12
-#' # Run plotGAPS with the correct arguments from 'results'
13
-#' plotGAPS(results$Amean,results$Pmean)
11
+#' # Load the sample data from CoGAPS
12
+#' data(SimpSim)
13
+#' # Run plotGAPS with arguments from CoGAPS results list
14
+#' plotGAPS(SimpSim.result$Amean, SimpSim.result$Pmean)
14 15
 #' @export
15 16
 plotGAPS <- function(A, P, outputPDF="")
16 17
 {
... ...
@@ -3,16 +3,17 @@
3 3
 #' @details plots the P matrix in a line plot with error bars
4 4
 #' @param Pmean matrix of mean values of P
5 5
 #' @param Psd matrix of standard deviation values of P
6
+#' @return plot
6 7
 #' @examples
7
-#' # Load the outputs from gapsRun
8
-#' data('results')
9
-#' # Run plotP with the correct arguments from 'results'
10
-#' plotP(results$Pmean,results$Psd)
8
+#' # Load the sample data from CoGAPS
9
+#' data(SimpSim)
10
+#' # Run plotP with arguments from CoGAPS results list
11
+#' plotP(SimpSim.result$Pmean, SimpSim.result$Psd)
11 12
 #' @export
12 13
 plotP <- function(Pmean, Psd)
13 14
 {
14
-    Nfactor=dim(Pmean)[1]
15
-    Nobs=dim(Pmean)[2]
15
+    Nfactor <- nrow(Pmean)
16
+    Nobs <- ncol(Pmean)
16 17
     RowP <- 1:Nobs
17 18
     colors <- rainbow(Nfactor)
18 19
     ylimits <- c(0,(max(Pmean + Psd)*1.05))
... ...
@@ -13,10 +13,8 @@
13 13
 #' @return heatmap of the \code{data} values for the \code{patternMarkers}
14 14
 #' @seealso  \code{\link{heatmap.2}}
15 15
 #' @examples
16
-#' # Load the simulated data
17
-#' data('SimpSim')
18
-#' # Load the outputs from gapsRun
19
-#' data('results')
16
+#' # Load the sample data from CoGAPS
17
+#' data(SimpSim)
20 18
 #' # Run patternMarkers and save the outputs
21 19
 #' PM <- patternMarkers(Amatrix=results$Amean,scaledPmatrix=FALSE,
22 20
 #' Pmatrix=results$Pmean,threshold="all",full=TRUE)
... ...
@@ -1,6 +1,7 @@
1
-#'\code{plotSmoothPatterns} plots the output A and P matrices as a
2
-#' heatmap and line plot respectively
1
+#' Plot Smooth Patterns
3 2
 #'
3
+#' @details plots the output A and P matrices as a heatmap and a
4
+#' line plot respectively
4 5
 #' @param P the mean A matrix
5 6
 #' @param x optional variables
6 7
 #' @param breaks breaks in plots
... ...
@@ -10,11 +11,12 @@
10 11
 #' @param pointCol color of points
11 12
 #' @param lineCol color of line
12 13
 #' @param add logical specifying if bars should be added to an already existing
13
-#'  plot; defaults to `FALSE'.
14
+#' plot; defaults to `FALSE'.
14 15
 #' @param ... arguments to be passed to/from other methods.  For the default
15
-#'  method these can include further arguments (such as `axes', `asp' and
16
-#'  `main') and graphical parameters (see `par') which are passed to
17
-#"  `plot.window()', `title()' and `axis'.
16
+#' method these can include further arguments (such as `axes', `asp' and
17
+#' `main') and graphical parameters (see `par') which are passed to
18
+#' `plot.window()', `title()' and `axis'.
19
+#' @return plot
18 20
 #' @export
19 21
 plotSmoothPatterns <- function(P, x=NULL, breaks=NULL, breakStyle=TRUE,
20 22
 orderP=!all(is.null(x)), plotPTS=FALSE, pointCol='black', lineCol='grey',
... ...
@@ -54,7 +56,7 @@ add=FALSE, ...)
54 56
             }
55 57
             else
56 58
             {
57
-                stop('CoGAPS: plotSmoothPatterns: number of plot boundaries must match number of breaks in the plot')
59
+                stop('number of plot boundaries must match number of breaks')
58 60
             }
59 61
         }
60 62
     }
... ...
@@ -62,14 +64,15 @@ add=FALSE, ...)
62 64
     # check that dimensions agree
63 65
     if (ncol(P) != length(x))
64 66
     {
65
-        stop('CoGAPS: plotSmoothPatterns: length of x coordinates must match number of samples in the columns of the P matrix')
67
+        stop('length of x coordinates must match number of samples')
66 68
     }
67 69
 
68
-    # If desired, reorder samples according to the group in which they obtain their maximum
70
+    # reorder samples according to the group in which they obtain their maximum
69 71
     if (orderP)
70 72
     {
71 73
         PMax <- apply(P,1,max)
72
-        xMax <- seq(from=ncol(P)+1,length.out=nrow(P))[order(PMax,decreasing=TRUE)]
74
+        xMax <- seq(from=ncol(P)+1, length.out=nrow(P))
75
+        xMax <- xMax[order(PMax,decreasing=TRUE)]
73 76
         xTmp <- x
74 77
         PTmp <- P
75 78
         for (iP in order(PMax,decreasing=TRUE))
... ...
@@ -1,10 +1,10 @@
1
-#' postFixed4Parallel
1
+#' Post Processing of Parallel Output
2 2
 #'
3 3
 #' @param AP.fixed output of parallel gapsMapRun calls with same FP
4
-#' @param setPs data.frame with rows giving fixed patterns for P used as input for gapsMapRun
5
-#'
6
-#' @return list of two data.frames containing the A matrix estimates or their corresponding standard deviations
7
-#' from output of parallel gapsMapRun
4
+#' @param setPs data.frame with rows giving fixed patterns for P used as input
5
+#' for gapsMapRun
6
+#' @return list of two data.frames containing the A matrix estimates or their
7
+#' corresponding standard deviations from output of parallel CoGAPS
8 8
 #' @export
9 9
 postFixed4Parallel <- function(AP.fixed=NA, setPs=NA)
10 10
 {
... ...
@@ -1,16 +1,13 @@
1 1
 #' reOrderBySet
2 2
 #'
3
-#' @description <restructures output of gapsRun into a list containing each sets solution for Amean, Pmean, and Asd>
4
-#' @param AP output of gapsRun in parallel
3
+#' @details restructures output of CoGAPS into a list containing each sets
4
+#' solution for Amean, Pmean, and Asd
5
+#' @param AP output of GWCoGAPS in parallel
5 6
 #' @param nFactor number of patterns
6 7
 #' @param nSets number of sets
7
-#'
8
-#' @return a list containing the \code{nSets} sets solution for Amean under "A", Pmean under "P", and Asd under "Asd"
8
+#' @return a list containing the \code{nSets} sets solution for Amean under "A",
9
+#' Pmean under "P", and Asd under "Asd"
9 10
 #' @export
10
-#'
11
-#' @examples \dontrun{
12
-#' reOrderBySet(AP,nFactor,nSets)
13
-#' }
14 11
 reOrderBySet<-function(AP, nFactor, nSets)
15 12
 {
16 13
     P<-do.call(rbind,lapply(AP, function(x) x$Pmean))
... ...
@@ -5,12 +5,12 @@
5 5
 #' @param genes an index of the gene or genes of interest
6 6
 #' @return the D' estimate of a gene or set of genes
7 7
 #' @examples
8
-#' # Load the simulated data
9
-#' data('SimpSim')
8
+#' # Load the sample data from CoGAPS
9
+#' data(SimpSim)
10 10
 #' # Run reconstructGene
11
-#' reconstructGene(A=SimpSim.A,P=SimpSim.P)
11
+#' reconstructGene(SimpSim.result$Amean, SimpSim.result$Pmean)
12 12
 #' @export
13
-reconstructGene<-function(A=NA, P=NA, genes=NA)
13
+reconstructGene<-function(A, P, genes=NA)
14 14
 {
15 15
     Dneu <- A %*% P
16 16
     if (!is.na(genes))
... ...
@@ -1,15 +1,15 @@
1
-#'\code{reorderByPatternMatch} plots the output A and P matrices as a
2
-#' heatmap and line plot respectively
1
+#' Reorder By Pattern Match
3 2
 #'
4
-#'@param P matrix to be matched
5
-#'@param matchTo matrix to match P to
6
-#'@export
3
+#' @param P matrix to be matched
4
+#' @param matchTo matrix to match P to
5
+#' @return matched patterns
6
+#' @export
7 7
 reorderByPatternMatch <- function(P, matchTo)
8 8
 {
9
-    # check that P and the matchTo matrix have the same dimensions for valid matching
9
+    # check that P and the matchTo matrix have the same dimensions
10 10
     if (nrow(matchTo) != nrow(P) | ncol(matchTo) != ncol(P))
11 11
     {
12
-       stop('CoGAPS: reorderByPatternMatch: dimensions of P and matchTo must agree')
12
+        stop('dimensions of P and matchTo must agree')
13 13
     }
14 14
 
15 15
     # ensuring that rownames match for simplicty of matching process
... ...
@@ -5,13 +5,12 @@
5 5
 #' @param PMean_Mat matrix of mean values for P from GAPS
6 6
 #' @param D original data matrix run through GAPS
7 7
 #' @param S original standard deviation matrix run through GAPS
8
+#' @return creates a residual plot
8 9
 #' @examples
9
-#' # Load the simulated data
10
-#' data('SimpSim')
11
-#' # Load the outputs from gapsRun
12
-#' data('results')
10
+#' # Load the sample data from CoGAPS
11
+#' data(SimpSim)
13 12
 #' # Run residuals with the correct arguments
14
-#' residuals(results$Amean,results$Pmean,SimpSim.D,SimpSim.S)
13
+#' residuals(SimpSim.result$Amean, SimpSim.result$Pmean, SimpSim.D, SimpSim.S)
15 14
 #' @export
16 15
 residuals <- function(AMean_Mat, PMean_Mat, D, S)
17 16
 {
18 17
Binary files a/data/SimpSim.RData and b/data/SimpSim.RData differ
19 18
deleted file mode 100644
20 19
Binary files a/data/results.RData and /dev/null differ
21 20
deleted file mode 100644
22 21
Binary files a/data/resultsCo.Rdata and /dev/null differ
... ...
@@ -58,7 +58,11 @@ CoGAPS Matrix Factorization Algorithm
58 58
 }
59 59
 \details{
60 60
 calls the C++ MCMC code and performs Bayesian
61
- matrix factorization returning the two matrices that reconstruct
62
- the data matrix
61
+matrix factorization returning the two matrices that reconstruct
62
+the data matrix
63
+}
64
+\examples{
65
+data(SimpSim)
66
+result <- CoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nOutputs=250)
63 67
 }
64 68
 
... ...
@@ -32,16 +32,22 @@ greater than or equal to the number of rows of FP}
32 32
 
33 33
 \item{...}{additional parameters to be fed into \code{gapsRun} and \code{gapsMapRun}}
34 34
 }
35
+\value{
36
+list of A and P estimates
37
+}
35 38
 \description{
36
-\code{GWCoGAPS} calls the C++ MCMC code and performs Bayesian
39
+GWCoGAPS
40
+}
41
+\details{
42
+calls the C++ MCMC code and performs Bayesian
37 43
 matrix factorization returning the two matrices that reconstruct
38 44
 the data matrix for whole genome data;
39 45
 }
40 46
 \examples{
41
-# Load the simulated data
42
-data('SimpSim')
47
+# Load the sample data from CoGAPS
48
+data(SimpSim)
43 49
 # Run GWCoGAPS
44
-GWCoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nSets=2, numSnapshots = 5)
50
+GWCoGAPS(SimpSim.D, SimpSim.S, nFactor=3, nSets=2)
45 51
 }
46 52
 \seealso{
47 53
 \code{\link{gapsRun}}, \code{\link{patternMatch4Parallel}}, and \code{\link{gapsMapRun}}
48 54
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+\name{SimpSim.result}
2
+\docType{data}
3
+\alias{SimpSim.result}
4
+\title{Simulated Data Results}
5
+\description{Resulting list created by calling CoGAPS on simulated data}
6
+\usage{SimpSim.result}
7
+\format{list}
8
+\keyword{datasets}
... ...
@@ -14,18 +14,21 @@ binaryA(Amean, Asd, threshold = 3)
14 14
 \item{threshold}{the number of standard deviations above zero
15 15
 that an element of Amean must be to get a value of 1}
16 16
 }
17
+\value{
18
+plots a heatmap of the A Matrix
19
+}
17 20
 \description{
18 21
 Binary Heatmap for Standardized A Matrix
19 22
 }
20 23
 \details{
21 24
 creates a binarized heatmap of the A matrix
22
- in which the value is 1 if the value in Amean is greater than
23
- threshold * Asd and 0 otherwise
25
+in which the value is 1 if the value in Amean is greater than
26
+threshold * Asd and 0 otherwise
24 27
 }
25 28
 \examples{
26
-# Load the outputs from gapsRun
27
-data('results')
29
+# Load the sample data from CoGAPS
30
+data(SimpSim)
28 31
 # Run binaryA with the correct arguments from 'results'
29
-binaryA(results$Amean,results$Asd,threshold=3)
32
+binaryA(SimpSim.result$Amean, SimpSim.result$Asd, threshold=3)
30 33
 }
31 34
 
... ...
@@ -15,20 +15,22 @@ calcCoGAPSStat(Amean, Asd, GStoGenes, numPerm = 500)
15 15
 
16 16
 \item{numPerm}{number of permutations for null}
17 17
 }
18
+\value{
19
+gene set statistics for each column of A
20
+}
18 21
 \description{
19 22
 Calculate Gene Set Statistics
20 23
 }
21 24
 \details{
22 25
 calculates the gene set statistics for each
23
- column of A using a Z-score from the elements of the A matrix,
24
- the input gene set, and permutation tests
26
+column of A using a Z-score from the elements of the A matrix,
27
+the input gene set, and permutation tests
25 28
 }
26 29
 \examples{
27
-# Load the simulated data
28
-data('SimpSim')
29
-# Load the outputs from gapsRun
30
-data('results')
30
+# Load the sample data from CoGAPS
31
+data(SimpSim)
31 32
 # Run calcCoGAPSStat with the correct arguments from 'results'
32
-calcCoGAPSStat(results$Amean,results$Asd,GStoGenes=GSets,numPerm=500)
33
+calcCoGAPSStat(SimpSim.result$Amean, SimpSim.result$Asd,
34
+GStoGenes=GSets, numPerm=500)
33 35
 }
34 36
 
... ...
@@ -18,22 +18,24 @@ calcGeneGSStat(Amean, Asd, GSGenes, numPerm, Pw = rep(1, ncol(Amean)),
18 18
 
19 19
 \item{Pw}{weight on genes}
20 20
 
21
-\item{nullGenes}{- logical indicating gene adjustment}
21
+\item{nullGenes}{logical indicating gene adjustment}
22
+}
23
+\value{
24
+gene similiarity statistic
22 25
 }
23 26
 \description{
24 27
 Probability Gene Belongs in Gene Set
25 28
 }
26 29
 \details{
27 30
 calculates the probability that a gene
28
- listed in a gene set behaves like other genes in the set within
29
- the given data set
31
+listed in a gene set behaves like other genes in the set within
32
+the given data set
30 33
 }
31 34
 \examples{
32
-# Load the simulated data
35
+# Load the sample data from CoGAPS
33 36
 data('SimpSim')
34
-# Load the outputs from gapsRun
35
-data('results')
36 37
 # Run calcGeneGSStat with the correct arguments from 'results'
37
-calcGeneGSStat(results$Amean,results$Asd,GSGenes=GSets[[1]],numPerm=500)
38
+calcGeneGSStat(SimpSim.result$Amean, SimpSim.result$Asd, 
39
+GSGenes=GSets[[1]], numPerm=500)
38 40
 }
39 41
 
... ...
@@ -11,17 +11,20 @@ calcZ(meanMat, sdMat)
11 11
 
12 12
 \item{sdMat}{matrix of standard deviation values}
13 13
 }
14
+\value{
15
+matrix of z-scores
16
+}
14 17
 \description{
15 18
 Compute Z-Score Matrix
16 19
 }
17 20
 \details{
18 21
 calculates the Z-score for each element based on input mean
19
- and standard deviation matrices
22
+and standard deviation matrices
20 23
 }
21 24
 \examples{
22
-# Load the simulated data
23
-data('SimpSim')
25
+# Load the sample data from CoGAPS
26
+data(SimpSim)
24 27
 # Run calcZ
25
-calcZ(SimpSim.D,SimpSim.S)
28
+calcZ(SimpSim.result$Amean, SimpSim.result$Asd)
26 29
 }
27 30
 
... ...
@@ -22,16 +22,23 @@ computeGeneGSProb(Amean, Asd, GSGenes, Pw = rep(1, ncol(Amean)),
22 22
 }
23 23
 \value{
24 24
 A vector of length GSGenes containing the p-values of set membership
25
- for each gene containined in the set specified in GSGenes.
25
+for each gene containined in the set specified in GSGenes.
26 26
 }
27 27
 \description{
28 28
 Compute Gene Probability
29 29
 }
30 30
 \details{
31 31
 Computes the p-value for gene set membership using the CoGAPS-based
32
- statistics developed in Fertig et al. (2012).  This statistic refines set
33
- membership for each candidate gene in a set specified in \code{GSGenes} by
34
- comparing the inferred activity of that gene to the average activity of the
35
- set.
32
+statistics developed in Fertig et al. (2012).  This statistic refines set
33
+membership for each candidate gene in a set specified in \code{GSGenes} by
34
+comparing the inferred activity of that gene to the average activity of the
35
+set.
36
+}
37
+\examples{
38
+# Load the sample data from CoGAPS
39
+data('SimpSim')
40
+# Run calcGeneGSStat with the correct arguments from 'results'
41
+calcGeneGSStat(SimpSim.result$Amean, SimpSim.result$Asd, 
42
+GSGenes=GSets[[1]], numPerm=500)
36 43
 }
37 44
 
... ...
@@ -26,9 +26,9 @@ Create Gene Sets for GWCoGAPS
26 26
 factors whole genome data into randomly generated sets for indexing
27 27
 }
28 28
 \examples{
29
-# Load the simulated data
30
-data('SimpSim')
29
+# Load the sample data from CoGAPS
30
+data(SimpSim)
31 31
 # Run createGWCoGAPSSets
32
-createGWCoGAPSSets(SimpSim.D,nSets=2)
32
+createGWCoGAPSSets(SimpSim.D, nSets=2)
33 33
 }
34 34
 
... ...
@@ -6,6 +6,9 @@
6 6
 \usage{
7 7
 displayBuildReport()
8 8
 }
9
+\value{
10
+display builds information
11
+}
9 12
 \description{
10 13
 Display Information About Package Compilation
11 14
 }
... ...
@@ -13,4 +16,7 @@ Display Information About Package Compilation
13 16
 displays information about how the package was compiled, i.e. which
14 17
  compiler/version was used, which compile time options were enabled, etc...
15 18
 }
19
+\examples{
20
+ CoGAPS::displayBuildReport()
21
+}
16 22
 
... ...
@@ -19,6 +19,6 @@ vector of randomly generated seeds
19 19
 Generate Seeds for Multiple Concurrent Runs
20 20
 }
21 21
 \examples{
22
-generateSeeds(chains=2, seed=-1)
22
+seeds <- generateSeeds(chains=2, seed=-1)
23 23
 }
24 24
 
... ...
@@ -28,8 +28,8 @@ genes rankings with a column for each \code{lp} will also be returned.
28 28
 patternMarkers
29 29
 }
30 30
 \examples{
31
-# Load the outputs from gapsRun
32
-data('results')
31
+# Load the sample data from CoGAPS
32
+data(SimpSim)
33 33
 # Run patternMarkers with the correct arguments from 'results'
34 34
 patternMarkers(Amatrix=results$Amean,scaledPmatrix=FALSE,
35 35
 Pmatrix=results$Pmean,threshold="all",full=TRUE)
... ...
@@ -22,11 +22,4 @@ either an index of selected sets' contributions or the editted \code{PBySet} obj
22 22
 \description{
23 23
 PatternMatcher Shiny Ap
24 24
 }
25
-\examples{
26
-\dontrun{
27
-patternMatcher(PBySet,out,order,sample.color)
28
-}
29
-
30
-
31
-}
32 25
 
... ...
@@ -13,16 +13,19 @@ plotAtoms(gapsRes, type = "sampA")
13 13
 "equilA", or "equilP" to plot sampling or equilibration teop
14 14
 atom numbers}
15 15
 }
16
+\value{
17
+plot
18
+}
16 19
 \description{
17 20
 Plot Number of Atoms
18 21
 }
19 22
 \details{
20 23
 a simple plot of the number of atoms
21
- from one of the vectors returned with atom numbers
24
+from one of the vectors returned with atom numbers
22 25
 }
23 26
 \examples{
24
-# Load the outputs from gapsRun
25
-data('results')
27
+# Load the sample data from CoGAPS
28
+data(SimpSim)
26 29
 # Run plotAtoms
27 30
 plotAtoms(results,type="sampA")
28 31
 }
... ...
@@ -9,6 +9,9 @@ plotDiag(gapsRes)
9 9
 \arguments{
10 10
 \item{gapsRes}{list returned by CoGAPS}
11 11
 }
12
+\value{
13
+plot
14
+}
12 15
 \description{
13 16
 Diagnostic Plots
14 17
 }
... ...
@@ -16,9 +19,9 @@ Diagnostic Plots
16 19
 plots a series of diagnostic plots
17 20
 }
18 21
 \examples{
19
-# Load the outputs from gapsRun
20
-data('results')
22
+# Load the sample data from CoGAPS
23
+data(SimpSim)
21 24
 # Run plotDiag
22
-plotDiag(results)
25
+plotDiag(SimpSim.result)
23 26
 }
24 27
 
... ...
@@ -14,6 +14,9 @@ plotGAPS(A, P, outputPDF = "")
14 14
 \item{outputPDF}{optional root name for PDF output, if
15 15
 not specified, output goes to screen}
16 16
 }
17
+\value{
18
+plot
19
+}
17 20
 \description{
18 21
 Plot Decomposed A and P Matrices
19 22
 }
... ...
@@ -22,9 +25,9 @@ plots the output A and P matrices as a
22 25
 heatmap and line plot respectively
23 26
 }
24 27
 \examples{
25
-# Load the outputs from gapsRun
26
-data('results')
27
-# Run plotGAPS with the correct arguments from 'results'
28
-plotGAPS(results$Amean,results$Pmean)
28
+# Load the sample data from CoGAPS
29
+data(SimpSim)
30
+# Run plotGAPS with arguments from CoGAPS results list
31
+plotGAPS(SimpSim.result$Amean, SimpSim.result$Pmean)
29 32
 }
30 33
 
... ...
@@ -11,6 +11,9 @@ plotP(Pmean, Psd)
11 11
 
12 12
 \item{Psd}{matrix of standard deviation values of P}
13 13
 }
14
+\value{
15
+plot
16
+}
14 17
 \description{
15 18
 Plot the P Matrix
16 19
 }
... ...
@@ -18,9 +21,9 @@ Plot the P Matrix
18 21
 plots the P matrix in a line plot with error bars
19 22
 }
20 23
 \examples{
21
-# Load the outputs from gapsRun
22
-data('results')
23
-# Run plotP with the correct arguments from 'results'
24
-plotP(results$Pmean,results$Psd)
24
+# Load the sample data from CoGAPS
25
+data(SimpSim)
26
+# Run plotP with arguments from CoGAPS results list
27
+plotP(SimpSim.result$Pmean, SimpSim.result$Psd)
25 28
 }
26 29
 
... ...
@@ -35,10 +35,8 @@ heatmap of the \code{data} values for the \code{patternMarkers}
35 35
 plotPatternMarkers
36 36
 }
37 37
 \examples{
38
-# Load the simulated data
39
-data('SimpSim')
40
-# Load the outputs from gapsRun
41
-data('results')
38
+# Load the sample data from CoGAPS
39
+data(SimpSim)
42 40
 # Run patternMarkers and save the outputs
43 41
 PM <- patternMarkers(Amatrix=results$Amean,scaledPmatrix=FALSE,
44 42
 Pmatrix=results$Pmean,threshold="all",full=TRUE)
... ...
@@ -2,8 +2,7 @@
2 2
 % Please edit documentation in R/plotSmoothPatterns.R
3 3
 \name{plotSmoothPatterns}
4 4
 \alias{plotSmoothPatterns}
5
-\title{\code{plotSmoothPatterns} plots the output A and P matrices as a
6
-heatmap and line plot respectively}
5
+\title{Plot Smooth Patterns}
7 6
 \usage{
8 7
 plotSmoothPatterns(P, x = NULL, breaks = NULL, breakStyle = TRUE,
9 8
   orderP = !all(is.null(x)), plotPTS = FALSE, pointCol = "black",
... ...
@@ -31,10 +30,17 @@ plot; defaults to `FALSE'.}
31 30
 
32 31
 \item{...}{arguments to be passed to/from other methods.  For the default
33 32
 method these can include further arguments (such as `axes', `asp' and
34
-`main') and graphical parameters (see `par') which are passed to}
33
+`main') and graphical parameters (see `par') which are passed to
34
+`plot.window()', `title()' and `axis'.}
35
+}
36
+\value{
37
+plot
35 38
 }
36 39
 \description{
37
-\code{plotSmoothPatterns} plots the output A and P matrices as a
38
-heatmap and line plot respectively
40
+Plot Smooth Patterns
41
+}
42
+\details{
43
+plots the output A and P matrices as a heatmap and a
44
+line plot respectively
39 45
 }
40 46
 
... ...
@@ -2,20 +2,21 @@
2 2
 % Please edit documentation in R/postFixed4Parallel.R
3 3
 \name{postFixed4Parallel}
4 4
 \alias{postFixed4Parallel}
5
-\title{postFixed4Parallel}
5
+\title{Post Processing of Parallel Output}
6 6
 \usage{
7 7
 postFixed4Parallel(AP.fixed = NA, setPs = NA)
8 8
 }
9 9
 \arguments{
10 10
 \item{AP.fixed}{output of parallel gapsMapRun calls with same FP}
11 11
 
12
-\item{setPs}{data.frame with rows giving fixed patterns for P used as input for gapsMapRun}
12
+\item{setPs}{data.frame with rows giving fixed patterns for P used as input
13
+for gapsMapRun}
13 14
 }
14 15
 \value{
15
-list of two data.frames containing the A matrix estimates or their corresponding standard deviations
16
-from output of parallel gapsMapRun
16
+list of two data.frames containing the A matrix estimates or their
17
+corresponding standard deviations from output of parallel CoGAPS
17 18
 }
18 19
 \description{
19
-postFixed4Parallel
20
+Post Processing of Parallel Output
20 21
 }
21 22
 
... ...
@@ -7,21 +7,21 @@
7 7
 reOrderBySet(AP, nFactor, nSets)
8 8
 }
9 9
 \arguments{
10
-\item{AP}{output of gapsRun in parallel}
10
+\item{AP}{output of GWCoGAPS in parallel}
11 11
 
12 12
 \item{nFactor}{number of patterns}
13 13
 
14 14
 \item{nSets}{number of sets}
15 15
 }
16 16
 \value{
17
-a list containing the \code{nSets} sets solution for Amean under "A", Pmean under "P", and Asd under "Asd"
17
+a list containing the \code{nSets} sets solution for Amean under "A",
18
+Pmean under "P", and Asd under "Asd"
18 19
 }
19 20
 \description{
20
-<restructures output of gapsRun into a list containing each sets solution for Amean, Pmean, and Asd>
21
-}
22
-\examples{
23
-\dontrun{
24
-reOrderBySet(AP,nFactor,nSets)
21
+reOrderBySet
25 22
 }
23
+\details{