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
#' Renames taxa to have short human-readable names
30
+
#'
31
+
#' @param x Object of class \code{SummarizedExperiment}
32
+
#' @param name Character, defaults to \code{"OTU"}. Optional. String to use in every taxa name.
33
+
#'
34
+
#' @details The original taxa names are saved as the \code{original_names} attribute. See the example for an example of how to access the original names.
35
+
#'
36
+
#' @return Object of class \code{SummarizedExperiment}, with taxa renamed (defaults to OTU1, OTU2, ...), with the original taxa names saved as an attribute.
37
+
#'
38
+
#' @export
39
+
clean_taxa_names_se<-function(x, name="OTU") {
40
+
if (requireNamespace("SummarizedExperiment", quietly=TRUE)) {
41
+
if (inherits(x, "SummarizedExperiment")) {
42
+
attr(x, "original_names") <- row.names(x)
43
+
row.names(x) <- paste0(name, seq_len(nrow(x)))
44
+
return(x)
45
+
} else {
46
+
stop("clean_taxa_names_se is intended for SummarizedExperiment objects!")
#' Function to subset and convert SummarizedExperiment data
2
+
#'
3
+
#' @param data a \code{SummarizedExperiment} object
4
+
#' @param select Name of OTU or taxa to select, must match taxa name in \code{data}
5
+
#'
6
+
#' @return A \code{data.frame} object, with elements \code{W} as the observed counts, \code{M} as the sequencing depth, and the sample data with their original names.
7
+
#'
8
+
#' @export
9
+
convert_sumexp<-function(data, select) {
10
+
if (requireNamespace("SummarizedExperiment", quietly=TRUE)) {
0 commit comments