You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/reduce_dimensions.R
+25-44Lines changed: 25 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,21 @@
2
2
#'
3
3
#' `r lifecycle::badge("maturing")`
4
4
#'
5
-
#' @description reduce_dimensions() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and calculates the reduced dimensional space of the transcript abundance.
5
+
#' @description reduce_dimensions() takes as input a `SummarizedExperiment` and calculates the reduced dimensional space of the transcript abundance.
#' @param .data A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment))
19
-
#' @param .element The name of the element column (normally samples).
20
-
#' @param .feature The name of the feature column (normally transcripts/genes)
21
-
#' @param .abundance The name of the column including the numerical value the clustering is based on (normally transcript abundance)
18
+
#' @param .data A `SummarizedExperiment`
19
+
#' @param assay Character string: the name of the assay to use for dimension reduction (must match `assayNames(.data)`). This argument must be explicitly specified so that the choice of abundance matrix is deliberate.
22
20
#'
23
21
#' @param method A character string. The dimension reduction algorithm to use (PCA, MDS, tSNE).
24
22
#' @param top An integer. How many top genes to select for dimensionality reduction
#' Underlying method for UMAP: variable features from the chosen \code{assay} are optionally PCA-reduced, then \code{uwot::tumap()} is applied to the sample coordinates matrix.
62
45
#'
63
46
#'
64
47
#' @return A tbl object with additional columns for the reduced dimensions
#' Mangiola, S., Molania, R., Dong, R., Doyle, M. A., & Papenfuss, A. T. (2021). tidybulk: an R tidy framework for modular transcriptomic data analysis. Genome Biology, 22(1), 42. doi:10.1186/s13059-020-02233-7
stop("tidybulk says: please specify `assay` explicitly as a character string (e.g. assay = \"counts_scaled\"). If needed, create an assay scaled proportionally to library size with `scale_abundance()` and pass that assay name via `assay`.", call.=FALSE)
121
+
122
+
if (!is.character(assay) || length(assay) !=1L||!nzchar(assay))
123
+
stop("tidybulk says: `assay` must be a single non-empty character string naming an assay in assayNames(.data).", call.=FALSE)
#' @param .abundance A column symbol with the value the clustering is based on (e.g., `count`)
285
+
#' @param .data Feature-by-sample matrix (from an assay)
297
286
#' @param .dims A integer vector corresponding to principal components of interest (e.g., 1:6)
298
-
#' @param .feature A column symbol. The column that is represents entities to cluster (i.e., normally genes)
299
-
#' @param .element A column symbol. The column that is used to calculate distance (i.e., normally samples)
300
287
#' @param top An integer. How many top genes to select
301
288
#' @param of_samples A boolean
302
289
#' @param transform A function that will tranform the counts, by default it is log1p for RNA sequencing data, but for avoinding tranformation you can use identity
#' @param .abundance A column symbol with the value the clustering is based on (e.g., `count`)
429
+
#' @param .data Feature-by-sample matrix (from an assay)
444
430
#' @param .dims A integer vector corresponding to principal components of interest (e.g., 1:6)
445
-
#' @param .feature A column symbol. The column that is represents entities to cluster (i.e., normally genes)
446
-
#' @param .element A column symbol. The column that is used to calculate distance (i.e., normally samples)
447
431
#' @param top An integer. How many top genes to select
448
432
#' @param of_samples A boolean
449
433
#' @param transform A function that will tranform the counts, by default it is log1p for RNA sequencing data, but for avoinding tranformation you can use identity
@@ -533,11 +517,8 @@ we suggest to partition the dataset for sample clusters.
533
517
#' @importFrom stats setNames
534
518
#' @importFrom Matrix t
535
519
#'
536
-
#' @param .data A tibble
537
-
#' @param .abundance A column symbol with the value the clustering is based on (e.g., `count`)
520
+
#' @param .data Feature-by-sample matrix (from an assay)
538
521
#' @param .dims A integer vector corresponding to principal components of interest (e.g., 1:6)
539
-
#' @param .feature A column symbol. The column that is represents entities to cluster (i.e., normally genes)
540
-
#' @param .element A column symbol. The column that is used to calculate distance (i.e., normally samples)
541
522
#' @param top An integer. How many top genes to select
542
523
#' @param of_samples A boolean
543
524
#' @param transform A function that will tranform the counts, by default it is log1p for RNA sequencing data, but for avoinding tranformation you can use identity
0 commit comments