From c1f953e3f3bce6f6e0070a9dd664294c06bedfd8 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Fri, 4 Apr 2014 11:22:43 -0700 Subject: [PATCH 1/3] roxygen changed its mind about indentation again, i guess --- man/COMPASS.Rd | 124 ++++++++-------- man/COMPASSContainer.Rd | 34 ++--- man/COMPASSContainerFromGatingSet.Rd | 35 ++--- man/COMPASSDescription.Rd | 6 +- man/CellCounts.Rd | 12 +- man/Combinations.Rd | 2 +- man/FunctionalityScore.Rd | 7 +- man/GetThresholdedIntensities.Rd | 8 +- man/PolyfunctionalityScore.Rd | 19 ++- man/Posterior.Rd | 2 +- man/SimpleCOMPASS.Rd | 34 ++--- man/TotalCellCounts.Rd | 14 +- man/UniqueCombinations.Rd | 8 +- man/melt_.Rd | 19 ++- man/merge.COMPASSContainer.Rd | 6 +- man/pheatmap.Rd | 202 +++++++++++---------------- man/plot.COMPASSResult.Rd | 76 +++++----- man/plot2.Rd | 40 +++--- man/print.COMPASSContainer.Rd | 4 +- man/print.COMPASSResult.Rd | 4 +- man/shinyCOMPASS.Rd | 33 ++--- man/shinyCOMPASSDeps.Rd | 4 +- man/subset.COMPASSContainer.Rd | 8 +- man/summary.COMPASSContainer.Rd | 5 +- man/summary.COMPASSResult.Rd | 4 +- man/transpose_list.Rd | 2 +- 26 files changed, 305 insertions(+), 407 deletions(-) diff --git a/man/COMPASS.Rd b/man/COMPASS.Rd index cbba56e..706dafd 100644 --- a/man/COMPASS.Rd +++ b/man/COMPASS.Rd @@ -10,61 +10,50 @@ COMPASS(data, treatment, control, subset = NULL, keep_original_data = TRUE, verbose = TRUE, ...) } \arguments{ - \item{data}{An object of class \code{COMPASSContainer}.} - - \item{treatment}{An \R expression, evaluated within the - metadata, that returns \code{TRUE} for those samples that - should belong to the treatment group. For example, if the - samples that received a positive stimulation were named - \code{"92TH023 Env"} within a variable in \code{meta} - called \code{Stim}, you could write \code{Stim == - "92TH023 Env"}. The expression should have the name of - the stimulation vector on the left hand side.} - - \item{control}{An \R expression, evaluated within the - metadata, that returns \code{TRUE} for those samples that - should belong to the control group. See above for - details.} - - \item{subset}{An expression used to subset the data. We - keep only the samples for which the expression evaluates - to \code{TRUE} in the metadata.} - - \item{category_filter}{A filter for the categories that - are generated. This is a function that will be applied to - the \emph{treatment counts} matrix generated from the - intensities. Only categories meeting the - \code{category_filter} criteria will be kept.} - - \item{filter_lowest_frequency}{A number specifying how - many of the least expressed markers should be removed.} - - \item{filter_specific_markers}{Similar to - \code{filter_lowest_frequency}, but lets you explicitly - exclude markers.} - - \item{model}{A string denoting which model to fit; - currently, only the discrete model (\code{"discrete"}) is - available.} - - \item{iterations}{The number of iterations (per - 'replication') to perform.} - - \item{replications}{The number of 'replications' to - perform. In order to conserve memory, we only keep the - model estimates from the last replication.} - - \item{keep_original_data}{Keep the original - \code{COMPASSContainer} as part of the \code{COMPASS} - output? Note that if you want to run \code{shinyCOMPASS} - later, it is necessary that you set this as \code{TRUE}. - If memory or disk space is an issue, you may set this to - \code{FALSE}.} - - \item{verbose}{Boolean; if \code{TRUE} we output progress - information.} - - \item{...}{Other arguments; currently unused.} +\item{data}{An object of class \code{COMPASSContainer}.} + +\item{treatment}{An \R expression, evaluated within the metadata, that +returns \code{TRUE} for those samples that should belong to the +treatment group. For example, if the samples that received a positive +stimulation were named \code{"92TH023 Env"} within a variable in +\code{meta} called \code{Stim}, you could write \code{Stim == "92TH023 Env"}. +The expression should have the name of the stimulation vector on the +left hand side.} + +\item{control}{An \R expression, evaluated within the metadata, that +returns \code{TRUE} for those samples that should belong to the +control group. See above for details.} + +\item{subset}{An expression used to subset the data. We keep only the samples +for which the expression evaluates to \code{TRUE} in the metadata.} + +\item{category_filter}{A filter for the categories that are generated. This is a +function that will be applied to the \emph{treatment counts} matrix generated from +the intensities. Only categories meeting the \code{category_filter} criteria will +be kept.} + +\item{filter_lowest_frequency}{A number specifying how many of the least +expressed markers should be removed.} + +\item{filter_specific_markers}{Similar to \code{filter_lowest_frequency}, +but lets you explicitly exclude markers.} + +\item{model}{A string denoting which model to fit; currently, only +the discrete model (\code{"discrete"}) is available.} + +\item{iterations}{The number of iterations (per 'replication') to perform.} + +\item{replications}{The number of 'replications' to perform. In order to +conserve memory, we only keep the model estimates from the last replication.} + +\item{keep_original_data}{Keep the original \code{COMPASSContainer} +as part of the \code{COMPASS} output? Note that if you want to run +\code{shinyCOMPASS} later, it is necessary that you set this as \code{TRUE}. +If memory or disk space is an issue, you may set this to \code{FALSE}.} + +\item{verbose}{Boolean; if \code{TRUE} we output progress information.} + +\item{...}{Other arguments; currently unused.} } \value{ A \code{COMPASSResult} is a list with the following components: @@ -130,19 +119,18 @@ fit. This function fits the \code{COMPASS} model. } \section{Category Filter}{ - The category filter is used to exclude categories - (combinations of markers expressed for a particular cell) - that are expressed very rarely. It is applied to the - \code{treatment} \emph{counts} matrix, which is a - \code{N} samples by \code{K} categories matrix. Those - categories which are mostly unexpressed can be excluded - here. For example, the default criteria, - - \code{category_filter=function(x) colSums(x > 5) > 2} - - indicates that we should only retain categories for which - at least two samples had at least 5 cells expressing that - particular combination of markers. + +The category filter is used to exclude categories (combinations of +markers expressed for a particular cell) that are expressed very rarely. +It is applied to the \code{treatment} \emph{counts} matrix, which is a +\code{N} samples by \code{K} categories matrix. Those categories which +are mostly unexpressed can be excluded here. For example, the default +criteria, + +\code{category_filter=function(x) colSums(x > 5) > 2} + +indicates that we should only retain categories for which at least two samples +had at least 5 cells expressing that particular combination of markers. } \examples{ data(COMPASS) ## loads the COMPASSContainer 'CC' diff --git a/man/COMPASSContainer.Rd b/man/COMPASSContainer.Rd index 9baf586..6a1c486 100644 --- a/man/COMPASSContainer.Rd +++ b/man/COMPASSContainer.Rd @@ -6,29 +6,25 @@ COMPASSContainer(data, counts, meta, individual_id, sample_id) } \arguments{ - \item{data}{A list of matrices. Each matrix \code{M_i} is - made up of \code{N_i} cells by \code{K} markers; for - example, it could be the intensity information from an - intracellular cytokine experiment. Each element of the - list should be named; this name denotes which sample the - cell intensities were measured from.} +\item{data}{A list of matrices. Each matrix \code{M_i} is made up of +\code{N_i} cells by \code{K} markers; for example, it could be the +intensity information from an intracellular cytokine experiment. +Each element of the list should be named; this name denotes which +sample the cell intensities were measured from.} - \item{counts}{A named integer vector of the cell counts - for each sample in \code{data}.} +\item{counts}{A named integer vector of the cell counts for each +sample in \code{data}.} - \item{meta}{A \code{data.frame} of metadata, describing - the individuals in the experiment. Each row in - \code{meta} should correspond to a row in \code{data}. - There should be one row for each sample; i.e., one row - for each element of \code{data}.} +\item{meta}{A \code{data.frame} of metadata, describing the individuals +in the experiment. Each row in \code{meta} should correspond to a row +in \code{data}. There should be one row for each sample; +i.e., one row for each element of \code{data}.} - \item{individual_id}{The name of the vector in - \code{meta} that denotes the individuals from which - samples were drawn.} +\item{individual_id}{The name of the vector in \code{meta} that denotes the +individuals from which samples were drawn.} - \item{sample_id}{The name of the vector in \code{meta} - that denotes the samples. This vector should contain all - of the names in the \code{data} input.} +\item{sample_id}{The name of the vector in \code{meta} that denotes the samples. + This vector should contain all of the names in the \code{data} input.} } \value{ A \code{COMPASSContainer} returns a list made up of the same diff --git a/man/COMPASSContainerFromGatingSet.Rd b/man/COMPASSContainerFromGatingSet.Rd index a3e0010..53c5c91 100644 --- a/man/COMPASSContainerFromGatingSet.Rd +++ b/man/COMPASSContainerFromGatingSet.Rd @@ -9,37 +9,26 @@ COMPASSContainerFromGatingSet(gs = NULL, node = NULL, filter.fun = NULL, markers = NA) } \arguments{ - \item{gs}{a \code{GatingSet} or \code{GatingSetList}} +\item{gs}{a \code{GatingSet} or \code{GatingSetList}} - \item{node}{a \code{regular expression} to match a single - node in the gating tree. If more than one node is - matched, an error is thrown.} +\item{node}{a \code{regular expression} to match a single node in the gating tree. If more than one node is matched, an error is thrown.} - \item{filter.fun}{a \code{function} that does string - substitution to clean up node names, i.e. turns a 'CD4+' - into a 'CD4' to try and match against the - \code{parameters} slot of the \code{flowFrames} in - \code{gs}} +\item{filter.fun}{a \code{function} that does string substitution to clean up node names, i.e. turns a 'CD4+' into a 'CD4' to try and +match against the \code{parameters} slot of the \code{flowFrames} in \code{gs}} - \item{individual_id}{a \code{character} identifying the - subject id column in the \code{gs} metadata} +\item{individual_id}{a \code{character} identifying the subject id column in the \code{gs} metadata} - \item{sample_id}{a \code{character} idetifying the sample - id column in the \code{gs} metadata.} +\item{sample_id}{a \code{character} idetifying the sample id column in the \code{gs} metadata.} - \item{mp}{a \code{list} mapping node names to markers. - This function tries to guess, but may fail. The user can - override the guesswork.} +\item{mp}{a \code{list} mapping node names to markers. This function tries to guess, but may fail. The user can override the guesswork.} - \item{countFilterThreshold}{Numeric; if the number of - cells expressing at least one marker of interest is less - than this threshold, we remove that file.} +\item{countFilterThreshold}{Numeric; if the number of cells expressing at +least one marker of interest is less than this threshold, we remove that +file.} - \item{matchmethod}{a \code{character} either 'regex' or - 'Levenshtein' for matching nodes to markers.} +\item{matchmethod}{a \code{character} either 'regex' or 'Levenshtein' for matching nodes to markers.} - \item{markers}{a \code{character} vector of marker names - to include.} +\item{markers}{a \code{character} vector of marker names to include.} } \description{ This code expects a \code{GatingSet} or \code{GatingSetList}. diff --git a/man/COMPASSDescription.Rd b/man/COMPASSDescription.Rd index 9843ffc..9e78c56 100644 --- a/man/COMPASSDescription.Rd +++ b/man/COMPASSDescription.Rd @@ -9,10 +9,10 @@ COMPASSDescription(x) COMPASSDescription(x) <- value } \arguments{ - \item{x}{A \code{COMPASS} fit.} +\item{x}{A \code{COMPASS} fit.} - \item{value}{A set of paragraphs describing the - experiment, as a character vector.} +\item{value}{A set of paragraphs describing the experiment, as a character +vector.} } \description{ This is used for setting an informative description used in the Shiny diff --git a/man/CellCounts.Rd b/man/CellCounts.Rd index 385495d..1b930c5 100644 --- a/man/CellCounts.Rd +++ b/man/CellCounts.Rd @@ -6,14 +6,12 @@ CellCounts(data, combinations) } \arguments{ - \item{data}{Either a \code{COMPASSContainer}, or a list - of matrices. Each matrix \code{i} is of dimension - \code{N_i} cells (rows) by \code{K} common markers - (columns).} +\item{data}{Either a \code{COMPASSContainer}, or a list of matrices. +Each matrix \code{i} is of dimension \code{N_i} cells (rows) by +\code{K} common markers (columns).} - \item{combinations}{A list of 'combinations', used to - denote the subsets of interest. See the examples for - usage.} +\item{combinations}{A list of 'combinations', used to denote the +subsets of interest. See the examples for usage.} } \description{ Compute the number of cells expressing a particular diff --git a/man/Combinations.Rd b/man/Combinations.Rd index daaf0fc..da401b4 100644 --- a/man/Combinations.Rd +++ b/man/Combinations.Rd @@ -6,7 +6,7 @@ Combinations(n) } \arguments{ - \item{n}{An integer.} +\item{n}{An integer.} } \description{ Given an intenger \code{n}, generate all binary combinations of diff --git a/man/FunctionalityScore.Rd b/man/FunctionalityScore.Rd index c839017..a8d78d2 100644 --- a/man/FunctionalityScore.Rd +++ b/man/FunctionalityScore.Rd @@ -12,10 +12,9 @@ FunctionalityScore(x) \method{FunctionalityScore}{default}(x) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}, as - returned by \code{\link{COMPASS}}. Alternatively, a - matrix of functionality scores, used under the assumption - that the 'null' category has been dropped.} +\item{x}{An object of class \code{COMPASSResult}, as returned by +\code{\link{COMPASS}}. Alternatively, a matrix of functionality scores, +used under the assumption that the 'null' category has been dropped.} } \value{ A numeric vector of functionality scores. diff --git a/man/GetThresholdedIntensities.Rd b/man/GetThresholdedIntensities.Rd index beff2d1..7ea4048 100644 --- a/man/GetThresholdedIntensities.Rd +++ b/man/GetThresholdedIntensities.Rd @@ -6,12 +6,12 @@ GetThresholdedIntensities(gs, node, map) } \arguments{ - \item{gs}{A \code{GatingSet} or \code{GatingSetList}.} +\item{gs}{A \code{GatingSet} or \code{GatingSetList}.} - \item{node}{The name, or path, of a single node in a - \code{GatingSet} / \code{GatingSetList}.} +\item{node}{The name, or path, of a single node in a +\code{GatingSet} / \code{GatingSetList}.} - \item{map}{A \code{list}, mapping node names to markers.} +\item{map}{A \code{list}, mapping node names to markers.} } \value{ A \code{list} with two components: diff --git a/man/PolyfunctionalityScore.Rd b/man/PolyfunctionalityScore.Rd index a7a5ded..bba12c2 100644 --- a/man/PolyfunctionalityScore.Rd +++ b/man/PolyfunctionalityScore.Rd @@ -13,19 +13,16 @@ PolyfunctionalityScore(x, degree, normalization) \method{PolyfunctionalityScore}{default}(x, degree, normalization) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}, as - returned by \code{\link{COMPASS}}. Alternatively, a - matrix of functionality scores.} +\item{x}{An object of class \code{COMPASSResult}, as returned by +\code{\link{COMPASS}}. Alternatively, a matrix of functionality scores.} - \item{degree}{A vector of weights. If missing, this is - the 'degree of functionality', that is, the number of - markers expressed in a particular category.} +\item{degree}{A vector of weights. If missing, this is the 'degree of +functionality', that is, the number of markers expressed in a particular +category.} - \item{normalization}{A \code{character} vector specifying - how the score is to be normalized. Either using - \code{"all"} possible categories, or just the - \code{"observed"} categories. Defaults to \code{"all"} - categories.} +\item{normalization}{A \code{character} vector specifying how the score +is to be normalized. Either using \code{"all"} possible categories, or +just the \code{"observed"} categories. Defaults to \code{"all"} categories.} } \value{ A numeric vector of polyfunctionality scores. diff --git a/man/Posterior.Rd b/man/Posterior.Rd index aefeba7..c47b50d 100644 --- a/man/Posterior.Rd +++ b/man/Posterior.Rd @@ -18,7 +18,7 @@ PosteriorPs(x) PosteriorPu(x) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}.} +\item{x}{An object of class \code{COMPASSResult}.} } \description{ These functions can be used to retrieve different posterior measures diff --git a/man/SimpleCOMPASS.Rd b/man/SimpleCOMPASS.Rd index 66fe123..491693e 100644 --- a/man/SimpleCOMPASS.Rd +++ b/man/SimpleCOMPASS.Rd @@ -7,33 +7,27 @@ SimpleCOMPASS(n_s, n_u, meta, individual_id, sample_id, iterations = 10000, replications = 8, verbose = TRUE) } \arguments{ - \item{n_s}{The cell counts for stimulated cells.} +\item{n_s}{The cell counts for stimulated cells.} - \item{n_u}{The cell counts for unstimulated cells.} +\item{n_u}{The cell counts for unstimulated cells.} - \item{meta}{A \code{data.frame} of metadata, describing - the individuals in the experiment. Each row in - \code{meta} should correspond to a row in \code{data}. - There should be one row for each sample; i.e., one row - for each element of \code{n_s} and \code{n_u}.} +\item{meta}{A \code{data.frame} of metadata, describing the individuals +in the experiment. Each row in \code{meta} should correspond to a row +in \code{data}. There should be one row for each sample; +i.e., one row for each element of \code{n_s} and \code{n_u}.} - \item{individual_id}{The name of the vector in - \code{meta} that denotes the individuals from which - samples were drawn.} +\item{individual_id}{The name of the vector in \code{meta} that denotes the +individuals from which samples were drawn.} - \item{sample_id}{The name of the vector in \code{meta} - that denotes the samples. This vector should contain all - of the names in the \code{data} input.} +\item{sample_id}{The name of the vector in \code{meta} that denotes the samples. +This vector should contain all of the names in the \code{data} input.} - \item{iterations}{The number of iterations (per - 'replication') to perform.} +\item{iterations}{The number of iterations (per 'replication') to perform.} - \item{replications}{The number of 'replications' to - perform. In order to conserve memory, we only keep the - model estimates from the last replication.} +\item{replications}{The number of 'replications' to perform. In order to +conserve memory, we only keep the model estimates from the last replication.} - \item{verbose}{Boolean; if \code{TRUE} we output progress - information.} +\item{verbose}{Boolean; if \code{TRUE} we output progress information.} } \value{ A \code{list} with class \code{COMPASSResult} with two components, diff --git a/man/TotalCellCounts.Rd b/man/TotalCellCounts.Rd index 452aa43..0503e41 100644 --- a/man/TotalCellCounts.Rd +++ b/man/TotalCellCounts.Rd @@ -6,16 +6,14 @@ TotalCellCounts(data, subset, aggregate = TRUE) } \arguments{ - \item{data}{A \code{COMPASSContainer}.} +\item{data}{A \code{COMPASSContainer}.} - \item{subset}{An expression, evaluated within the - metadata, defining the subset of \code{data} over which - the counts are computed. If left unspecified, the counts - are computed over all samples.} +\item{subset}{An expression, evaluated within the metadata, defining +the subset of \code{data} over which the counts are computed. If left +unspecified, the counts are computed over all samples.} - \item{aggregate}{Boolean; if \code{TRUE} we sum over the - individual, to get total counts across samples for each - individual.} +\item{aggregate}{Boolean; if \code{TRUE} we sum over the individual, +to get total counts across samples for each individual.} } \description{ This function is used to compute total cell counts, per individual, diff --git a/man/UniqueCombinations.Rd b/man/UniqueCombinations.Rd index 7b0bba0..81eb2a0 100644 --- a/man/UniqueCombinations.Rd +++ b/man/UniqueCombinations.Rd @@ -12,12 +12,10 @@ UniqueCombinations(x, as.matrix) \method{UniqueCombinations}{default}(x, as.matrix = FALSE) } \arguments{ - \item{x}{Either a \code{COMPASSContainer}, or a list of - matrices.} +\item{x}{Either a \code{COMPASSContainer}, or a list of matrices.} - \item{as.matrix}{Boolean; if \code{TRUE} we return - results as a matrix; otherwise, we return the results as - a list.} +\item{as.matrix}{Boolean; if \code{TRUE} we return results as a matrix; +otherwise, we return the results as a list.} } \description{ Generate all possible unique combinations of \code{x}. diff --git a/man/melt_.Rd b/man/melt_.Rd index bb0c7d9..ab1ac37 100644 --- a/man/melt_.Rd +++ b/man/melt_.Rd @@ -13,22 +13,19 @@ melt_(data, ...) \method{melt_}{matrix}(data, ...) } \arguments{ - \item{data}{The \code{data.frame} to melt.} +\item{data}{The \code{data.frame} to melt.} - \item{...}{Arguments passed to other methods.} +\item{...}{Arguments passed to other methods.} - \item{id.vars}{Vector of id variables. Can be integer - (variable position) or string (variable name). If blank, - we use all variables not in \code{measure.vars}.} +\item{id.vars}{Vector of id variables. Can be integer (variable position) +or string (variable name). If blank, we use all variables not in \code{measure.vars}.} - \item{measure.vars}{Vector of measured variables. Can be - integer (variable position) or string (variable name). If - blank, we use all variables not in \code{id.vars}.} +\item{measure.vars}{Vector of measured variables. Can be integer (variable position) +or string (variable name). If blank, we use all variables not in \code{id.vars}.} - \item{variable.name}{Name of variable used to store - measured variable names.} +\item{variable.name}{Name of variable used to store measured variable names.} - \item{value.name}{Name of variable used to store values.} +\item{value.name}{Name of variable used to store values.} } \description{ Inspired by \code{reshape2:::melt}, we melt \code{data.frame}s and diff --git a/man/merge.COMPASSContainer.Rd b/man/merge.COMPASSContainer.Rd index ba2b719..0ea2b24 100644 --- a/man/merge.COMPASSContainer.Rd +++ b/man/merge.COMPASSContainer.Rd @@ -6,11 +6,11 @@ \method{merge}{COMPASSContainer}(x, y, ...) } \arguments{ - \item{x}{A \code{COMPASSContainer}.} +\item{x}{A \code{COMPASSContainer}.} - \item{y}{A \code{COMPASSContainer}.} +\item{y}{A \code{COMPASSContainer}.} - \item{...}{Optional arguments, currently ignored.} +\item{...}{Optional arguments, currently ignored.} } \description{ This function merges two \code{COMPASSContainers}. diff --git a/man/pheatmap.Rd b/man/pheatmap.Rd index 1e9678f..efa2f4e 100644 --- a/man/pheatmap.Rd +++ b/man/pheatmap.Rd @@ -21,169 +21,127 @@ pheatmap(mat, color = colorRampPalette(rev(brewer.pal(n = 7, name = polar = FALSE, order_by_max_functionality = TRUE, ...) } \arguments{ - \item{mat}{numeric matrix of the values to be plotted.} +\item{mat}{numeric matrix of the values to be plotted.} - \item{color}{vector of colors used in heatmap.} +\item{color}{vector of colors used in heatmap.} - \item{kmeans_k}{the number of kmeans clusters to make, if - we want to agggregate the rows before drawing heatmap. If - NA then the rows are not aggregated.} +\item{kmeans_k}{the number of kmeans clusters to make, if we want to agggregate the +rows before drawing heatmap. If NA then the rows are not aggregated.} - \item{breaks}{a sequence of numbers that covers the range - of values in mat and is one element longer than color - vector. Used for mapping values to colors. Useful, if - needed to map certain values to certain colors, to - certain values. If value is NA then the breaks are - calculated automatically.} +\item{breaks}{a sequence of numbers that covers the range of values in mat and is one +element longer than color vector. Used for mapping values to colors. Useful, if needed +to map certain values to certain colors, to certain values. If value is NA then the +breaks are calculated automatically.} - \item{border_color}{color of cell borders on heatmap, use - NA if no border should be drawn.} +\item{border_color}{color of cell borders on heatmap, use NA if no border should be +drawn.} - \item{cellwidth}{individual cell width in points. If left - as NA, then the values depend on the size of plotting - window.} +\item{cellwidth}{individual cell width in points. If left as NA, then the values +depend on the size of plotting window.} - \item{cellheight}{individual cell height in points. If - left as NA, then the values depend on the size of - plotting window.} +\item{cellheight}{individual cell height in points. If left as NA, +then the values depend on the size of plotting window.} - \item{scale}{character indicating if the values should be - centered and scaled in either the row direction or the - column direction, or none. Corresponding values are - \code{"row"}, \code{"column"} and \code{"none"}} +\item{scale}{character indicating if the values should be centered and scaled in +either the row direction or the column direction, or none. Corresponding values are +\code{"row"}, \code{"column"} and \code{"none"}} - \item{cluster_rows}{boolean values determining if rows - should be clustered,} +\item{cluster_rows}{boolean values determining if rows should be clustered,} - \item{cluster_cols}{boolean values determining if columns - should be clustered.} +\item{cluster_cols}{boolean values determining if columns should be clustered.} - \item{clustering_distance_rows}{distance measure used in - clustering rows. Possible values are \code{"correlation"} - for Pearson correlation and all the distances supported - by \code{\link{dist}}, such as \code{"euclidean"}, etc. - If the value is none of the above it is assumed that a - distance matrix is provided.} +\item{clustering_distance_rows}{distance measure used in clustering rows. Possible +values are \code{"correlation"} for Pearson correlation and all the distances +supported by \code{\link{dist}}, such as \code{"euclidean"}, etc. If the value is none +of the above it is assumed that a distance matrix is provided.} - \item{clustering_distance_cols}{distance measure used in - clustering columns. Possible values the same as for - clustering_distance_rows.} +\item{clustering_distance_cols}{distance measure used in clustering columns. Possible +values the same as for clustering_distance_rows.} - \item{clustering_method}{clustering method used. Accepts - the same values as \code{\link{hclust}}.} +\item{clustering_method}{clustering method used. Accepts the same values as +\code{\link{hclust}}.} - \item{treeheight_row}{the height of a tree for rows, if - these are clustered. Default value 50 points.} +\item{treeheight_row}{the height of a tree for rows, if these are clustered. +Default value 50 points.} - \item{treeheight_col}{the height of a tree for columns, - if these are clustered. Default value 50 points.} +\item{treeheight_col}{the height of a tree for columns, if these are clustered. +Default value 50 points.} - \item{legend}{logical to determine if legend should be - drawn or not.} +\item{legend}{logical to determine if legend should be drawn or not.} - \item{legend_breaks}{vector of breakpoints for the - legend.} +\item{legend_breaks}{vector of breakpoints for the legend.} - \item{legend_labels}{vector of labels for the - \code{legend_breaks}.} +\item{legend_labels}{vector of labels for the \code{legend_breaks}.} - \item{annotation}{data frame that specifies the - annotations shown on top of the columns. Each row defines - the features for a specific column. The columns in the - data and rows in the annotation are matched using - corresponding row and column names. Note that color - schemes takes into account if variable is continuous or - discrete.} +\item{annotation}{data frame that specifies the annotations shown on top of the +columns. Each row defines the features for a specific column. The columns in the data +and rows in the annotation are matched using corresponding row and column names. Note +that color schemes takes into account if variable is continuous or discrete.} - \item{annotation_colors}{list for specifying annotation - track colors manually. It is possible to define the - colors for only some of the features. Check examples for - details.} +\item{annotation_colors}{list for specifying annotation track colors manually. It is +possible to define the colors for only some of the features. Check examples for +details.} - \item{annotation_legend}{boolean value showing if the - legend for annotation tracks should be drawn.} +\item{annotation_legend}{boolean value showing if the legend for annotation tracks +should be drawn.} - \item{drop_levels}{logical to determine if unused levels - are also shown in the legend} +\item{drop_levels}{logical to determine if unused levels are also shown in the legend} - \item{show_rownames}{boolean specifying if column names - are be shown.} +\item{show_rownames}{boolean specifying if column names are be shown.} - \item{show_colnames}{boolean specifying if column names - are be shown.} +\item{show_colnames}{boolean specifying if column names are be shown.} - \item{main}{the title of the plot} +\item{main}{the title of the plot} - \item{fontsize}{base fontsize for the plot} +\item{fontsize}{base fontsize for the plot} - \item{fontsize_row}{fontsize for rownames (Default: - fontsize)} +\item{fontsize_row}{fontsize for rownames (Default: fontsize)} - \item{fontsize_col}{fontsize for colnames (Default: - fontsize)} +\item{fontsize_col}{fontsize for colnames (Default: fontsize)} - \item{display_numbers}{logical determining if the numeric - values are also printed to the cells.} +\item{display_numbers}{logical determining if the numeric values are also printed to +the cells.} - \item{number_format}{format strings (C printf style) of - the numbers shown in cells. For example "\code{\%.2f}" - shows 2 decimal places and "\code{\%.1e}" shows - exponential notation (see more in - \code{\link{gettextf}}).} +\item{number_format}{format strings (C printf style) of the numbers shown in cells. +For example "\code{\%.2f}" shows 2 decimal places and "\code{\%.1e}" shows exponential +notation (see more in \code{\link{gettextf}}).} - \item{fontsize_number}{fontsize of the numbers displayed - in cells} +\item{fontsize_number}{fontsize of the numbers displayed in cells} - \item{filename}{file path where to save the picture. - Filetype is decided by the extension in the path. - Currently following formats are supported: png, pdf, - tiff, bmp, jpeg. Even if the plot does not fit into the - plotting window, the file size is calculated so that the - plot would fit there, unless specified otherwise.} +\item{filename}{file path where to save the picture. Filetype is decided by +the extension in the path. Currently following formats are supported: png, pdf, tiff, + bmp, jpeg. Even if the plot does not fit into the plotting window, the file size is +calculated so that the plot would fit there, unless specified otherwise.} - \item{width}{manual option for determining the output - file width in inches.} +\item{width}{manual option for determining the output file width in inches.} - \item{height}{manual option for determining the output - file height in inches.} +\item{height}{manual option for determining the output file height in inches.} - \item{row_annotation}{data frame that specifies the - annotations shown on the rows. Each row defines the - features for a specific row. The rows in the data and - rows in the annotation are matched using corresponding - row names.The category labels are given by the data frame - column names.} +\item{row_annotation}{data frame that specifies the annotations shown on the +rows. Each row defines the features for a specific row. The rows in the data +and rows in the annotation are matched using corresponding row names.The category labels are +given by the data frame column names.} - \item{row_annotation_legend}{same interpretation as the - column parameters.} +\item{row_annotation_legend}{same interpretation as the column parameters.} - \item{row_annotation_colors}{same interpretation as the - column parameters} +\item{row_annotation_colors}{same interpretation as the column parameters} - \item{cytokine_annotation}{is a data frame of binary - factors with levels 0,1, that defines combinations of the - categories for each column. They will be colored by their - degree of functionality and ordered by degree of - functionality and by amount of expression if column - clustering is not done.} +\item{cytokine_annotation}{is a data frame of binary factors with levels 0,1, that defines combinations +of the categories for each column. They will be colored by their degree of functionality and ordered by degree of functionality +and by amount of expression if column clustering is not done.} - \item{headerplot}{is a list with two components, order - and data. Order tells how to reorder the columns of the - matrix.} +\item{headerplot}{is a list with two components, order and data. Order tells how to reorder the columns of the matrix.} - \item{polar}{Boolean; if \code{TRUE} we draw a polar - legend. Primarily for internal use. Data is some summary - statistic over the columns which will be plotted in the - header where the column cluster tree usually appears. - Cytokine ordering is ignored when the headerplot argument - is passed.} +\item{polar}{Boolean; if \code{TRUE} we draw a polar legend. Primarily for + internal use. +Data is some summary statistic over the columns which will be plotted in the header where the column cluster tree usually appears. +Cytokine ordering is ignored when the headerplot argument is passed.} - \item{\dots}{graphical parameters for the text used in - plot. Parameters passed to \code{\link{grid.text}}, see - \code{\link{gpar}}.} +\item{\dots}{graphical parameters for the text used in plot. Parameters passed to +\code{\link{grid.text}}, see \code{\link{gpar}}.} - \item{order_by_max_functionality}{Boolean; re-order the - cytokine labels by maximum functionality?} +\item{order_by_max_functionality}{Boolean; re-order the cytokine labels by +maximum functionality?} } \value{ Invisibly a list of components diff --git a/man/plot.COMPASSResult.Rd b/man/plot.COMPASSResult.Rd index dc3af65..8e966f1 100644 --- a/man/plot.COMPASSResult.Rd +++ b/man/plot.COMPASSResult.Rd @@ -11,60 +11,54 @@ order_by = FunctionalityScore, ...) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}.} +\item{x}{An object of class \code{COMPASSResult}.} - \item{y}{This argument gets passed to - \code{row_annotation}, if \code{row_annotation} is - missing. It can be used to group rows (individuals) by - different conditions as defined in the metadata.} +\item{y}{This argument gets passed to \code{row_annotation}, if +\code{row_annotation} is missing. It can be used to group rows (individuals) +by different conditions as defined in the metadata.} - \item{subset}{An \R expression, evaluated within the - metadata, used to determine which individuals should be - kept.} +\item{subset}{An \R expression, evaluated within the metadata, used to +determine which individuals should be kept.} - \item{threshold}{A numeric threshold for filtering - under-expressed categories. Any categories with mean - score < \code{threshold} are removed.} +\item{threshold}{A numeric threshold for filtering under-expressed +categories. Any categories with mean score < \code{threshold} are +removed.} - \item{minimum_dof}{The minimum degree of functionality - for the categories to be plotted.} +\item{minimum_dof}{The minimum degree of functionality for the categories +to be plotted.} - \item{maximum_dof}{The maximum degree of functionality - for the categories to be plotted.} +\item{maximum_dof}{The maximum degree of functionality for the categories +to be plotted.} - \item{must_express}{A character vector of markers that - should be included in each subset plotted. For example, - \code{must_express=c("TNFa & IFNg")} says we include only - subsets that are positive for either \code{TNFa} or - \code{IFNg}, while \code{must_express=c("TNFa", "IFNg")} - says we should keep subsets which are positive for either - \code{TNFa} or \code{IFNg}.} +\item{must_express}{A character vector of markers that should be included +in each subset plotted. For example, \code{must_express=c("TNFa & IFNg")} +says we include only subsets that are positive for either +\code{TNFa} or \code{IFNg}, while \code{must_express=c("TNFa", "IFNg")} +says we should keep subsets which are positive for either \code{TNFa} or +\code{IFNg}.} - \item{row_annotation}{A vector of names, pulled from the - metadata, to be used for row annotation.} +\item{row_annotation}{A vector of names, pulled from the metadata, to be +used for row annotation.} - \item{palette}{The colour palette to be used.} +\item{palette}{The colour palette to be used.} - \item{show_rownames}{Boolean; if \code{TRUE} we display - row names (ie, the individual ids).} +\item{show_rownames}{Boolean; if \code{TRUE} we display row names (ie, +the individual ids).} - \item{show_colnames}{Boolean; if \code{TRUE} we display - column names (ie, the column name associated with a - cytokine; typically not needed)} +\item{show_colnames}{Boolean; if \code{TRUE} we display column names +(ie, the column name associated with a cytokine; typically not needed)} - \item{measure}{Optional. By default, we produce a heatmap - of the mean gammas produced in a model fit. We can - override this by supplying a matrix of suitable dimension - as well; these can be generated with the - \code{Posterior*} functions -- see - \code{\link{Posterior}} for examples.} +\item{measure}{Optional. By default, we produce a heatmap of the mean +gammas produced in a model fit. We can override this by supplying a +matrix of suitable dimension as well; these can be generated with +the \code{Posterior*} functions -- see \code{\link{Posterior}} for +examples.} - \item{order_by}{Order rows within a group. This should be - a function; e.g. \code{FunctionalityScore}, \code{mean}, - \code{median}, and so on. Set this to \code{NULL} to - preserve the original ordering of the data.} +\item{order_by}{Order rows within a group. This should be a function; +e.g. \code{FunctionalityScore}, \code{mean}, \code{median}, and so on. +Set this to \code{NULL} to preserve the original ordering of the data.} - \item{...}{Optional arguments passed to \code{pheatmap}.} +\item{...}{Optional arguments passed to \code{pheatmap}.} } \value{ The plot as a \code{grid} object (\code{grob}). It can be redrawn diff --git a/man/plot2.Rd b/man/plot2.Rd index c65ade3..494aee4 100644 --- a/man/plot2.Rd +++ b/man/plot2.Rd @@ -8,37 +8,35 @@ plot2(x, y, subset, threshold = 0.01, minimum_dof = 1, maximum_dof = Inf, show_colnames = FALSE, ...) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}.} +\item{x}{An object of class \code{COMPASSResult}.} - \item{y}{An object of class \code{COMPASSResult}.} +\item{y}{An object of class \code{COMPASSResult}.} - \item{row_annotation}{A vector of names, pulled from the - metadata, to be used for row annotation.} +\item{row_annotation}{A vector of names, pulled from the metadata, to be +used for row annotation.} - \item{threshold}{A numeric threshold for filtering - under-expressed categories. Any categories with mean - score < \code{threshold} are removed.} +\item{threshold}{A numeric threshold for filtering under-expressed +categories. Any categories with mean score < \code{threshold} are +removed.} - \item{minimum_dof}{The minimum degree of functionality - for the categories to be plotted.} +\item{minimum_dof}{The minimum degree of functionality for the categories +to be plotted.} - \item{maximum_dof}{The maximum degree of functionality - for the categories to be plotted.} +\item{maximum_dof}{The maximum degree of functionality for the categories +to be plotted.} - \item{subset}{An \R expression, evaluated within the - metadata, used to determine which individuals should be - kept.} +\item{subset}{An \R expression, evaluated within the metadata, used to +determine which individuals should be kept.} - \item{palette}{The colour palette to be used.} +\item{palette}{The colour palette to be used.} - \item{show_rownames}{Boolean; if \code{TRUE} we display - row names (ie, the individual ids).} +\item{show_rownames}{Boolean; if \code{TRUE} we display row names (ie, +the individual ids).} - \item{show_colnames}{Boolean; if \code{TRUE} we display - column names (ie, the column name associated with a - cytokine; typically not needed)} +\item{show_colnames}{Boolean; if \code{TRUE} we display column names +(ie, the column name associated with a cytokine; typically not needed)} - \item{...}{Optional arguments passed to \code{pheatmap}.} +\item{...}{Optional arguments passed to \code{pheatmap}.} } \value{ The plot as a \code{grid} object (\code{grob}). It can be redrawn diff --git a/man/print.COMPASSContainer.Rd b/man/print.COMPASSContainer.Rd index b4ed958..b5ba221 100644 --- a/man/print.COMPASSContainer.Rd +++ b/man/print.COMPASSContainer.Rd @@ -6,9 +6,9 @@ \method{print}{COMPASSContainer}(x, ...) } \arguments{ - \item{x}{An object of class \code{COMPASSContainer}.} +\item{x}{An object of class \code{COMPASSContainer}.} - \item{...}{Optional arguments passed to \code{cat}.} +\item{...}{Optional arguments passed to \code{cat}.} } \description{ This function prints a \code{COMPASSContainer} object, giving basic diff --git a/man/print.COMPASSResult.Rd b/man/print.COMPASSResult.Rd index 5864c29..5be34f6 100644 --- a/man/print.COMPASSResult.Rd +++ b/man/print.COMPASSResult.Rd @@ -6,9 +6,9 @@ \method{print}{COMPASSResult}(x, ...) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}.} +\item{x}{An object of class \code{COMPASSResult}.} - \item{...}{Optional arguments; currently unused.} +\item{...}{Optional arguments; currently unused.} } \description{ This function prints basic information about the model fit by a diff --git a/man/shinyCOMPASS.Rd b/man/shinyCOMPASS.Rd index 25ad1e5..26782ed 100644 --- a/man/shinyCOMPASS.Rd +++ b/man/shinyCOMPASS.Rd @@ -7,31 +7,26 @@ shinyCOMPASS(x, dir = NULL, meta.vars, facet1 = "None", facet2 = "None", facet3 = "None", main = NA, launch = TRUE, ...) } \arguments{ - \item{x}{An object of class \code{COMPASSResult}.} +\item{x}{An object of class \code{COMPASSResult}.} - \item{dir}{A location to write out the \code{.rds} files - that will be loaded and used by the Shiny application.} +\item{dir}{A location to write out the \code{.rds} files that +will be loaded and used by the Shiny application.} - \item{meta.vars}{A character vector of column names that - should be used for potential facetting in the Shiny app. - By default, we take all metadata variables; you may want - to limit this if you know certain variables are not of - interest.} +\item{meta.vars}{A character vector of column names that should be used +for potential facetting in the Shiny app. By default, we take all +metadata variables; you may want to limit this if you know certain +variables are not of interest.} - \item{facet1,facet2,facet3}{Default values for facets in - the Shiny app. Each should be the name of a single - vector in the metadata.} +\item{facet1,facet2,facet3}{Default values for facets in the Shiny app. +Each should be the name of a single vector in the metadata.} - \item{main}{A title to give to the heatmap and subset - histogram plots.} +\item{main}{A title to give to the heatmap and subset histogram plots.} - \item{launch}{Boolean; if \code{TRUE} we launch the Shiny - application. Otherwise, the user can launch it manually - by navigating to the directory \code{dir} and running - \code{shiny::runApp()}.} +\item{launch}{Boolean; if \code{TRUE} we launch the Shiny application. +Otherwise, the user can launch it manually by navigating to the directory +\code{dir} and running \code{shiny::runApp()}.} - \item{...}{Optional arguments passed to - \code{shiny::runApp}.} +\item{...}{Optional arguments passed to \code{shiny::runApp}.} } \description{ This function takes a \code{COMPASSResult} object, and generates diff --git a/man/shinyCOMPASSDeps.Rd b/man/shinyCOMPASSDeps.Rd index 0b4d947..2a84e1f 100644 --- a/man/shinyCOMPASSDeps.Rd +++ b/man/shinyCOMPASSDeps.Rd @@ -6,8 +6,8 @@ shinyCOMPASSDeps(verbose = TRUE) } \arguments{ - \item{verbose}{Boolean; if \code{TRUE} we print - installation instructions to the screen.} +\item{verbose}{Boolean; if \code{TRUE} we print installation instructions +to the screen.} } \description{ This function can be used to identify the packages still needed in order diff --git a/man/subset.COMPASSContainer.Rd b/man/subset.COMPASSContainer.Rd index 17b2093..28412ed 100644 --- a/man/subset.COMPASSContainer.Rd +++ b/man/subset.COMPASSContainer.Rd @@ -6,12 +6,12 @@ \method{subset}{COMPASSContainer}(x, subset, ...) } \arguments{ - \item{x}{A \code{COMPASSContainer}.} +\item{x}{A \code{COMPASSContainer}.} - \item{subset}{A logical expression, evaluated within the - metadata, indicating which entries to keep.} +\item{subset}{A logical expression, evaluated within the metadata, +indicating which entries to keep.} - \item{...}{Optional arguents; currently unused.} +\item{...}{Optional arguents; currently unused.} } \description{ Use this function to subset a \code{COMPASSContainer}. diff --git a/man/summary.COMPASSContainer.Rd b/man/summary.COMPASSContainer.Rd index 7c80e45..27e0fd5 100644 --- a/man/summary.COMPASSContainer.Rd +++ b/man/summary.COMPASSContainer.Rd @@ -6,10 +6,9 @@ \method{summary}{COMPASSContainer}(object, ...) } \arguments{ - \item{object}{An object of class - \code{COMPASSContainer}.} +\item{object}{An object of class \code{COMPASSContainer}.} - \item{...}{Optional arguments; currently ignored.} +\item{...}{Optional arguments; currently ignored.} } \description{ This function prints summary information about a \code{COMPASSContainer} diff --git a/man/summary.COMPASSResult.Rd b/man/summary.COMPASSResult.Rd index a9c43c6..5a7d8bb 100644 --- a/man/summary.COMPASSResult.Rd +++ b/man/summary.COMPASSResult.Rd @@ -6,9 +6,9 @@ \method{summary}{COMPASSResult}(object, ...) } \arguments{ - \item{object}{An object of class \code{COMPASSResult}.} +\item{object}{An object of class \code{COMPASSResult}.} - \item{...}{Optional arguments; currently unused.} +\item{...}{Optional arguments; currently unused.} } \description{ This function prints basic information about the model fit by a diff --git a/man/transpose_list.Rd b/man/transpose_list.Rd index 5390c59..6994bab 100644 --- a/man/transpose_list.Rd +++ b/man/transpose_list.Rd @@ -6,7 +6,7 @@ transpose_list(x) } \arguments{ - \item{x}{An \R list.} +\item{x}{An \R list.} } \description{ Transpose a matrix-like list. From effa131e3d87f4e370c13ef5ce989849aa328229 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Fri, 4 Apr 2014 11:23:54 -0700 Subject: [PATCH 2/3] Support '*' expansion in CellCounts (#30) --- R/CellCounts.R | 53 ++++++++++++++++++++++++++++++-- src/RcppExports.cpp | 24 +++++++-------- tests/testthat/test-CellCounts.R | 51 ++++++++++++++++++++---------- 3 files changed, 97 insertions(+), 31 deletions(-) diff --git a/R/CellCounts.R b/R/CellCounts.R index 429981a..6499eb9 100644 --- a/R/CellCounts.R +++ b/R/CellCounts.R @@ -75,12 +75,61 @@ CellCounts.COMPASSContainer <- function(data, combinations) { .CellCounts_character <- function(data, combinations) { + ## Pre-parse the combinations by expanding entries of the form + ## "A*B*C" to + ## + ## A & B & C + ## A & B & !C + ## A & !B & C + ## ... + ## + ## TODO: Handle things like A&(B*C) + combos <- lapply(combinations, function(x) { + + ## Bail if no '*' + if (!grepl("*", x, fixed=TRUE)) return(x) + + ## Bail if unsupported combination seen + if (grepl("*", x, fixed=TRUE) && grepl("[&|]", x, perl=TRUE)) { + stop("currently cannot combine '*' expander with '&' or '|'", + call.=FALSE) + } + + ## Generate a matrix of 0s and 1s that forms the same 'structure' + splat <- unlist(strsplit(x, "*", fixed = TRUE)) + n <- length(splat) + values <- do.call( + function(...) { + expand.grid(..., KEEP.OUT.ATTRS = FALSE) + }, + replicate(n, c(0, 1), simplify = FALSE) + ) + + ## Replace the 0s and 1s with appropriate names + for (i in seq_along(values)) { + values[, i] <- swap(values[, i], + c(0, 1), + c(splat[i], paste0("!", splat[i])) + ) + } + + ## Paste and return the output + do.call( + function(...) paste(..., sep = "&"), + values, + + ) + + }) + + combos <- unlist(combos) + output <- .Call(C_COMPASS_CellCounts_character, data, - lapply(combinations, function(x) parse(text=x)) + lapply(combos, function(x) parse(text=x)) ) rownames(output) <- names(data) - colnames(output) <- unlist(combinations) + colnames(output) <- combos return(output) } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index b27545b..290e943 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,32 +5,32 @@ using namespace Rcpp; -// CellCounts -IntegerMatrix CellCounts(List x, List combos); -RcppExport SEXP COMPASS_CellCounts(SEXP xSEXP, SEXP combosSEXP) { +// CellCounts_character +IntegerMatrix CellCounts_character(List data, List combinations); +RcppExport SEXP COMPASS_CellCounts_character(SEXP dataSEXP, SEXP combinationsSEXP) { BEGIN_RCPP SEXP __sexp_result; { Rcpp::RNGScope __rngScope; - Rcpp::traits::input_parameter< List >::type x(xSEXP ); - Rcpp::traits::input_parameter< List >::type combos(combosSEXP ); - IntegerMatrix __result = CellCounts(x, combos); + Rcpp::traits::input_parameter< List >::type data(dataSEXP ); + Rcpp::traits::input_parameter< List >::type combinations(combinationsSEXP ); + IntegerMatrix __result = CellCounts_character(data, combinations); PROTECT(__sexp_result = Rcpp::wrap(__result)); } UNPROTECT(1); return __sexp_result; END_RCPP } -// CellCounts_character -IntegerMatrix CellCounts_character(List data, List combinations); -RcppExport SEXP COMPASS_CellCounts_character(SEXP dataSEXP, SEXP combinationsSEXP) { +// CellCounts +IntegerMatrix CellCounts(List x, List combos); +RcppExport SEXP COMPASS_CellCounts(SEXP xSEXP, SEXP combosSEXP) { BEGIN_RCPP SEXP __sexp_result; { Rcpp::RNGScope __rngScope; - Rcpp::traits::input_parameter< List >::type data(dataSEXP ); - Rcpp::traits::input_parameter< List >::type combinations(combinationsSEXP ); - IntegerMatrix __result = CellCounts_character(data, combinations); + Rcpp::traits::input_parameter< List >::type x(xSEXP ); + Rcpp::traits::input_parameter< List >::type combos(combosSEXP ); + IntegerMatrix __result = CellCounts(x, combos); PROTECT(__sexp_result = Rcpp::wrap(__result)); } UNPROTECT(1); diff --git a/tests/testthat/test-CellCounts.R b/tests/testthat/test-CellCounts.R index 6a59f77..633381d 100644 --- a/tests/testthat/test-CellCounts.R +++ b/tests/testthat/test-CellCounts.R @@ -15,23 +15,40 @@ data <- lapply(data, function(x) { return (x) }) combinations <- colnames(data[[1]]) ## [1] "A" "B" "C" "D" "E" "F" -expect_identical( - CellCounts(data, combinations), - CellCounts(data, 1:6) -) -expect_identical( - CellCounts(data, list(c(1, 2, 3))), - CellCounts(data, list("A&B&C")) -) +test_that("The integer and character interfaces for CellCounts match up", { -y <- "A&B&C" -expect_identical( - CellCounts(data, list(c(1, 2, 3))), - CellCounts(data, list(y)) -) + expect_identical( + CellCounts(data, combinations), + CellCounts(data, 1:6) + ) + + expect_identical( + CellCounts(data, list(c(1, 2, 3))), + CellCounts(data, list("A&B&C")) + ) + + y <- "A&B&C" + expect_identical( + CellCounts(data, list(c(1, 2, 3))), + CellCounts(data, list(y)) + ) + + expect_identical( + CellCounts(data, 1:6), + marginal_counts(data) + ) + +}) -expect_identical( - CellCounts(data, 1:6), - marginal_counts(data) -) +test_that("We properly expand with a '*' in the name", { + + expect_identical( + CellCounts(data, "A*B"), + CellCounts(data, c("A&B", "!A&B", "A&!B", "!A&!B")) + ) + + ## TODO: allow combinations of * and [&|] + expect_error( CellCounts(data, "A*B&C")) + +}) From 1ffd1bbac0985701dc588b1367e9132fc1e0d9d5 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Fri, 4 Apr 2014 11:25:00 -0700 Subject: [PATCH 3/3] Update version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8983c25..f9f305d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: COMPASS Type: Package Title: Combinatorial Polyfunctionality Analysis of Single Cells -Version: 1.1.7 +Version: 1.1.8 Date: 2014-02-11 Authors@R: c( person("Lynn", "Lin", role="aut", email="llin@fhcrc.org"), person("Kevin", "Ushey", role=c("aut", "cre"), email="kushey@fhcrc.org"),