diff --git a/R/cibersort.R b/R/cibersort.R index 63040400..92e3157b 100755 --- a/R/cibersort.R +++ b/R/cibersort.R @@ -30,9 +30,9 @@ # Core algorithm of Cibersort -#' +#' #' @keywords internal -#' +#' #' @importFrom parallel mclapply #' @importFrom stats cor #' @@ -65,8 +65,8 @@ CoreAlg <- function(X, y, cores = 3){ #Execute In a parallel way the SVM if(cores>1){ - if(Sys.info()['sysname'] == 'Windows') out <- parallel::mclapply(1:svn_itor, res, mc.cores=1) - else out <- parallel::mclapply(1:svn_itor, res, mc.cores=cores) + if(Sys.info()['sysname'] == 'Windows') out <- parallel::mclapply(1:svn_itor, res, mc.cores=1) + else out <- parallel::mclapply(1:svn_itor, res, mc.cores=cores) } else out <- lapply(1:svn_itor, res) @@ -139,7 +139,7 @@ CoreAlg <- function(X, y, cores = 3){ } #' @importFrom stats sd -#' +#' #' @keywords internal #' doPerm <- function(perm, X, Y, cores = 3){ @@ -173,9 +173,9 @@ doPerm <- function(perm, X, Y, cores = 3){ } #' @importFrom stats sd -#' +#' #' @keywords internal -#' +#' my_CIBERSORT <- function(Y, X, perm=0, QN=TRUE, cores = 3){ @@ -215,6 +215,22 @@ my_CIBERSORT <- function(Y, X, perm=0, QN=TRUE, cores = 3){ XintY <- Xgns %in% row.names(Y) X <- X[XintY,,drop=FALSE] + # Eliminate empty samples + if(length(which(colSums(Y)==0))>0) + warning(sprintf( + "tidybulk says: the samples %s were ignored for decovolution as they have 0 counts for the deconvolution signature genes", + colnames(Y)[colSums(Y)==0] %>% paste(collapse = ", ") + )) + Y=Y[,colSums(Y)>0] + + # Eliminate sd == 0 + if(length(which(colSds(Y)==0))>0) + warning(sprintf( + "tidybulk says: the samples %s were ignored for decovolution as they have standard deviation of 0 for the deconvolution signature genes", + colnames(Y)[colSds(Y)==0] %>% paste(collapse = ", ") + )) + Y = Y[,colSds(Y)>0] + #standardize sig matrix X <- (X - mean(X)) / sd(as.vector(X)) diff --git a/R/dplyr_methods.R b/R/dplyr_methods.R index 52e2110d..80f8a1ea 100755 --- a/R/dplyr_methods.R +++ b/R/dplyr_methods.R @@ -33,25 +33,25 @@ #' individual methods for extra arguments and differences in behaviour. #' #' The following methods are currently available in loaded packages: -#' +#' #' @param .data A data frame, data frame extension (e.g. a tibble), or a #' lazy data frame (e.g. from dbplyr or dtplyr). See *Methods*, below, for #' more details. #' @param ... <[`tidy-eval`][dplyr_tidy_eval]> Variables, or functions or #' variables. Use [desc()] to sort a variable in descending order. #' @param .by_group If TRUE, will sort first by grouping variable. Applies to grouped data frames only. -#' +#' #' @return A tibble #' @family single table verbs -#' +#' #' @rdname arrange-methods #' @name arrange #' @importFrom dplyr arrange -#' +#' #' @examples -#' `%>%` = magrittr::`%>%` +#' #' arrange(mtcars, cyl, disp) -#' +#' #' @export NULL @@ -101,10 +101,10 @@ arrange.tidybulk <- function(.data, ..., .by_group = FALSE) { #' used instead. #' @return `bind_rows()` and `bind_cols()` return the same type as #' the first input, either a data frame, `tbl_df`, or `grouped_df`. -#' -#' +#' +#' #' @examples -#' `%>%` = magrittr::`%>%` +#' #' one <- mtcars[1:4, ] #' two <- mtcars[11:14, ] #' @@ -116,9 +116,9 @@ arrange.tidybulk <- function(.data, ..., .by_group = FALSE) { NULL #' @rdname bind-methods -#' +#' #' @inheritParams bind -#' +#' #' @export #' bind_rows <- function(..., .id = NULL) { @@ -134,9 +134,9 @@ bind_rows.default <- function(..., .id = NULL) #' @importFrom rlang dots_values #' @importFrom rlang flatten_if #' @importFrom rlang is_spliced -#' +#' #' @export -#' +#' bind_rows.tidybulk <- function(..., .id = NULL) { @@ -156,9 +156,9 @@ bind_rows.tidybulk <- function(..., .id = NULL) } #' @export -#' +#' #' @inheritParams bind -#' +#' #' @rdname bind-methods bind_cols <- function(..., .id = NULL) { UseMethod("bind_cols") @@ -173,9 +173,9 @@ bind_cols.default <- function(..., .id = NULL) #' @importFrom rlang dots_values #' @importFrom rlang flatten_if #' @importFrom rlang is_spliced -#' +#' #' @export -#' +#' bind_cols.tidybulk <- function(..., .id = NULL) { @@ -198,7 +198,7 @@ bind_cols.tidybulk <- function(..., .id = NULL) #' @rdname distinct-methods #' @name distinct #' @importFrom dplyr distinct -#' +#' #' @examples #' #' tidybulk::se_mini %>% tidybulk() %>% distinct() @@ -276,11 +276,11 @@ distinct.tidybulk <- function (.data, ..., .keep_all = FALSE) #' #' The following methods are currently available in loaded packages: #' @seealso [filter_all()], [filter_if()] and [filter_at()]. -#' +#' #' @rdname filter-methods #' @name filter #' @importFrom dplyr filter -#' +#' #' @export #' @examples #' @@ -365,10 +365,10 @@ group_by.tidybulk <- function (.data, ..., .add = FALSE, .drop = group_by_drop_d #' @rdname ungroup-methods #' @name ungroup #' @importFrom dplyr ungroup -#' +#' #' @param x A [tbl()] #' @param ... See dplyr -#' +#' #' @export ungroup.tidybulk <- function (x, ...) { @@ -591,15 +591,15 @@ mutate.nested_tidybulk <- function(.data, ...) .data %>% drop_class(c("nested_tidybulk", "tt")) %>% dplyr::mutate(...) %>% - + # Attach attributes reattach_internals(.data) %>% - + # Add class add_class("tt") %>% add_class("nested_tidybulk") - - + + } #' Rename columns @@ -632,7 +632,7 @@ mutate.nested_tidybulk <- function(.data, ...) #' `%>%` = magrittr::`%>%` #' iris <- as_tibble(iris) # so it prints a little nicer #' rename(iris, petal_length = Petal.Length) -#' +#' #' @rdname rename-methods #' @name rename #' @importFrom dplyr rename @@ -685,7 +685,7 @@ rename.tidybulk <- function(.data, ...) #' `%>%` = magrittr::`%>%` #' df <- expand.grid(x = 1:3, y = 3:1) #' df_done <- df %>% rowwise() %>% do(i = seq(.$x, .$y)) -#' +#' #' @rdname rowwise-methods #' @name rowwise #' @importFrom dplyr rowwise diff --git a/R/functions.R b/R/functions.R index e26d2942..6ee14c7e 100755 --- a/R/functions.R +++ b/R/functions.R @@ -1,6 +1,7 @@ #' Create tt object from tibble #' #' @keywords internal +#' @noRd #' #' @importFrom rlang enquo #' @importFrom magrittr %>% @@ -41,6 +42,7 @@ create_tt_from_tibble_bulk = function(.data, #' Convert bam/sam files to a tidy gene transcript counts data frame #' #' @keywords internal +#' @noRd #' #' @importFrom purrr reduce #' @@ -147,6 +149,7 @@ create_tt_from_bam_sam_bulk <- #' Get a tibble with scaled counts using TMM #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -163,7 +166,6 @@ create_tt_from_bam_sam_bulk <- #' @param method A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile") #' @param reference_sample A character string. The name of the reference sample. If NULL the sample with highest total read count will be selected as reference. #' -#' @noRd #' #' @return A tibble including additional columns #' @@ -271,6 +273,7 @@ get_scaled_counts_bulk <- function(.data, #' Get differential transcription information to a tibble using edgeR. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -531,6 +534,7 @@ get_differential_transcript_abundance_bulk <- function(.data, #' Get differential transcription information to a tibble using voom. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -738,6 +742,7 @@ get_differential_transcript_abundance_bulk_voom <- function(.data, #' Get differential transcription information to a tibble using DESeq2 #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -917,6 +922,7 @@ get_differential_transcript_abundance_deseq2 <- function(.data, #' Get differential composition information to a tibble using edgeR. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1079,6 +1085,7 @@ test_differential_cellularity_ <- function(.data, #' Get differential composition information to a tibble using edgeR. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1169,6 +1176,7 @@ test_stratification_cellularity_ <- function(.data, #' Get gene enrichment analyses using EGSEA #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1416,6 +1424,7 @@ test_gene_enrichment_bulk_EGSEA <- function(.data, #' Get K-mean clusters to a tibble #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1483,6 +1492,7 @@ get_clusters_kmeans_bulk <- #' Get SNN shared nearest neighbour clusters to a tibble #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1562,6 +1572,7 @@ get_clusters_SNN_bulk <- #' Get dimensionality information to a tibble using MDS #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1673,6 +1684,7 @@ get_reduced_dimensions_MDS_bulk <- #' Get principal component information to a tibble using PCA #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1816,6 +1828,7 @@ we suggest to partition the dataset for sample clusters. #' Get principal component information to a tibble using tSNE #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1929,6 +1942,7 @@ get_reduced_dimensions_TSNE_bulk <- #' Get rotated dimensions of two principal components or MDS dimension of choice, of an angle #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -2011,6 +2025,7 @@ get_rotated_dimensions = #' This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns #' #' @keywords internal +#' @noRd #' #' @importFrom dplyr summarise_all #' @importFrom dplyr bind_rows @@ -2150,6 +2165,7 @@ aggregate_duplicated_transcripts_bulk = #' This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns #' #' @keywords internal +#' @noRd #' #' @importFrom dplyr summarise_all #' @importFrom dplyr bind_rows @@ -2257,6 +2273,7 @@ aggregate_duplicated_transcripts_DT = #' Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -2377,6 +2394,7 @@ remove_redundancy_elements_through_correlation <- function(.data, #' Identifies the closest pairs in a MDS context and return one of them #' #' @keywords internal +#' @noRd #' #' @importFrom stats setNames #' @importFrom stats dist @@ -2531,6 +2549,7 @@ remove_redundancy_elements_though_reduced_dimensions <- #' get_symbol_from_ensembl #' #' @keywords internal +#' @noRd #' #' @description Get transcript column from ensembl gene id #' @@ -2573,6 +2592,7 @@ get_symbol_from_ensembl <- #' Perform linear equation system analysis through llsr #' #' @keywords internal +#' @noRd #' #' @importFrom stats lsfit #' @@ -2582,14 +2602,24 @@ get_symbol_from_ensembl <- #' @return A data frame #' #' -run_llsr = function(mix, reference = X_cibersort) { +run_llsr = function(mix, reference = X_cibersort, intercept= TRUE) { # Get common markers markers = intersect(rownames(mix), rownames(reference)) X <- (reference[markers, , drop = FALSE]) Y <- (mix[markers, , drop = FALSE]) - results <- t(data.frame(lsfit(X, Y)$coefficients)[-1, , drop = FALSE]) + X = as.matrix(X) + Y = as.matrix(Y) + + X <- (X - mean(X)) / sd(X) + Y <- apply(Y, 2, function(mc) (mc - mean(mc)) / sd(mc) ) + # Y <- (Y - mean(y)) / sd(Y) + + if(intercept) + results <- t(data.frame(lsfit(X, Y)$coefficients)[-1, , drop = FALSE]) + else + results <- t(data.frame(lsfit(X, Y, intercept=FALSE)$coefficients)) results[results < 0] <- 0 results <- results / apply(results, 1, sum) rownames(results) = colnames(Y) @@ -2600,6 +2630,7 @@ run_llsr = function(mix, reference = X_cibersort) { #' Perform linear equation system analysis through llsr #' #' @keywords internal +#' @noRd #' #' @importFrom stats lsfit #' @@ -2652,6 +2683,7 @@ run_epic = function(mix, reference = NULL) { #' Get cell type proportions from cibersort #' #' @keywords internal +#' @noRd #' #' @import parallel #' @import preprocessCore @@ -2733,7 +2765,7 @@ get_cell_type_proportions = function(.data, # Validate reference validate_signature(.data, reference, !!.transcript) - do.call(my_CIBERSORT, list(Y = ., X = reference) %>% c(dots_args)) %$% + do.call(my_CIBERSORT, list(Y = ., X = reference, QN=FALSE) %>% c(dots_args)) %$% proportions %>% as_tibble(rownames = quo_name(.sample)) %>% select(-`P-value`,-Correlation,-RMSE) @@ -2749,7 +2781,7 @@ get_cell_type_proportions = function(.data, validate_signature(.data, reference, !!.transcript) (.) %>% - run_llsr(reference) %>% + run_llsr(reference, ...) %>% as_tibble(rownames = quo_name(.sample)) }, @@ -2804,6 +2836,7 @@ get_cell_type_proportions = function(.data, #' Get adjusted count for some batch effect #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -2937,6 +2970,7 @@ get_adjusted_counts_for_unwanted_variation_bulk <- function(.data, #' Identify variable genes for dimensionality reduction #' #' @keywords internal +#' @noRd #' #' @param .data A tibble #' @param .sample A character name of the sample column @@ -2996,6 +3030,7 @@ keep_variable_transcripts = function(.data, #' tidybulk_to_SummarizedExperiment #' #' @keywords internal +#' @noRd #' #' @importFrom utils data #' @importFrom tidyr pivot_longer @@ -3088,66 +3123,10 @@ tidybulk_to_SummarizedExperiment = function(.data, } -#' Get matrix from tibble -#' -#' -#' @import dplyr -#' @import tidyr -#' @importFrom magrittr set_rownames -#' @importFrom rlang quo_is_null -#' -#' @param tbl A tibble -#' @param rownames A character string of the rownames -#' @param do_check A boolean -#' -#' @return A matrix -#' -#' @examples -#' -#' library(dplyr) -#' -#' tidybulk::se_mini %>% tidybulk() %>% select(feature, count) %>% head %>% as_matrix(rownames=feature) -#' -#' @export -as_matrix <- function(tbl, - rownames = NULL, - do_check = TRUE) { - rownames = enquo(rownames) - tbl %>% - - # Through warning if data frame is not numerical beside the rownames column (if present) - ifelse_pipe( - do_check && - tbl %>% - # If rownames defined eliminate it from the data frame - ifelse_pipe(!quo_is_null(rownames), ~ .x[,-1], ~ .x) %>% - dplyr::summarise_all(class) %>% - tidyr::gather(variable, class) %>% - pull(class) %>% - unique() %>% - `%in%`(c("numeric", "integer")) %>% not() %>% any(), - ~ { - warning("tidybulk says: there are NON-numerical columns, the matrix will NOT be numerical") - .x - } - ) %>% - as.data.frame() %>% - - # Deal with rownames column if present - ifelse_pipe( - !quo_is_null(rownames), - ~ .x %>% - magrittr::set_rownames(tbl %>% pull(!!rownames)) %>% - select(-1) - ) %>% - - # Convert to matrix - as.matrix() -} - #' This function is needed for DE in case the matrix is not rectangular, but includes NA #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -3157,6 +3136,7 @@ as_matrix <- function(tbl, #' @importFrom stats as.formula #' @importFrom utils install.packages #' @importFrom tidyr complete +#' @importFrom rlang quo_is_symbol #' #' @param .data A tibble #' @param .formula a formula with no response variable, of the kind ~ factor_of_interest + batch @@ -3258,6 +3238,7 @@ fill_NA_using_formula = function(.data, #' This function is needed for DE in case the matrix is not rectangular, but includes NA #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -3408,6 +3389,9 @@ fill_NA_using_value = function(.data, # filter(how_many_bimod == 0) +#' @keywords internal +#' @noRd +#' #' @importFrom stats p.adjust entrez_over_to_gsea = function(my_entrez_rank, species, gene_collections = NULL){ @@ -3462,6 +3446,10 @@ entrez_over_to_gsea = function(my_entrez_rank, species, gene_collections = NULL } +#' +#' @keywords internal +#' @noRd +#' #' @importFrom tibble rowid_to_column #' @importFrom stats p.adjust #' @importFrom purrr map diff --git a/R/functions_SE.R b/R/functions_SE.R index 11539720..389e72e8 100755 --- a/R/functions_SE.R +++ b/R/functions_SE.R @@ -1,6 +1,7 @@ #' Get K-mean clusters to a tibble #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -52,6 +53,7 @@ get_clusters_kmeans_bulk_SE <- #' Get SNN shared nearest neighbour clusters to a tibble #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -109,6 +111,7 @@ get_clusters_SNN_bulk_SE <- #' Get dimensionality information to a tibble using MDS #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -202,6 +205,7 @@ get_reduced_dimensions_MDS_bulk_SE <- #' Get principal component information to a tibble using PCA #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -303,6 +307,7 @@ we suggest to partition the dataset for sample clusters. #' Get principal component information to a tibble using tSNE #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -430,6 +435,7 @@ filter_if_abundant_were_identified = function(.data){ #' Identify variable genes for dimensionality reduction #' #' @keywords internal +#' @noRd #' #' @param .data A tibble #' @param .sample A character name of the sample column @@ -470,6 +476,7 @@ keep_variable_transcripts_SE = function(.data, #' Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -550,6 +557,7 @@ The correlation calculation might not be reliable" #' Identifies the closest pairs in a MDS context and return one of them #' #' @keywords internal +#' @noRd #' #' @importFrom stats setNames #' @importFrom stats dist @@ -598,6 +606,7 @@ remove_redundancy_elements_though_reduced_dimensions_SE <- #' Get differential transcription information to a tibble using edgeR. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -764,6 +773,7 @@ get_differential_transcript_abundance_bulk_SE <- function(.data, #' Get differential transcription information to a tibble using voom. #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -937,6 +947,7 @@ get_differential_transcript_abundance_bulk_voom_SE <- function(.data, #' Get differential transcription information to a tibble using DESeq2 #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1067,6 +1078,10 @@ get_differential_transcript_abundance_deseq2_SE <- function(.data, } +#' +#' @keywords internal +#' @noRd +#' #' @importFrom stringr str_remove #' @importFrom stringr str_replace_all #' diff --git a/R/ggplot.R b/R/ggplot.R new file mode 100644 index 00000000..489c3f62 --- /dev/null +++ b/R/ggplot.R @@ -0,0 +1,70 @@ +#' log10_reverse_trans +#' +#' `r lifecycle::badge("maturing")` +#' +#' @description it perform log scaling and reverse the axis. Useful to plot negative log probabilities. To not be used directly but with ggplot (e.g. scale_y_continuous(trans = "log10_reverse") ) +#' +#' @importFrom scales trans_new +#' @importFrom scales log_breaks +#' +#' @return A scales object +#' +#' @examples +#' +#' library(ggplot2) +#' library(tibble) +#' +#' tibble(pvalue = c(0.001, 0.05, 0.1), fold_change = 1:3) %>% +#' ggplot(aes(fold_change , pvalue)) + +#' geom_point() + +#' scale_y_continuous(trans = "log10_reverse") +#' +#' @export +log10_reverse_trans <- function() { + trans <- function(x) -log10(x) + inv <- function(x) 10^(-x) + + trans_new("log10_reverse", trans, inv, log_breaks(base = 10)) +} + +#' logit scale +#' +#' `r lifecycle::badge("maturing")` +#' +#' @description it perform logit scaling with right axis formatting. To not be used directly but with ggplot (e.g. scale_y_continuous(trans = "log10_reverse") ) +#' +#' @importFrom scales label_scientific +#' @importFrom scales extended_breaks +#' @importFrom stats qlogis plogis +#' +#' @return A scales object +#' +#' @examples +#' +#' library(ggplot2) +#' library(tibble) +#' +#' tibble(pvalue = c(0.001, 0.05, 0.1), fold_change = 1:3) %>% +#' ggplot(aes(fold_change , pvalue)) + +#' geom_point() + +#' scale_y_continuous(trans = "log10_reverse") +#' +#' @export +logit_trans <- function(){ + + + if (find.package("functional", quiet = TRUE) %>% length %>% equals(0)) { + message("Installing functional needed for analyses") + install.packages("functional", repos = "https://cloud.r-project.org") + } + + trans <- qlogis + inv <- plogis + + trans_new("logit", + transform = trans, + inverse = inv, + breaks = functional::Compose(trans, extended_breaks(), inv), + format = label_scientific(digits = 2) + ) +} diff --git a/R/methods.R b/R/methods.R index a9f92ee3..0305b179 100755 --- a/R/methods.R +++ b/R/methods.R @@ -1,4 +1,3 @@ -# setOldClass("spec_tbl_df") setOldClass("tidybulk") #' Creates an annotated `tidybulk` tibble from a `tbl` or `SummarizedExperiment` object @@ -32,9 +31,6 @@ setOldClass("tidybulk") #' #' @examples #' -#' -#' -#' #' my_tt = tidybulk(tidybulk::se_mini) #' #' @@ -331,8 +327,8 @@ setMethod("tidybulk_SAM_BAM", c(file_names = "character", genome = "character"), #' @examples #' #' -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' scale_abundance() #' #' @@ -738,14 +734,14 @@ setMethod("cluster_elements", "tidybulk", .cluster_elements) #' #' #' counts.MDS = -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' reduce_dimensions( method="MDS", .dims = 3) #' #' #' counts.PCA = -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' reduce_dimensions(method="PCA", .dims = 3) #' #' @@ -955,8 +951,8 @@ setMethod("reduce_dimensions", "tidybulk", .reduce_dimensions) #' @examples #' #' counts.MDS = -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' reduce_dimensions( method="MDS", .dims = 3) #' #' counts.MDS.rotated = rotate_dimensions(counts.MDS, `Dim1`, `Dim2`, rotation_degrees = 45, .element = sample) @@ -1150,8 +1146,8 @@ setMethod("rotate_dimensions", "tidybulk", .rotate_dimensions) #' @examples #' #' -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' remove_redundancy( #' .element = sample, #' .feature = transcript, @@ -1160,8 +1156,8 @@ setMethod("rotate_dimensions", "tidybulk", .rotate_dimensions) #' ) #' #' counts.MDS = -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' reduce_dimensions( method="MDS", .dims = 3) #' #' remove_redundancy( @@ -1330,8 +1326,8 @@ setMethod("remove_redundancy", "tidybulk", .remove_redundancy) #' #' res = #' cm %>% -#' tidybulk(sample, transcript, count) %>% -#' identify_abundant() %>% +#' tidybulk(sample, transcript, count) |> +#' identify_abundant() |> #' adjust_abundance( ~ condition + batch ) #' #' @@ -1650,7 +1646,7 @@ setMethod("aggregate_duplicates", "tidybulk", .aggregate_duplicates) #' library(dplyr) #' #' # Subsetting for time efficiency -#' tidybulk::se_mini %>% tidybulk() %>% filter(sample=="SRR1740034") %>% deconvolve_cellularity(sample, feature, count, cores = 1) +#' tidybulk::se_mini |> tidybulk() |>filter(sample=="SRR1740034") |> deconvolve_cellularity(sample, feature, count, cores = 1) #' #' #' @docType methods @@ -1790,7 +1786,7 @@ setMethod("deconvolve_cellularity", #' #' @examples #' -#' tidybulk::se_mini %>% tidybulk() %>% as_tibble() %>% symbol_to_entrez(.transcript = feature, .sample = sample) +#' tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez(.transcript = feature, .sample = sample) #' #' @export #' @@ -1989,7 +1985,7 @@ setMethod("describe_transcript", "tidybulk", .describe_transcript) #' #' library(dplyr) #' -#' tidybulk::counts_SE %>% tidybulk() %>% as_tibble() %>% ensembl_to_symbol(feature) +#' tidybulk::counts_SE |> tidybulk() |> as_tibble() |> ensembl_to_symbol(feature) #' #' #' @@ -2150,14 +2146,14 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol) #' #' # edgeR #' -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' test_differential_abundance( ~ condition ) #' #' # The function `test_differential_abundance` operates with contrasts too #' -#' tidybulk::se_mini %>% -#' identify_abundant() %>% +#' tidybulk::se_mini |> +#' identify_abundant() |> #' test_differential_abundance( #' ~ 0 + condition, #' .contrasts = c( "conditionTRUE - conditionFALSE") @@ -2168,14 +2164,14 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol) #' my_se_mini = tidybulk::se_mini #' my_se_mini$condition = factor(my_se_mini$condition) #' -#' my_se_mini %>% -#' identify_abundant() %>% +#' my_se_mini |> +#' identify_abundant() |> #' test_differential_abundance( ~ condition, method="deseq2" ) #' #' # The function `test_differential_abundance` operates with contrasts too #' -#' my_se_mini %>% -#' identify_abundant() %>% +#' my_se_mini |> +#' identify_abundant() |> #' test_differential_abundance( #' ~ 0 + condition, #' .contrasts = list(c("condition", "TRUE", "FALSE")), @@ -2857,7 +2853,7 @@ setMethod("keep_abundant", "tidybulk", .keep_abundant) #' @examples #' \dontrun{ #' -#' df_entrez = tidybulk::se_mini %>% tidybulk() %>% as_tibble() %>% symbol_to_entrez( .transcript = feature, .sample = sample) +#' df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) #' df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) #' #' library("EGSEA") @@ -3050,7 +3046,7 @@ setMethod("test_gene_enrichment", #' #' @examples #' -#' df_entrez = tidybulk::se_mini %>% tidybulk() %>% as_tibble() %>% symbol_to_entrez( .transcript = feature, .sample = sample) +#' df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) #' df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) #' df_entrez = mutate(df_entrez, do_test = feature %in% c("TNFRSF4", "PLCH2", "PADI4", "PAX7")) #' @@ -3217,7 +3213,7 @@ setMethod("test_gene_overrepresentation", #' #' @examples #' -#' df_entrez = tidybulk::se_mini %>% tidybulk() %>% as_tibble() %>% symbol_to_entrez( .transcript = feature, .sample = sample) +#' df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) #' df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) #' df_entrez = mutate(df_entrez, do_test = feature %in% c("TNFRSF4", "PLCH2", "PADI4", "PAX7")) #' df_entrez = df_entrez %>% test_differential_abundance(~ condition) @@ -3562,7 +3558,7 @@ setMethod("pivot_transcript", #' #' @examples #' -#' tidybulk::se_mini %>% tidybulk() %>% fill_missing_abundance( fill_with = 0) +#' tidybulk::se_mini |> tidybulk() |> fill_missing_abundance( fill_with = 0) #' #' #' @docType methods @@ -3829,16 +3825,16 @@ setMethod("impute_missing_abundance", "tidybulk", .impute_missing_abundance) #' library(dplyr) #' library(tidyr) #' -#' tidybulk::se_mini %>% -#' tidybulk() %>% +#' tidybulk::se_mini |> +#' tidybulk() |> #' #' # Add survival data -#' nest(data = -sample) %>% +#' nest(data = -sample) |> #' mutate( #' days = c(1, 10, 500, 1000, 2000), #' dead = c(1, 1, 1, 0, 1) #' ) %>% -#' unnest(data) %>% +#' unnest(data) |> #' #' # Test #' test_differential_cellularity( @@ -3982,16 +3978,16 @@ setMethod("test_differential_cellularity", #' library(dplyr) #' library(tidyr) #' -#' tidybulk::se_mini %>% -#' tidybulk() %>% +#' tidybulk::se_mini |> +#' tidybulk() |> #' #' # Add survival data -#' nest(data = -sample) %>% +#' nest(data = -sample) |> #' mutate( #' days = c(1, 10, 500, 1000, 2000), #' dead = c(1, 1, 1, 0, 1) #' ) %>% -#' unnest(data) %>% +#' unnest(data) |> #' test_stratification_cellularity( #' survival::Surv(days, dead) ~ ., #' cores = 1 @@ -4183,3 +4179,60 @@ setMethod("get_bibliography", setMethod("get_bibliography", "tidybulk", .get_bibliography) + +#' Get matrix from tibble +#' +#' +#' @import dplyr +#' @import tidyr +#' @importFrom magrittr set_rownames +#' @importFrom rlang quo_is_null +#' +#' @param tbl A tibble +#' @param rownames A character string of the rownames +#' @param do_check A boolean +#' +#' @return A matrix +#' +#' @examples +#' +#' library(dplyr) +#' +#' tidybulk::se_mini |> tidybulk() |> select(feature, count) |> head() |> as_matrix(rownames=feature) +#' +#' @export +as_matrix <- function(tbl, + rownames = NULL, + do_check = TRUE) { + rownames = enquo(rownames) + tbl %>% + + # Through warning if data frame is not numerical beside the rownames column (if present) + ifelse_pipe( + do_check && + tbl %>% + # If rownames defined eliminate it from the data frame + ifelse_pipe(!quo_is_null(rownames), ~ .x[,-1], ~ .x) %>% + dplyr::summarise_all(class) %>% + tidyr::gather(variable, class) %>% + pull(class) %>% + unique() %>% + `%in%`(c("numeric", "integer")) %>% not() %>% any(), + ~ { + warning("tidybulk says: there are NON-numerical columns, the matrix will NOT be numerical") + .x + } + ) %>% + as.data.frame() %>% + + # Deal with rownames column if present + ifelse_pipe( + !quo_is_null(rownames), + ~ .x %>% + magrittr::set_rownames(tbl %>% pull(!!rownames)) %>% + select(-1) + ) %>% + + # Convert to matrix + as.matrix() +} diff --git a/R/methods_SE.R b/R/methods_SE.R index a1432700..08453ae1 100755 --- a/R/methods_SE.R +++ b/R/methods_SE.R @@ -939,7 +939,7 @@ setMethod("aggregate_duplicates", # Validate reference validate_signature_SE(.data, reference, !!.transcript) - do.call(my_CIBERSORT, list(Y = ., X = reference) %>% c(dots_args)) %$% + do.call(my_CIBERSORT, list(Y = ., X = reference, QN=FALSE) %>% c(dots_args)) %$% proportions %>% as_tibble(rownames = quo_name(.sample)) %>% select(-`P-value`,-Correlation,-RMSE) @@ -955,7 +955,7 @@ setMethod("aggregate_duplicates", validate_signature_SE(.data, reference, !!.transcript) (.) %>% - run_llsr(reference) %>% + run_llsr(reference, ...) %>% as_tibble(rownames = quo_name(.sample)) }, @@ -1004,7 +1004,7 @@ setMethod("aggregate_duplicates", colData(.data) = colData(.data) %>% cbind( my_proportions %>% as_matrix(rownames = "sample") %>% - .[rownames(colData(.data)),] + .[match(rownames(colData(.data)), rownames(.)),] ) .data %>% diff --git a/R/tibble.R b/R/tibble.R new file mode 100644 index 00000000..a126e730 --- /dev/null +++ b/R/tibble.R @@ -0,0 +1,7 @@ +#' @importFrom tibble tibble +#' @export +tibble::tibble + +#' @importFrom tibble as_tibble +#' @export +tibble::as_tibble diff --git a/R/tidySummarizedExperiment.R b/R/tidySummarizedExperiment.R index 94f1142f..f7ab582e 100644 --- a/R/tidySummarizedExperiment.R +++ b/R/tidySummarizedExperiment.R @@ -1,14 +1,14 @@ change_reserved_column_names = function(.data){ - + .data %>% - + setNames( - colnames(.) %>% - str_replace("^feature$", "feature.x") %>% - str_replace("^sample$", "sample.x") %>% + colnames(.) %>% + str_replace("^feature$", "feature.x") %>% + str_replace("^sample$", "sample.x") %>% str_replace("^coordinate$", "coordinate.x") - ) - + ) + } #' @importFrom dplyr select @@ -17,72 +17,73 @@ change_reserved_column_names = function(.data){ #' @importFrom tibble tibble #' @importFrom SummarizedExperiment rowRanges #' @importFrom tibble rowid_to_column -#' +#' +#' @keywords internal #' @noRd get_special_datasets <- function(SummarizedExperiment_object) { - + SummarizedExperiment_object %>% rowRanges() %>% - when( + when( # If no ranges as.data.frame(.) %>% nrow() %>% equals(0) ~ tibble(), - + # If it is a range list (multiple rows per feature) - class(.) %>% equals("CompressedGRangesList") ~ + class(.) %>% equals("CompressedGRangesList") ~ tibble::as_tibble(.) %>% eliminate_GRanges_metadata_columns_also_present_in_Rowdata(SummarizedExperiment_object) %>% nest(coordinate = -group_name) %>% rename(feature = group_name), - + # If standard GRanges (one feature per line) ~ { - transcript_column = - rowRanges(SummarizedExperiment_object) %>% - as.data.frame() %>% + transcript_column = + rowRanges(SummarizedExperiment_object) %>% + as.data.frame() %>% lapply(function(x) rownames(SummarizedExperiment_object)[1] %in% x) %>% unlist() %>% which() %>% - names() - - + names() + + # Just rename (.) %>% - - # If transcript_column exists all good + + # If transcript_column exists all good when( !is.null(transcript_column) ~ tibble::as_tibble(.) %>% eliminate_GRanges_metadata_columns_also_present_in_Rowdata(SummarizedExperiment_object) %>% rename(feature := !!transcript_column) , - + # If transcript_column is NULL add numeric column ~ tibble::as_tibble(.) %>% eliminate_GRanges_metadata_columns_also_present_in_Rowdata(SummarizedExperiment_object) %>% rowid_to_column(var = "feature") %>% mutate(feature = as.character(feature)) ) %>% - + # Always nest nest(coordinate = -feature) - + } ) %>% list() - + } change_reserved_column_names = function(.data){ - + .data %>% - + setNames( - colnames(.) %>% - str_replace("^feature$", "feature.x") %>% - str_replace("^sample$", "sample.x") %>% + colnames(.) %>% + str_replace("^feature$", "feature.x") %>% + str_replace("^sample$", "sample.x") %>% str_replace("^coordinate$", "coordinate.x") - ) - + ) + } #' @importFrom tidyr gather @@ -91,7 +92,8 @@ change_reserved_column_names = function(.data){ #' @importFrom tibble as_tibble #' @importFrom purrr reduce #' @importFrom SummarizedExperiment assays -#' +#' +#' @keywords internal #' @noRd get_count_datasets <- function(SummarizedExperiment_object) { map2( @@ -99,16 +101,16 @@ get_count_datasets <- function(SummarizedExperiment_object) { names(assays(SummarizedExperiment_object)), ~ .x %>% tibble::as_tibble(rownames = "feature", .name_repair = "minimal") %>% - + # If the matrix does not have sample names, fix column names when(colnames(.x) %>% is.null() ~ setNames(., c( - "feature", seq_len(ncol(.x)) + "feature", seq_len(ncol(.x)) )), ~ (.) ) %>% - + gather(sample, count,-feature) %>% rename(!!.y := count) ) %>% reduce(left_join, by = c("feature", "sample")) -} \ No newline at end of file +} diff --git a/R/utilities.R b/R/utilities.R index 5c1f956d..638657b1 100755 --- a/R/utilities.R +++ b/R/utilities.R @@ -9,6 +9,7 @@ my_stop = function() { #' This is a generalisation of ifelse that accepts an object and return an objects #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -33,6 +34,7 @@ ifelse_pipe = function(.x, .p, .f1, .f2 = NULL) { #' This is a generalisation of ifelse that acceots an object and return an objects #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -72,6 +74,7 @@ ifelse2_pipe = function(.x, .p1, .p2, .f1, .f2, .f3 = NULL) { #' Check whether a numeric vector has been log transformed #' #' @keywords internal +#' @noRd #' #' @param x A numeric vector #' @param .abundance A character name of the transcript/gene abundance column @@ -90,6 +93,7 @@ error_if_log_transformed <- function(x, .abundance) { #' Check whether there are duplicated genes/transcripts #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -132,6 +136,7 @@ error_if_duplicated_genes <- function(.data, #' Check whether there are NA counts #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -156,6 +161,7 @@ error_if_counts_is_na = function(.data, .abundance) { #' Check whether there are NA counts #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -192,6 +198,7 @@ error_if_wrong_input = function(.data, list_input, expected_type) { #' .formula parser #' #' @keywords internal +#' @noRd #' #' @importFrom stats terms #' @@ -208,6 +215,9 @@ parse_formula <- function(fm) { #' Formula parser with survival #' +#' @keywords internal +#' @noRd +#' #' @param fm A formula #' #' @return A character vector @@ -229,6 +239,7 @@ parse_formula_survival <- function(fm) { #' Scale design matrix #' #' @keywords internal +#' @noRd #' #' @importFrom stats setNames #' @importFrom stats cov @@ -262,6 +273,8 @@ get_tt_columns = function(.data){ else NULL } +#' @importFrom rlang quo_is_symbol +#' add_tt_columns = function(.data, .sample, .transcript, @@ -349,6 +362,7 @@ memorise_methods_used = function(.data, .method, object_containing_methods = .da #' Add attribute to abject #' #' @keywords internal +#' @noRd #' #' #' @param var A tibble @@ -364,6 +378,7 @@ add_attr = function(var, attribute, name) { #' Drop attribute to abject #' #' @keywords internal +#' @noRd #' #' #' @param var A tibble @@ -378,13 +393,13 @@ drop_attr = function(var, name) { #' Remove class to abject #' #' @keywords internal +#' @noRd #' #' #' @param var A tibble #' @param name A character name of the class #' #' @return A tibble with an additional attribute -#' @keywords internal drop_class = function(var, name) { class(var) <- class(var)[!class(var)%in%name] var @@ -393,6 +408,7 @@ drop_class = function(var, name) { #' From rlang deprecated #' #' @keywords internal +#' @noRd #' #' @param x An array #' @param values An array @@ -415,6 +431,7 @@ prepend = function (x, values, before = 1) #' Add class to abject #' #' @keywords internal +#' @noRd #' #' @param var A tibble #' @param name A character name of the attribute @@ -430,6 +447,7 @@ add_class = function(var, name) { #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @importFrom rlang quo_is_symbolic @@ -464,6 +482,7 @@ get_sample_transcript_counts = function(.data, .sample, .transcript, .abundance) #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -491,6 +510,7 @@ get_sample_counts = function(.data, .sample, .abundance){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -512,6 +532,7 @@ get_sample = function(.data, .sample){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -543,6 +564,7 @@ get_transcript = function(.data, .transcript){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -571,6 +593,7 @@ get_sample_transcript = function(.data, .sample, .transcript){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -594,6 +617,7 @@ get_sample = function(.data, .sample){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -647,6 +671,7 @@ get_elements_features = function(.data, .element, .feature, of_samples = TRUE){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -694,6 +719,7 @@ get_elements_features_abundance = function(.data, .element, .feature, .abundance #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -738,6 +764,7 @@ get_elements = function(.data, .element, of_samples = TRUE){ #' Get column names either from user or from attributes #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_is_symbol #' @@ -784,6 +811,7 @@ get_abundance_norm_if_exists = function(.data, .abundance){ #' Sub function of remove_redundancy_elements_though_reduced_dimensions #' #' @keywords internal +#' @noRd #' #' @importFrom stats dist #' @importFrom utils head @@ -814,6 +842,7 @@ select_closest_pairs = function(df) { #' This function is needed for DE in case the matrix is not rectangular, but includes NA #' #' @keywords internal +#' @noRd #' #' @param .matrix A matrix #' @@ -829,23 +858,15 @@ fill_NA_with_row_median = function(.matrix){ .matrix } -# #' @importFrom magrittr %>% -# #' @export -# magrittr::`%>%` -#' @importFrom tibble tibble -#' @export -tibble::tibble - -#' @importFrom tibble as_tibble -#' @export -tibble::as_tibble #' get_x_y_annotation_columns #' #' @keywords internal +#' @noRd #' #' @importFrom magrittr equals +#' @importFrom rlang quo_is_symbol #' #' @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)) #' @param .horizontal The name of the column horizontally presented in the heatmap @@ -990,81 +1011,13 @@ get_specific_annotation_columns = function(.data, .col){ } -#' log10_reverse_trans -#' -#' `r lifecycle::badge("maturing")` -#' -#' @description it perform log scaling and reverse the axis. Useful to plot negative log probabilities. To not be used directly but with ggplot (e.g. scale_y_continuous(trans = "log10_reverse") ) -#' -#' @importFrom scales trans_new -#' @importFrom scales log_breaks -#' -#' @return A scales object -#' -#' @examples -#' -#' library(ggplot2) -#' library(tibble) -#' -#' tibble(pvalue = c(0.001, 0.05, 0.1), fold_change = 1:3) %>% -#' ggplot(aes(fold_change , pvalue)) + -#' geom_point() + -#' scale_y_continuous(trans = "log10_reverse") -#' -#' @export -log10_reverse_trans <- function() { - trans <- function(x) -log10(x) - inv <- function(x) 10^(-x) - - trans_new("log10_reverse", trans, inv, log_breaks(base = 10)) -} - -#' logit scale -#' -#' `r lifecycle::badge("maturing")` -#' -#' @description it perform logit scaling with right axis formatting. To not be used directly but with ggplot (e.g. scale_y_continuous(trans = "log10_reverse") ) -#' -#' @importFrom scales label_scientific -#' @importFrom scales extended_breaks -#' @importFrom stats qlogis plogis -#' -#' @return A scales object -#' -#' @examples -#' -#' library(ggplot2) -#' library(tibble) -#' -#' tibble(pvalue = c(0.001, 0.05, 0.1), fold_change = 1:3) %>% -#' ggplot(aes(fold_change , pvalue)) + -#' geom_point() + -#' scale_y_continuous(trans = "log10_reverse") -#' -#' @export -logit_trans <- function(){ - - - if (find.package("functional", quiet = TRUE) %>% length %>% equals(0)) { - message("Installing functional needed for analyses") - install.packages("functional", repos = "https://cloud.r-project.org") - } - - trans <- qlogis - inv <- plogis - trans_new("logit", - transform = trans, - inverse = inv, - breaks = functional::Compose(trans, extended_breaks(), inv), - format = label_scientific(digits = 2) - ) -} #' Convert array of quosure (e.g. c(col_a, col_b)) into character vector #' #' @keywords internal +#' @noRd #' #' @importFrom rlang quo_name #' @importFrom rlang quo_squash @@ -1083,12 +1036,14 @@ quo_names <- function(v) { #' Drop lowly transcribed genes for TMM normalization #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr #' @import tibble #' @importFrom rlang := #' @importFrom stats median +#' @importFrom rlang quo_is_symbol #' #' @param .data A tibble #' @param .sample The name of the sample column @@ -1180,6 +1135,7 @@ add_scaled_counts_bulk.get_low_expressed <- function(.data, #' Calculate the norm factor with calcNormFactor from limma #' #' @keywords internal +#' @noRd #' #' @import dplyr #' @import tidyr @@ -1279,6 +1235,10 @@ do_validate = function(){ } +#' +#' @keywords internal +#' @noRd +#' #' @importFrom stringr str_remove #' @importFrom stringr str_replace_all #' @@ -1577,6 +1537,10 @@ rotation = function(m, d) { ) %>% as_matrix) %*% m) } +#' +#' @keywords internal +#' @noRd +#' #' @importFrom dplyr select #' @importFrom tibble as_tibble #' @importFrom tibble tibble diff --git a/man/add_attr.Rd b/man/add_attr.Rd deleted file mode 100644 index 8cfb80fa..00000000 --- a/man/add_attr.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{add_attr} -\alias{add_attr} -\title{Add attribute to abject} -\usage{ -add_attr(var, attribute, name) -} -\arguments{ -\item{var}{A tibble} - -\item{attribute}{An object} - -\item{name}{A character name of the attribute} -} -\value{ -A tibble with an additional attribute -} -\description{ -Add attribute to abject -} -\keyword{internal} diff --git a/man/add_class.Rd b/man/add_class.Rd deleted file mode 100644 index a9875e5b..00000000 --- a/man/add_class.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{add_class} -\alias{add_class} -\title{Add class to abject} -\usage{ -add_class(var, name) -} -\arguments{ -\item{var}{A tibble} - -\item{name}{A character name of the attribute} -} -\value{ -A tibble with an additional attribute -} -\description{ -Add class to abject -} -\keyword{internal} diff --git a/man/add_scaled_counts_bulk.calcNormFactor.Rd b/man/add_scaled_counts_bulk.calcNormFactor.Rd deleted file mode 100644 index 5604677e..00000000 --- a/man/add_scaled_counts_bulk.calcNormFactor.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{add_scaled_counts_bulk.calcNormFactor} -\alias{add_scaled_counts_bulk.calcNormFactor} -\title{Calculate the norm factor with calcNormFactor from limma} -\usage{ -add_scaled_counts_bulk.calcNormFactor( - .data, - reference = NULL, - .sample = sample, - .transcript = transcript, - .abundance = count, - method -) -} -\arguments{ -\item{.data}{A tibble} - -\item{reference}{A reference matrix, not sure if used anymore} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{method}{A string character. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} -} -\value{ -A list including the filtered data frame and the normalization factors -} -\description{ -Calculate the norm factor with calcNormFactor from limma -} -\keyword{internal} diff --git a/man/add_scaled_counts_bulk.get_low_expressed.Rd b/man/add_scaled_counts_bulk.get_low_expressed.Rd deleted file mode 100644 index 64655edf..00000000 --- a/man/add_scaled_counts_bulk.get_low_expressed.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{add_scaled_counts_bulk.get_low_expressed} -\alias{add_scaled_counts_bulk.get_low_expressed} -\title{Drop lowly transcribed genes for TMM normalization} -\usage{ -add_scaled_counts_bulk.get_low_expressed( - .data, - .sample = sample, - .transcript = transcript, - .abundance = count, - factor_of_interest = NULL, - minimum_counts = 10, - minimum_proportion = 0.7 -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{factor_of_interest}{The name of the column of the factor of interest} - -\item{minimum_counts}{A positive integer. Minimum counts required for at least some samples.} - -\item{minimum_proportion}{A real positive number between 0 and 1. It is the threshold of proportion of samples for each transcripts/genes that have to be characterised by a cmp bigger than the threshold to be included for scaling procedure.} -} -\value{ -A tibble filtered -} -\description{ -Drop lowly transcribed genes for TMM normalization -} -\keyword{internal} diff --git a/man/adjust_abundance-methods.Rd b/man/adjust_abundance-methods.Rd index 7a4418b3..9c970b64 100644 --- a/man/adjust_abundance-methods.Rd +++ b/man/adjust_abundance-methods.Rd @@ -128,8 +128,8 @@ cm$batch[colnames(cm) \%in\% c("SRR1740035", "SRR1740043")] = 1 res = cm \%>\% - tidybulk(sample, transcript, count) \%>\% - identify_abundant() \%>\% + tidybulk(sample, transcript, count) |> + identify_abundant() |> adjust_abundance( ~ condition + batch ) diff --git a/man/aggregate_duplicated_transcripts_DT.Rd b/man/aggregate_duplicated_transcripts_DT.Rd deleted file mode 100644 index 6ccf014e..00000000 --- a/man/aggregate_duplicated_transcripts_DT.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{aggregate_duplicated_transcripts_DT} -\alias{aggregate_duplicated_transcripts_DT} -\title{Aggregates multiple counts from the same samples (e.g., from isoforms) -This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns} -\usage{ -aggregate_duplicated_transcripts_DT( - .data, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - aggregation_function = sum, - keep_integer = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{aggregation_function}{A function for counts aggregation (e.g., sum)} - -\item{keep_integer}{A boolean} -} -\value{ -A tibble with aggregated genes and annotation -} -\description{ -Aggregates multiple counts from the same samples (e.g., from isoforms) -This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns -} -\keyword{internal} diff --git a/man/aggregate_duplicated_transcripts_bulk.Rd b/man/aggregate_duplicated_transcripts_bulk.Rd deleted file mode 100644 index 99eef667..00000000 --- a/man/aggregate_duplicated_transcripts_bulk.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{aggregate_duplicated_transcripts_bulk} -\alias{aggregate_duplicated_transcripts_bulk} -\title{Aggregates multiple counts from the same samples (e.g., from isoforms) -This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns} -\usage{ -aggregate_duplicated_transcripts_bulk( - .data, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - aggregation_function = sum, - keep_integer = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{aggregation_function}{A function for counts aggregation (e.g., sum)} - -\item{keep_integer}{A boolean} -} -\value{ -A tibble with aggregated genes and annotation -} -\description{ -Aggregates multiple counts from the same samples (e.g., from isoforms) -This function aggregates counts over samples, concatenates other character columns, and averages other numeric columns -} -\keyword{internal} diff --git a/man/arrange-methods.Rd b/man/arrange-methods.Rd index 3c57f6e1..477fb465 100644 --- a/man/arrange-methods.Rd +++ b/man/arrange-methods.Rd @@ -52,7 +52,7 @@ The following methods are currently available in loaded packages: } \examples{ -`\%>\%` = magrittr::`\%>\%` + arrange(mtcars, cyl, disp) } diff --git a/man/as_matrix.Rd b/man/as_matrix.Rd index 063eb51c..92cd7fed 100644 --- a/man/as_matrix.Rd +++ b/man/as_matrix.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R +% Please edit documentation in R/methods.R \name{as_matrix} \alias{as_matrix} \title{Get matrix from tibble} @@ -23,6 +23,6 @@ Get matrix from tibble library(dplyr) -tidybulk::se_mini \%>\% tidybulk() \%>\% select(feature, count) \%>\% head \%>\% as_matrix(rownames=feature) +tidybulk::se_mini |> tidybulk() |> select(feature, count) |> head() |> as_matrix(rownames=feature) } diff --git a/man/bind-methods.Rd b/man/bind-methods.Rd index 2af14ebd..577dd764 100644 --- a/man/bind-methods.Rd +++ b/man/bind-methods.Rd @@ -46,7 +46,7 @@ The output of `bind_rows()` will contain a column if that column appears in any of the inputs. } \examples{ -`\%>\%` = magrittr::`\%>\%` + one <- mtcars[1:4, ] two <- mtcars[11:14, ] diff --git a/man/create_tt_from_bam_sam_bulk.Rd b/man/create_tt_from_bam_sam_bulk.Rd deleted file mode 100644 index d4bb4904..00000000 --- a/man/create_tt_from_bam_sam_bulk.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{create_tt_from_bam_sam_bulk} -\alias{create_tt_from_bam_sam_bulk} -\title{Convert bam/sam files to a tidy gene transcript counts data frame} -\usage{ -create_tt_from_bam_sam_bulk(file_names, genome = "hg38", ...) -} -\arguments{ -\item{file_names}{A character vector} - -\item{genome}{A character string} - -\item{...}{Further parameters passed to the function Rsubread::featureCounts} -} -\value{ -A tibble of gene counts -} -\description{ -Convert bam/sam files to a tidy gene transcript counts data frame -} -\keyword{internal} diff --git a/man/create_tt_from_tibble_bulk.Rd b/man/create_tt_from_tibble_bulk.Rd deleted file mode 100644 index cf1d3cfa..00000000 --- a/man/create_tt_from_tibble_bulk.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{create_tt_from_tibble_bulk} -\alias{create_tt_from_tibble_bulk} -\title{Create tt object from tibble} -\usage{ -create_tt_from_tibble_bulk( - .data, - .sample, - .transcript, - .abundance, - .abundance_scaled = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.abundance_scaled}{The name of the transcript/gene scaled abundance column} -} -\value{ -A tibble with an additional column -} -\description{ -Create tt object from tibble -} -\keyword{internal} diff --git a/man/deconvolve_cellularity-methods.Rd b/man/deconvolve_cellularity-methods.Rd index 204611ac..5c885ed1 100644 --- a/man/deconvolve_cellularity-methods.Rd +++ b/man/deconvolve_cellularity-methods.Rd @@ -131,7 +131,7 @@ CIBERSORT(Y = data, X = reference, ...) library(dplyr) # Subsetting for time efficiency -tidybulk::se_mini \%>\% tidybulk() \%>\% filter(sample=="SRR1740034") \%>\% deconvolve_cellularity(sample, feature, count, cores = 1) +tidybulk::se_mini |> tidybulk() |>filter(sample=="SRR1740034") |> deconvolve_cellularity(sample, feature, count, cores = 1) } diff --git a/man/drop_attr.Rd b/man/drop_attr.Rd deleted file mode 100644 index b1e760eb..00000000 --- a/man/drop_attr.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{drop_attr} -\alias{drop_attr} -\title{Drop attribute to abject} -\usage{ -drop_attr(var, name) -} -\arguments{ -\item{var}{A tibble} - -\item{name}{A character name of the attribute} -} -\value{ -A tibble with an additional attribute -} -\description{ -Drop attribute to abject -} -\keyword{internal} diff --git a/man/drop_class.Rd b/man/drop_class.Rd deleted file mode 100644 index 01c5014f..00000000 --- a/man/drop_class.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{drop_class} -\alias{drop_class} -\title{Remove class to abject} -\usage{ -drop_class(var, name) -} -\arguments{ -\item{var}{A tibble} - -\item{name}{A character name of the class} -} -\value{ -A tibble with an additional attribute -} -\description{ -Remove class to abject -} -\keyword{internal} diff --git a/man/ensembl_to_symbol-methods.Rd b/man/ensembl_to_symbol-methods.Rd index cecdf6da..8cc48e50 100644 --- a/man/ensembl_to_symbol-methods.Rd +++ b/man/ensembl_to_symbol-methods.Rd @@ -44,7 +44,7 @@ This is useful since different resources use ensembl IDs while others use gene s library(dplyr) -tidybulk::counts_SE \%>\% tidybulk() \%>\% as_tibble() \%>\% ensembl_to_symbol(feature) +tidybulk::counts_SE |> tidybulk() |> as_tibble() |> ensembl_to_symbol(feature) diff --git a/man/error_if_counts_is_na.Rd b/man/error_if_counts_is_na.Rd deleted file mode 100644 index 4b1db15e..00000000 --- a/man/error_if_counts_is_na.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{error_if_counts_is_na} -\alias{error_if_counts_is_na} -\title{Check whether there are NA counts} -\usage{ -error_if_counts_is_na(.data, .abundance) -} -\arguments{ -\item{.data}{A tibble of read counts} - -\item{.abundance}{A character name of the read count column} -} -\value{ -A tbl -} -\description{ -Check whether there are NA counts -} -\keyword{internal} diff --git a/man/error_if_duplicated_genes.Rd b/man/error_if_duplicated_genes.Rd deleted file mode 100644 index d1bd0829..00000000 --- a/man/error_if_duplicated_genes.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{error_if_duplicated_genes} -\alias{error_if_duplicated_genes} -\title{Check whether there are duplicated genes/transcripts} -\usage{ -error_if_duplicated_genes( - .data, - .sample = sample, - .transcript = transcript, - .abundance = `read count` -) -} -\arguments{ -\item{.data}{A tibble of read counts} - -\item{.sample}{A character name of the sample column} - -\item{.transcript}{A character name of the transcript/gene column} - -\item{.abundance}{A character name of the read count column} -} -\value{ -A tbl -} -\description{ -Check whether there are duplicated genes/transcripts -} -\keyword{internal} diff --git a/man/error_if_log_transformed.Rd b/man/error_if_log_transformed.Rd deleted file mode 100644 index 9f8d5052..00000000 --- a/man/error_if_log_transformed.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{error_if_log_transformed} -\alias{error_if_log_transformed} -\title{Check whether a numeric vector has been log transformed} -\usage{ -error_if_log_transformed(x, .abundance) -} -\arguments{ -\item{x}{A numeric vector} - -\item{.abundance}{A character name of the transcript/gene abundance column} -} -\value{ -NA -} -\description{ -Check whether a numeric vector has been log transformed -} -\keyword{internal} diff --git a/man/error_if_wrong_input.Rd b/man/error_if_wrong_input.Rd deleted file mode 100644 index 00244e4f..00000000 --- a/man/error_if_wrong_input.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{error_if_wrong_input} -\alias{error_if_wrong_input} -\title{Check whether there are NA counts} -\usage{ -error_if_wrong_input(.data, list_input, expected_type) -} -\arguments{ -\item{.data}{A tibble of read counts} - -\item{list_input}{A list} - -\item{expected_type}{A character string} -} -\value{ -A tbl -} -\description{ -Check whether there are NA counts -} -\keyword{internal} diff --git a/man/fill_NA_using_formula.Rd b/man/fill_NA_using_formula.Rd deleted file mode 100644 index f44f40e2..00000000 --- a/man/fill_NA_using_formula.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{fill_NA_using_formula} -\alias{fill_NA_using_formula} -\title{This function is needed for DE in case the matrix is not rectangular, but includes NA} -\usage{ -fill_NA_using_formula( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - .abundance_scaled = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, of the kind ~ factor_of_interest + batch} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.abundance_scaled}{The name of the transcript/gene scaled abundance column} -} -\value{ -A tibble with adjusted counts -} -\description{ -This function is needed for DE in case the matrix is not rectangular, but includes NA -} -\keyword{internal} diff --git a/man/fill_NA_using_value.Rd b/man/fill_NA_using_value.Rd deleted file mode 100644 index f973d7cd..00000000 --- a/man/fill_NA_using_value.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{fill_NA_using_value} -\alias{fill_NA_using_value} -\title{This function is needed for DE in case the matrix is not rectangular, but includes NA} -\usage{ -fill_NA_using_value(.data, .sample, .transcript, .abundance, fill_with) -} -\arguments{ -\item{.data}{A `tbl` formatted as | | | | <...> |} - -\item{.sample}{The name of the element column} - -\item{.transcript}{The name of the feature/gene column} - -\item{.abundance}{The name of the feature/gene value column} - -\item{fill_with}{A numerical value with which fill the missing data points} -} -\value{ -A tibble with adjusted counts -} -\description{ -This function is needed for DE in case the matrix is not rectangular, but includes NA -} -\keyword{internal} diff --git a/man/fill_NA_with_row_median.Rd b/man/fill_NA_with_row_median.Rd deleted file mode 100644 index 991f7c6e..00000000 --- a/man/fill_NA_with_row_median.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{fill_NA_with_row_median} -\alias{fill_NA_with_row_median} -\title{This function is needed for DE in case the matrix is not rectangular, but includes NA} -\usage{ -fill_NA_with_row_median(.matrix) -} -\arguments{ -\item{.matrix}{A matrix} -} -\value{ -A matrix -} -\description{ -This function is needed for DE in case the matrix is not rectangular, but includes NA -} -\keyword{internal} diff --git a/man/fill_missing_abundance-methods.Rd b/man/fill_missing_abundance-methods.Rd index 99195717..eff5fa8e 100644 --- a/man/fill_missing_abundance-methods.Rd +++ b/man/fill_missing_abundance-methods.Rd @@ -70,7 +70,7 @@ This function fills the abundance of missing sample-transcript pair using the me } \examples{ -tidybulk::se_mini \%>\% tidybulk() \%>\% fill_missing_abundance( fill_with = 0) +tidybulk::se_mini |> tidybulk() |> fill_missing_abundance( fill_with = 0) } diff --git a/man/get_abundance_norm_if_exists.Rd b/man/get_abundance_norm_if_exists.Rd deleted file mode 100644 index 39737b1d..00000000 --- a/man/get_abundance_norm_if_exists.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_abundance_norm_if_exists} -\alias{get_abundance_norm_if_exists} -\title{Get column names either from user or from attributes} -\usage{ -get_abundance_norm_if_exists(.data, .abundance) -} -\arguments{ -\item{.data}{A tibble} - -\item{.abundance}{A character name of the abundance column} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_adjusted_counts_for_unwanted_variation_bulk.Rd b/man/get_adjusted_counts_for_unwanted_variation_bulk.Rd deleted file mode 100644 index 2713ae33..00000000 --- a/man/get_adjusted_counts_for_unwanted_variation_bulk.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_adjusted_counts_for_unwanted_variation_bulk} -\alias{get_adjusted_counts_for_unwanted_variation_bulk} -\title{Get adjusted count for some batch effect} -\usage{ -get_adjusted_counts_for_unwanted_variation_bulk( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - log_transform = TRUE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, of the kind ~ factor_of_interest + batch} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function sva::ComBat} -} -\value{ -A tibble with adjusted counts -} -\description{ -Get adjusted count for some batch effect -} -\keyword{internal} diff --git a/man/get_cell_type_proportions.Rd b/man/get_cell_type_proportions.Rd deleted file mode 100644 index e83617ab..00000000 --- a/man/get_cell_type_proportions.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_cell_type_proportions} -\alias{get_cell_type_proportions} -\title{Get cell type proportions from cibersort} -\usage{ -get_cell_type_proportions( - .data, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - reference = NULL, - method = "cibersort", - prefix = "", - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{reference}{A data frame. The transcript/cell_type data frame of integer transcript abundance} - -\item{method}{A character string. The method to be used. At the moment Cibersort (default) and llsr (linear least squares regression) are available.} - -\item{prefix}{A character string. The prefix you would like to add to the result columns. It is useful if you want to reshape data.} - -\item{...}{Further parameters passed to the function Cibersort} -} -\value{ -A tibble including additional columns -} -\description{ -Get cell type proportions from cibersort -} -\keyword{internal} diff --git a/man/get_clusters_SNN_bulk.Rd b/man/get_clusters_SNN_bulk.Rd deleted file mode 100644 index a5336b48..00000000 --- a/man/get_clusters_SNN_bulk.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_clusters_SNN_bulk} -\alias{get_clusters_SNN_bulk} -\title{Get SNN shared nearest neighbour clusters to a tibble} -\usage{ -get_clusters_SNN_bulk( - .data, - .element = NULL, - .feature = NULL, - .abundance, - of_samples = TRUE, - log_transform = TRUE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally genes)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally samples)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function kmeans} -} -\value{ -A tibble with additional columns -} -\description{ -Get SNN shared nearest neighbour clusters to a tibble -} -\keyword{internal} diff --git a/man/get_clusters_SNN_bulk_SE.Rd b/man/get_clusters_SNN_bulk_SE.Rd deleted file mode 100644 index d9028842..00000000 --- a/man/get_clusters_SNN_bulk_SE.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_clusters_SNN_bulk_SE} -\alias{get_clusters_SNN_bulk_SE} -\title{Get SNN shared nearest neighbour clusters to a tibble} -\usage{ -get_clusters_SNN_bulk_SE(.data, of_samples = TRUE, log_transform = TRUE, ...) -} -\arguments{ -\item{.data}{A tibble} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function kmeans} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally samples)} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally genes)} -} -\value{ -A tibble with additional columns -} -\description{ -Get SNN shared nearest neighbour clusters to a tibble -} -\keyword{internal} diff --git a/man/get_clusters_kmeans_bulk.Rd b/man/get_clusters_kmeans_bulk.Rd deleted file mode 100644 index 3159cc07..00000000 --- a/man/get_clusters_kmeans_bulk.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_clusters_kmeans_bulk} -\alias{get_clusters_kmeans_bulk} -\title{Get K-mean clusters to a tibble} -\usage{ -get_clusters_kmeans_bulk( - .data, - .element = NULL, - .feature = NULL, - .abundance = NULL, - of_samples = TRUE, - log_transform = TRUE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally genes)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally samples)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function kmeans} -} -\value{ -A tibble with additional columns -} -\description{ -Get K-mean clusters to a tibble -} -\keyword{internal} diff --git a/man/get_clusters_kmeans_bulk_SE.Rd b/man/get_clusters_kmeans_bulk_SE.Rd deleted file mode 100644 index ee6018a1..00000000 --- a/man/get_clusters_kmeans_bulk_SE.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_clusters_kmeans_bulk_SE} -\alias{get_clusters_kmeans_bulk_SE} -\title{Get K-mean clusters to a tibble} -\usage{ -get_clusters_kmeans_bulk_SE( - .data, - of_samples = TRUE, - log_transform = TRUE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function kmeans} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally samples)} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally genes)} -} -\value{ -A tibble with additional columns -} -\description{ -Get K-mean clusters to a tibble -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_bulk.Rd b/man/get_differential_transcript_abundance_bulk.Rd deleted file mode 100755 index 4188f69b..00000000 --- a/man/get_differential_transcript_abundance_bulk.Rd +++ /dev/null @@ -1,51 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_differential_transcript_abundance_bulk} -\alias{get_differential_transcript_abundance_bulk} -\title{Get differential transcription information to a tibble using edgeR.} -\usage{ -get_differential_transcript_abundance_bulk( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - .contrasts = NULL, - method = "edgeR_quasi_likelihood", - test_above_log2_fold_change = NULL, - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "", - .sample_total_read_count = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.contrasts}{A character vector. See edgeR makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{test_above_log2_fold_change}{A positive real value. This works for edgeR and limma_voom methods. It uses the `treat` function, which tests that the difference in abundance is bigger than this threshold rather than zero \url{https://pubmed.ncbi.nlm.nih.gov/19176553}.} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} - -\item{.sample_total_read_count}{} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential transcription information to a tibble using edgeR. -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_bulk_SE.Rd b/man/get_differential_transcript_abundance_bulk_SE.Rd deleted file mode 100755 index 3caabdf4..00000000 --- a/man/get_differential_transcript_abundance_bulk_SE.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_differential_transcript_abundance_bulk_SE} -\alias{get_differential_transcript_abundance_bulk_SE} -\title{Get differential transcription information to a tibble using edgeR.} -\usage{ -get_differential_transcript_abundance_bulk_SE( - .data, - .formula, - sample_annotation, - .contrasts = NULL, - method = "edgeR_quasi_likelihood", - test_above_log2_fold_change = NULL, - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "", - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.contrasts}{A character vector. See edgeR makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{test_above_log2_fold_change}{A positive real value. This works for edgeR and limma_voom methods. It uses the `treat` function, which tests that the difference in abundance is bigger than this threshold rather than zero \url{https://pubmed.ncbi.nlm.nih.gov/19176553}.} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential transcription information to a tibble using edgeR. -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_bulk_voom.Rd b/man/get_differential_transcript_abundance_bulk_voom.Rd deleted file mode 100644 index 421152db..00000000 --- a/man/get_differential_transcript_abundance_bulk_voom.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_differential_transcript_abundance_bulk_voom} -\alias{get_differential_transcript_abundance_bulk_voom} -\title{Get differential transcription information to a tibble using voom.} -\usage{ -get_differential_transcript_abundance_bulk_voom( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - .contrasts = NULL, - method = NULL, - test_above_log2_fold_change = NULL, - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "" -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.contrasts}{A character vector. See voom makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "limma_voom", "limma_voom_sample_weights"} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} -} -\value{ -A tibble with voom results -} -\description{ -Get differential transcription information to a tibble using voom. -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_bulk_voom_SE.Rd b/man/get_differential_transcript_abundance_bulk_voom_SE.Rd deleted file mode 100644 index c9956f9f..00000000 --- a/man/get_differential_transcript_abundance_bulk_voom_SE.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_differential_transcript_abundance_bulk_voom_SE} -\alias{get_differential_transcript_abundance_bulk_voom_SE} -\title{Get differential transcription information to a tibble using voom.} -\usage{ -get_differential_transcript_abundance_bulk_voom_SE( - .data, - .formula, - sample_annotation, - .contrasts = NULL, - method = NULL, - test_above_log2_fold_change = NULL, - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "" -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.contrasts}{A character vector. See voom makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "limma_voom", "limma_voom_sample_weights"} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} -} -\value{ -A tibble with voom results -} -\description{ -Get differential transcription information to a tibble using voom. -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_deseq2.Rd b/man/get_differential_transcript_abundance_deseq2.Rd deleted file mode 100644 index 3ad07555..00000000 --- a/man/get_differential_transcript_abundance_deseq2.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_differential_transcript_abundance_deseq2} -\alias{get_differential_transcript_abundance_deseq2} -\title{Get differential transcription information to a tibble using DESeq2} -\usage{ -get_differential_transcript_abundance_deseq2( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - .contrasts = NULL, - method = "edgeR_quasi_likelihood", - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "", - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.contrasts}{A character vector. See edgeR makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} - -\item{...}{Additional arguments for DESeq2} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential transcription information to a tibble using DESeq2 -} -\keyword{internal} diff --git a/man/get_differential_transcript_abundance_deseq2_SE.Rd b/man/get_differential_transcript_abundance_deseq2_SE.Rd deleted file mode 100644 index 1bfa3fc2..00000000 --- a/man/get_differential_transcript_abundance_deseq2_SE.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_differential_transcript_abundance_deseq2_SE} -\alias{get_differential_transcript_abundance_deseq2_SE} -\title{Get differential transcription information to a tibble using DESeq2} -\usage{ -get_differential_transcript_abundance_deseq2_SE( - .data, - .formula, - .contrasts = NULL, - method = "edgeR_quasi_likelihood", - scaling_method = "TMM", - omit_contrast_in_colnames = FALSE, - prefix = "", - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.contrasts}{A character vector. See edgeR makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{scaling_method}{A character string. The scaling method passed to the backend function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")} - -\item{omit_contrast_in_colnames}{If just one contrast is specified you can choose to omit the contrast label in the colnames.} - -\item{...}{Additional arguments for DESeq2} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential transcription information to a tibble using DESeq2 -} -\keyword{internal} diff --git a/man/get_elements.Rd b/man/get_elements.Rd deleted file mode 100644 index 0a54f2c0..00000000 --- a/man/get_elements.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_elements} -\alias{get_elements} -\title{Get column names either from user or from attributes} -\usage{ -get_elements(.data, .element, of_samples = TRUE) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A character name of the sample column} - -\item{of_samples}{A boolean} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_elements_features.Rd b/man/get_elements_features.Rd deleted file mode 100644 index 1d01b9e4..00000000 --- a/man/get_elements_features.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_elements_features} -\alias{get_elements_features} -\title{Get column names either from user or from attributes} -\usage{ -get_elements_features(.data, .element, .feature, of_samples = TRUE) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A character name of the sample column} - -\item{.feature}{A character name of the transcript/gene column} - -\item{of_samples}{A boolean} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_elements_features_abundance.Rd b/man/get_elements_features_abundance.Rd deleted file mode 100644 index 2cc306b2..00000000 --- a/man/get_elements_features_abundance.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_elements_features_abundance} -\alias{get_elements_features_abundance} -\title{Get column names either from user or from attributes} -\usage{ -get_elements_features_abundance( - .data, - .element, - .feature, - .abundance, - of_samples = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A character name of the sample column} - -\item{.feature}{A character name of the transcript/gene column} - -\item{.abundance}{A character name of the read count column} - -\item{of_samples}{A boolean} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_MDS_bulk.Rd b/man/get_reduced_dimensions_MDS_bulk.Rd deleted file mode 100644 index eaba44a3..00000000 --- a/man/get_reduced_dimensions_MDS_bulk.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_reduced_dimensions_MDS_bulk} -\alias{get_reduced_dimensions_MDS_bulk} -\title{Get dimensionality information to a tibble using MDS} -\usage{ -get_reduced_dimensions_MDS_bulk( - .data, - .element = NULL, - .feature = NULL, - .abundance = NULL, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} -} -\value{ -A tibble with additional columns -} -\description{ -Get dimensionality information to a tibble using MDS -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_MDS_bulk_SE.Rd b/man/get_reduced_dimensions_MDS_bulk_SE.Rd deleted file mode 100644 index 7b6ce8fd..00000000 --- a/man/get_reduced_dimensions_MDS_bulk_SE.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_reduced_dimensions_MDS_bulk_SE} -\alias{get_reduced_dimensions_MDS_bulk_SE} -\title{Get dimensionality information to a tibble using MDS} -\usage{ -get_reduced_dimensions_MDS_bulk_SE( - .data, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE, - scale = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{scale}{A boolean} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} -} -\value{ -A tibble with additional columns -} -\description{ -Get dimensionality information to a tibble using MDS -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_PCA_bulk.Rd b/man/get_reduced_dimensions_PCA_bulk.Rd deleted file mode 100644 index 14111ffd..00000000 --- a/man/get_reduced_dimensions_PCA_bulk.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_reduced_dimensions_PCA_bulk} -\alias{get_reduced_dimensions_PCA_bulk} -\title{Get principal component information to a tibble using PCA} -\usage{ -get_reduced_dimensions_PCA_bulk( - .data, - .element = NULL, - .feature = NULL, - .abundance = NULL, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE, - scale = FALSE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{scale}{A boolean} - -\item{...}{Further parameters passed to the function prcomp} -} -\value{ -A tibble with additional columns -} -\description{ -Get principal component information to a tibble using PCA -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_PCA_bulk_SE.Rd b/man/get_reduced_dimensions_PCA_bulk_SE.Rd deleted file mode 100644 index e3342d61..00000000 --- a/man/get_reduced_dimensions_PCA_bulk_SE.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_reduced_dimensions_PCA_bulk_SE} -\alias{get_reduced_dimensions_PCA_bulk_SE} -\title{Get principal component information to a tibble using PCA} -\usage{ -get_reduced_dimensions_PCA_bulk_SE( - .data, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE, - scale = FALSE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{scale}{A boolean} - -\item{...}{Further parameters passed to the function prcomp} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} -} -\value{ -A tibble with additional columns -} -\description{ -Get principal component information to a tibble using PCA -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_TSNE_bulk.Rd b/man/get_reduced_dimensions_TSNE_bulk.Rd deleted file mode 100644 index 8a1a9f7b..00000000 --- a/man/get_reduced_dimensions_TSNE_bulk.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_reduced_dimensions_TSNE_bulk} -\alias{get_reduced_dimensions_TSNE_bulk} -\title{Get principal component information to a tibble using tSNE} -\usage{ -get_reduced_dimensions_TSNE_bulk( - .data, - .element = NULL, - .feature = NULL, - .abundance = NULL, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{...}{Further parameters passed to the function Rtsne} -} -\value{ -A tibble with additional columns -} -\description{ -Get principal component information to a tibble using tSNE -} -\keyword{internal} diff --git a/man/get_reduced_dimensions_TSNE_bulk_SE.Rd b/man/get_reduced_dimensions_TSNE_bulk_SE.Rd deleted file mode 100644 index 4fe2727d..00000000 --- a/man/get_reduced_dimensions_TSNE_bulk_SE.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{get_reduced_dimensions_TSNE_bulk_SE} -\alias{get_reduced_dimensions_TSNE_bulk_SE} -\title{Get principal component information to a tibble using tSNE} -\usage{ -get_reduced_dimensions_TSNE_bulk_SE( - .data, - .dims = 2, - top = 500, - of_samples = TRUE, - log_transform = TRUE, - scale = NULL, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.dims}{A integer vector corresponding to principal components of interest (e.g., 1:6)} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{scale}{A boolean} - -\item{...}{Further parameters passed to the function Rtsne} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} -} -\value{ -A tibble with additional columns -} -\description{ -Get principal component information to a tibble using tSNE -} -\keyword{internal} diff --git a/man/get_rotated_dimensions.Rd b/man/get_rotated_dimensions.Rd deleted file mode 100644 index b511b2f7..00000000 --- a/man/get_rotated_dimensions.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_rotated_dimensions} -\alias{get_rotated_dimensions} -\title{Get rotated dimensions of two principal components or MDS dimension of choice, of an angle} -\usage{ -get_rotated_dimensions( - .data, - dimension_1_column, - dimension_2_column, - rotation_degrees, - .element = NULL, - of_samples = TRUE, - dimension_1_column_rotated = NULL, - dimension_2_column_rotated = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{dimension_1_column}{A column symbol. The column of the dimension 1} - -\item{dimension_2_column}{A column symbol. The column of the dimension 2} - -\item{rotation_degrees}{A real number between 0 and 360} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} - -\item{of_samples}{A boolean} - -\item{dimension_1_column_rotated}{A column symbol. The column of the dimension 1 rotated} - -\item{dimension_2_column_rotated}{A column symbol. The column of the dimension 2 rotated} -} -\value{ -A tibble with additional rotated columns -} -\description{ -Get rotated dimensions of two principal components or MDS dimension of choice, of an angle -} -\keyword{internal} diff --git a/man/get_sample.Rd b/man/get_sample.Rd deleted file mode 100644 index c57d0faa..00000000 --- a/man/get_sample.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_sample} -\alias{get_sample} -\title{Get column names either from user or from attributes} -\usage{ -get_sample(.data, .sample) - -get_sample(.data, .sample) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{A character name of the sample column} -} -\value{ -A list of column enquo or error - -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes - -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_sample_counts.Rd b/man/get_sample_counts.Rd deleted file mode 100644 index 87d3f56c..00000000 --- a/man/get_sample_counts.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_sample_counts} -\alias{get_sample_counts} -\title{Get column names either from user or from attributes} -\usage{ -get_sample_counts(.data, .sample, .abundance) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{A character name of the sample column} - -\item{.abundance}{A character name of the read count column} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_sample_transcript.Rd b/man/get_sample_transcript.Rd deleted file mode 100644 index 44643989..00000000 --- a/man/get_sample_transcript.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_sample_transcript} -\alias{get_sample_transcript} -\title{Get column names either from user or from attributes} -\usage{ -get_sample_transcript(.data, .sample, .transcript) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{A character name of the sample column} - -\item{.transcript}{A character name of the transcript/gene column} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_sample_transcript_counts.Rd b/man/get_sample_transcript_counts.Rd deleted file mode 100644 index 46289118..00000000 --- a/man/get_sample_transcript_counts.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_sample_transcript_counts} -\alias{get_sample_transcript_counts} -\title{Get column names either from user or from attributes} -\usage{ -get_sample_transcript_counts(.data, .sample, .transcript, .abundance) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{A character name of the sample column} - -\item{.transcript}{A character name of the transcript/gene column} - -\item{.abundance}{A character name of the read count column} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_symbol_from_ensembl.Rd b/man/get_symbol_from_ensembl.Rd deleted file mode 100644 index 351e4cd0..00000000 --- a/man/get_symbol_from_ensembl.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{get_symbol_from_ensembl} -\alias{get_symbol_from_ensembl} -\title{after wget, this function merges hg37 and hg38 mapping data bases - Do not execute!} -\usage{ -get_symbol_from_ensembl(.data, .ensembl) -} -\arguments{ -\item{.data}{A tibble} - -\item{.ensembl}{A column symbol. The column that is represents ensembl gene id} -} -\value{ -A tibble with ensembl-transcript mapping - -after wget, this function merges hg37 and hg38 mapping data bases - Do not execute! - -A tibble with ensembl-transcript mapping - -get_symbol_from_ensembl - -A tibble with added annotation -} -\description{ -Get transcript column from ensembl gene id -} -\keyword{internal} diff --git a/man/get_transcript.Rd b/man/get_transcript.Rd deleted file mode 100644 index 6814c2af..00000000 --- a/man/get_transcript.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_transcript} -\alias{get_transcript} -\title{Get column names either from user or from attributes} -\usage{ -get_transcript(.data, .transcript) -} -\arguments{ -\item{.data}{A tibble} - -\item{.transcript}{A character name of the transcript column} -} -\value{ -A list of column enquo or error -} -\description{ -Get column names either from user or from attributes -} -\keyword{internal} diff --git a/man/get_x_y_annotation_columns.Rd b/man/get_x_y_annotation_columns.Rd deleted file mode 100644 index d33a74d7..00000000 --- a/man/get_x_y_annotation_columns.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{get_x_y_annotation_columns} -\alias{get_x_y_annotation_columns} -\title{get_x_y_annotation_columns} -\usage{ -get_x_y_annotation_columns( - .data, - .horizontal, - .vertical, - .abundance, - .abundance_scaled -) -} -\arguments{ -\item{.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))} - -\item{.horizontal}{The name of the column horizontally presented in the heatmap} - -\item{.vertical}{The name of the column vertically presented in the heatmap} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.abundance_scaled}{The name of the transcript/gene scaled abundance column} -} -\value{ -A list -} -\description{ -This function recognise what are the sample-wise columns and transcrip-wise columns -} -\keyword{internal} diff --git a/man/ifelse2_pipe.Rd b/man/ifelse2_pipe.Rd deleted file mode 100644 index 1ecee12e..00000000 --- a/man/ifelse2_pipe.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{ifelse2_pipe} -\alias{ifelse2_pipe} -\title{This is a generalisation of ifelse that acceots an object and return an objects} -\usage{ -ifelse2_pipe(.x, .p1, .p2, .f1, .f2, .f3 = NULL) -} -\arguments{ -\item{.x}{A tibble} - -\item{.p1}{A boolean} - -\item{.p2}{ELSE IF condition} - -\item{.f1}{A function} - -\item{.f2}{A function} - -\item{.f3}{A function} -} -\value{ -A tibble -} -\description{ -This is a generalisation of ifelse that acceots an object and return an objects -} -\keyword{internal} diff --git a/man/ifelse_pipe.Rd b/man/ifelse_pipe.Rd deleted file mode 100644 index 58792813..00000000 --- a/man/ifelse_pipe.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{ifelse_pipe} -\alias{ifelse_pipe} -\title{This is a generalisation of ifelse that accepts an object and return an objects} -\usage{ -ifelse_pipe(.x, .p, .f1, .f2 = NULL) -} -\arguments{ -\item{.x}{A tibble} - -\item{.p}{A boolean} - -\item{.f1}{A function} - -\item{.f2}{A function} -} -\value{ -A tibble -} -\description{ -This is a generalisation of ifelse that accepts an object and return an objects -} -\keyword{internal} diff --git a/man/keep_variable_transcripts.Rd b/man/keep_variable_transcripts.Rd deleted file mode 100644 index cb9612d5..00000000 --- a/man/keep_variable_transcripts.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{keep_variable_transcripts} -\alias{keep_variable_transcripts} -\title{Identify variable genes for dimensionality reduction} -\usage{ -keep_variable_transcripts( - .data, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - top = 500, - log_transform = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{A character name of the sample column} - -\item{.transcript}{A character name of the transcript/gene column} - -\item{.abundance}{A character name of the read count column} - -\item{top}{An integer. How many top genes to select} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} -} -\value{ -A tibble filtered genes -} -\description{ -Identify variable genes for dimensionality reduction -} -\keyword{internal} diff --git a/man/keep_variable_transcripts_SE.Rd b/man/keep_variable_transcripts_SE.Rd deleted file mode 100644 index 29d142ed..00000000 --- a/man/keep_variable_transcripts_SE.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{keep_variable_transcripts_SE} -\alias{keep_variable_transcripts_SE} -\title{Identify variable genes for dimensionality reduction} -\usage{ -keep_variable_transcripts_SE(.data, top = 500, log_transform = TRUE) -} -\arguments{ -\item{.data}{A tibble} - -\item{top}{An integer. How many top genes to select} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} - -\item{.sample}{A character name of the sample column} - -\item{.transcript}{A character name of the transcript/gene column} - -\item{.abundance}{A character name of the read count column} -} -\value{ -A tibble filtered genes -} -\description{ -Identify variable genes for dimensionality reduction -} -\keyword{internal} diff --git a/man/log10_reverse_trans.Rd b/man/log10_reverse_trans.Rd index f5df8d5d..37381c67 100644 --- a/man/log10_reverse_trans.Rd +++ b/man/log10_reverse_trans.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R +% Please edit documentation in R/ggplot.R \name{log10_reverse_trans} \alias{log10_reverse_trans} \title{log10_reverse_trans} diff --git a/man/logit_trans.Rd b/man/logit_trans.Rd index 205d19e8..c4ce5423 100644 --- a/man/logit_trans.Rd +++ b/man/logit_trans.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R +% Please edit documentation in R/ggplot.R \name{logit_trans} \alias{logit_trans} \title{logit scale} diff --git a/man/parse_formula.Rd b/man/parse_formula.Rd deleted file mode 100644 index fded17c3..00000000 --- a/man/parse_formula.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{parse_formula} -\alias{parse_formula} -\title{.formula parser} -\usage{ -parse_formula(fm) -} -\arguments{ -\item{fm}{a formula} -} -\value{ -A character vector -} -\description{ -.formula parser -} -\keyword{internal} diff --git a/man/parse_formula_survival.Rd b/man/parse_formula_survival.Rd deleted file mode 100644 index 2891089b..00000000 --- a/man/parse_formula_survival.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{parse_formula_survival} -\alias{parse_formula_survival} -\title{Formula parser with survival} -\usage{ -parse_formula_survival(fm) -} -\arguments{ -\item{fm}{A formula} -} -\value{ -A character vector -} -\description{ -Formula parser with survival -} diff --git a/man/prepend.Rd b/man/prepend.Rd deleted file mode 100644 index 16c63eec..00000000 --- a/man/prepend.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{prepend} -\alias{prepend} -\title{From rlang deprecated} -\usage{ -prepend(x, values, before = 1) -} -\arguments{ -\item{x}{An array} - -\item{values}{An array} - -\item{before}{A boolean} -} -\value{ -An array -} -\description{ -From rlang deprecated -} -\keyword{internal} diff --git a/man/quo_names.Rd b/man/quo_names.Rd deleted file mode 100644 index be1a65d8..00000000 --- a/man/quo_names.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{quo_names} -\alias{quo_names} -\title{Convert array of quosure (e.g. c(col_a, col_b)) into character vector} -\usage{ -quo_names(v) -} -\arguments{ -\item{v}{A array of quosures (e.g. c(col_a, col_b))} -} -\value{ -A character vector -} -\description{ -Convert array of quosure (e.g. c(col_a, col_b)) into character vector -} -\keyword{internal} diff --git a/man/reduce_dimensions-methods.Rd b/man/reduce_dimensions-methods.Rd index 8c86c11d..e68bf821 100644 --- a/man/reduce_dimensions-methods.Rd +++ b/man/reduce_dimensions-methods.Rd @@ -162,14 +162,14 @@ Rtsne::Rtsne(data, ...) counts.MDS = - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> reduce_dimensions( method="MDS", .dims = 3) counts.PCA = - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> reduce_dimensions(method="PCA", .dims = 3) diff --git a/man/reexports.Rd b/man/reexports.Rd index 6e2761f0..9aadcc4e 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/dplyr_methods.R, R/utilities.R +% Please edit documentation in R/dplyr_methods.R, R/tibble.R \docType{import} \name{reexports} \alias{reexports} diff --git a/man/remove_redundancy-methods.Rd b/man/remove_redundancy-methods.Rd index 926e83ca..5cb9e2fd 100644 --- a/man/remove_redundancy-methods.Rd +++ b/man/remove_redundancy-methods.Rd @@ -139,8 +139,8 @@ remove_redundancy() takes as input A `tbl` (with at least three columns for samp \examples{ - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> remove_redundancy( .element = sample, .feature = transcript, @@ -149,8 +149,8 @@ remove_redundancy() takes as input A `tbl` (with at least three columns for samp ) counts.MDS = - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> reduce_dimensions( method="MDS", .dims = 3) remove_redundancy( diff --git a/man/remove_redundancy_elements_though_reduced_dimensions.Rd b/man/remove_redundancy_elements_though_reduced_dimensions.Rd deleted file mode 100644 index 08c9118b..00000000 --- a/man/remove_redundancy_elements_though_reduced_dimensions.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{remove_redundancy_elements_though_reduced_dimensions} -\alias{remove_redundancy_elements_though_reduced_dimensions} -\title{Identifies the closest pairs in a MDS context and return one of them} -\usage{ -remove_redundancy_elements_though_reduced_dimensions( - .data, - Dim_a_column, - Dim_b_column, - .element = NULL, - of_samples = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{Dim_a_column}{A column symbol. The column of one principal component} - -\item{Dim_b_column}{A column symbol. The column of another principal component} - -\item{.element}{A column symbol. The column that is represents entities to cluster (i.e., normally samples)} - -\item{of_samples}{A boolean} -} -\value{ -A tibble with pairs dropped -} -\description{ -Identifies the closest pairs in a MDS context and return one of them -} -\keyword{internal} diff --git a/man/remove_redundancy_elements_though_reduced_dimensions_SE.Rd b/man/remove_redundancy_elements_though_reduced_dimensions_SE.Rd deleted file mode 100644 index 721864d9..00000000 --- a/man/remove_redundancy_elements_though_reduced_dimensions_SE.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{remove_redundancy_elements_though_reduced_dimensions_SE} -\alias{remove_redundancy_elements_though_reduced_dimensions_SE} -\title{Identifies the closest pairs in a MDS context and return one of them} -\usage{ -remove_redundancy_elements_though_reduced_dimensions_SE(.data) -} -\arguments{ -\item{.data}{A tibble} - -\item{of_samples}{A boolean} -} -\value{ -A tibble with pairs dropped -} -\description{ -Identifies the closest pairs in a MDS context and return one of them -} -\keyword{internal} diff --git a/man/remove_redundancy_elements_through_correlation.Rd b/man/remove_redundancy_elements_through_correlation.Rd deleted file mode 100644 index 5ad2c134..00000000 --- a/man/remove_redundancy_elements_through_correlation.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{remove_redundancy_elements_through_correlation} -\alias{remove_redundancy_elements_through_correlation} -\title{Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated} -\usage{ -remove_redundancy_elements_through_correlation( - .data, - .element = NULL, - .feature = NULL, - .abundance = NULL, - correlation_threshold = 0.9, - top = Inf, - of_samples = TRUE, - log_transform = FALSE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.element}{A column symbol. The column that is used to calculate distance (i.e., normally samples)} - -\item{.feature}{A column symbol. The column that is represents entities to cluster (i.e., normally genes)} - -\item{.abundance}{A column symbol with the value the clustering is based on (e.g., `count`)} - -\item{correlation_threshold}{A real number between 0 and 1} - -\item{top}{An integer. How many top genes to select} - -\item{of_samples}{A boolean} - -\item{log_transform}{A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)} -} -\value{ -A tibble with redundant elements removed -} -\description{ -Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated -} -\keyword{internal} diff --git a/man/remove_redundancy_elements_through_correlation_SE.Rd b/man/remove_redundancy_elements_through_correlation_SE.Rd deleted file mode 100644 index 4c6b8460..00000000 --- a/man/remove_redundancy_elements_through_correlation_SE.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions_SE.R -\name{remove_redundancy_elements_through_correlation_SE} -\alias{remove_redundancy_elements_through_correlation_SE} -\title{Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated} -\usage{ -remove_redundancy_elements_through_correlation_SE( - .data, - correlation_threshold = 0.9, - of_samples = TRUE -) -} -\arguments{ -\item{.data}{A tibble} - -\item{correlation_threshold}{A real number between 0 and 1} - -\item{of_samples}{A boolean} - -\item{top}{An integer. How many top genes to select} -} -\value{ -A tibble with redundant elements removed -} -\description{ -Drop redundant elements (e.g., samples) for which feature (e.g., genes) aboundances are correlated -} -\keyword{internal} diff --git a/man/rotate_dimensions-methods.Rd b/man/rotate_dimensions-methods.Rd index ec227dd1..d029e6bc 100644 --- a/man/rotate_dimensions-methods.Rd +++ b/man/rotate_dimensions-methods.Rd @@ -136,8 +136,8 @@ Underlying custom method: \examples{ counts.MDS = - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> reduce_dimensions( method="MDS", .dims = 3) counts.MDS.rotated = rotate_dimensions(counts.MDS, `Dim1`, `Dim2`, rotation_degrees = 45, .element = sample) diff --git a/man/run_epic.Rd b/man/run_epic.Rd deleted file mode 100644 index e7b2a588..00000000 --- a/man/run_epic.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{run_epic} -\alias{run_epic} -\title{Perform linear equation system analysis through llsr} -\usage{ -run_epic(mix, reference = NULL) -} -\arguments{ -\item{mix}{A data frame} - -\item{reference}{A data frame} -} -\value{ -A data frame -} -\description{ -Perform linear equation system analysis through llsr -} -\keyword{internal} diff --git a/man/run_llsr.Rd b/man/run_llsr.Rd deleted file mode 100644 index 75559923..00000000 --- a/man/run_llsr.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{run_llsr} -\alias{run_llsr} -\title{Perform linear equation system analysis through llsr} -\usage{ -run_llsr(mix, reference = X_cibersort) -} -\arguments{ -\item{mix}{A data frame} - -\item{reference}{A data frame} -} -\value{ -A data frame -} -\description{ -Perform linear equation system analysis through llsr -} -\keyword{internal} diff --git a/man/scale_abundance-methods.Rd b/man/scale_abundance-methods.Rd index 5a8ddd49..21cd6476 100644 --- a/man/scale_abundance-methods.Rd +++ b/man/scale_abundance-methods.Rd @@ -132,8 +132,8 @@ edgeR::calcNormFactors(.data, method = c("TMM","TMMwsp","RLE","upperquartile")) \examples{ - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> scale_abundance() diff --git a/man/scale_design.Rd b/man/scale_design.Rd deleted file mode 100644 index e6014938..00000000 --- a/man/scale_design.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{scale_design} -\alias{scale_design} -\title{Scale design matrix} -\usage{ -scale_design(df, .formula) -} -\arguments{ -\item{df}{A tibble} - -\item{.formula}{a formula} -} -\value{ -A tibble -} -\description{ -Scale design matrix -} -\keyword{internal} diff --git a/man/select_closest_pairs.Rd b/man/select_closest_pairs.Rd deleted file mode 100644 index 1bd4a06f..00000000 --- a/man/select_closest_pairs.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utilities.R -\name{select_closest_pairs} -\alias{select_closest_pairs} -\title{Sub function of remove_redundancy_elements_though_reduced_dimensions} -\usage{ -select_closest_pairs(df) -} -\arguments{ -\item{df}{A tibble} -} -\value{ -A tibble with pairs to drop -} -\description{ -Sub function of remove_redundancy_elements_though_reduced_dimensions -} -\keyword{internal} diff --git a/man/symbol_to_entrez.Rd b/man/symbol_to_entrez.Rd index 1eeb1ca6..7a2304f7 100644 --- a/man/symbol_to_entrez.Rd +++ b/man/symbol_to_entrez.Rd @@ -21,6 +21,6 @@ Get ENTREZ id from gene SYMBOL } \examples{ -tidybulk::se_mini \%>\% tidybulk() \%>\% as_tibble() \%>\% symbol_to_entrez(.transcript = feature, .sample = sample) +tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez(.transcript = feature, .sample = sample) } diff --git a/man/test_differential_abundance-methods.Rd b/man/test_differential_abundance-methods.Rd index a65d8aee..d2be4bc1 100755 --- a/man/test_differential_abundance-methods.Rd +++ b/man/test_differential_abundance-methods.Rd @@ -211,14 +211,14 @@ DESeq2::results() # edgeR - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> test_differential_abundance( ~ condition ) # The function `test_differential_abundance` operates with contrasts too - tidybulk::se_mini \%>\% - identify_abundant() \%>\% + tidybulk::se_mini |> + identify_abundant() |> test_differential_abundance( ~ 0 + condition, .contrasts = c( "conditionTRUE - conditionFALSE") @@ -229,14 +229,14 @@ DESeq2::results() my_se_mini = tidybulk::se_mini my_se_mini$condition = factor(my_se_mini$condition) -my_se_mini \%>\% - identify_abundant() \%>\% +my_se_mini |> + identify_abundant() |> test_differential_abundance( ~ condition, method="deseq2" ) # The function `test_differential_abundance` operates with contrasts too - my_se_mini \%>\% - identify_abundant() \%>\% + my_se_mini |> + identify_abundant() |> test_differential_abundance( ~ 0 + condition, .contrasts = list(c("condition", "TRUE", "FALSE")), diff --git a/man/test_differential_cellularity-methods.Rd b/man/test_differential_cellularity-methods.Rd index 62129c39..9c55e048 100644 --- a/man/test_differential_cellularity-methods.Rd +++ b/man/test_differential_cellularity-methods.Rd @@ -156,16 +156,16 @@ deconvolve_cellularity( library(dplyr) library(tidyr) -tidybulk::se_mini \%>\% - tidybulk() \%>\% +tidybulk::se_mini |> + tidybulk() |> # Add survival data - nest(data = -sample) \%>\% + nest(data = -sample) |> mutate( days = c(1, 10, 500, 1000, 2000), dead = c(1, 1, 1, 0, 1) ) \%>\% - unnest(data) \%>\% + unnest(data) |> # Test test_differential_cellularity( diff --git a/man/test_differential_cellularity_.Rd b/man/test_differential_cellularity_.Rd deleted file mode 100644 index 7260a2d4..00000000 --- a/man/test_differential_cellularity_.Rd +++ /dev/null @@ -1,42 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{test_differential_cellularity_} -\alias{test_differential_cellularity_} -\title{Get differential composition information to a tibble using edgeR.} -\usage{ -test_differential_cellularity_( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - method = "cibersort", - reference = NULL, - significance_threshold = 0.05, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{reference}{A data frame. The transcript/cell_type data frame of integer transcript abundance} - -\item{significance_threshold}{A real between 0 and 1} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential composition information to a tibble using edgeR. -} -\keyword{internal} diff --git a/man/test_gene_enrichment-methods.Rd b/man/test_gene_enrichment-methods.Rd index 80bbacf2..b91308fa 100644 --- a/man/test_gene_enrichment-methods.Rd +++ b/man/test_gene_enrichment-methods.Rd @@ -178,7 +178,7 @@ dge %>% \examples{ \dontrun{ -df_entrez = tidybulk::se_mini \%>\% tidybulk() \%>\% as_tibble() \%>\% symbol_to_entrez( .transcript = feature, .sample = sample) +df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) library("EGSEA") diff --git a/man/test_gene_enrichment_bulk_EGSEA.Rd b/man/test_gene_enrichment_bulk_EGSEA.Rd deleted file mode 100644 index 9d9b6c01..00000000 --- a/man/test_gene_enrichment_bulk_EGSEA.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{test_gene_enrichment_bulk_EGSEA} -\alias{test_gene_enrichment_bulk_EGSEA} -\title{Get gene enrichment analyses using EGSEA} -\usage{ -test_gene_enrichment_bulk_EGSEA( - .data, - .formula, - .sample = NULL, - .entrez, - .abundance = NULL, - .contrasts = NULL, - methods, - gene_sets, - species, - cores = 10 -) -} -\arguments{ -\item{.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))} - -\item{.formula}{A formula with no response variable, representing the desired linear model} - -\item{.sample}{The name of the sample column} - -\item{.entrez}{The ENTREZ code of the transcripts/genes} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{.contrasts}{A character vector. See edgeR makeContrasts specification for the parameter `contrasts`. If contrasts are not present the first covariate is the one the model is tested against (e.g., ~ factor_of_interest)} - -\item{methods}{A character vector. One or 3 or more methods to use in the testing (currently EGSEA errors if 2 are used). Type EGSEA::egsea.base() to see the supported GSE methods.} - -\item{gene_sets}{A character vector or a list. It can take one or more of the following built-in collections as a character vector: c("h", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "kegg_disease", "kegg_metabolism", "kegg_signaling"), to be used with EGSEA buildIdx. c1 is human specific. Alternatively, a list of user-supplied gene sets can be provided, to be used with EGSEA buildCustomIdx. In that case, each gene set is a character vector of Entrez IDs and the names of the list are the gene set names.} - -\item{species}{A character. It can be human, mouse or rat.} - -\item{cores}{An integer. The number of cores available} -} -\value{ -A tibble with edgeR results -} -\description{ -Get gene enrichment analyses using EGSEA -} -\keyword{internal} diff --git a/man/test_gene_overrepresentation-methods.Rd b/man/test_gene_overrepresentation-methods.Rd index ef7fa46e..53baea57 100644 --- a/man/test_gene_overrepresentation-methods.Rd +++ b/man/test_gene_overrepresentation-methods.Rd @@ -122,7 +122,7 @@ Undelying method: } \examples{ -df_entrez = tidybulk::se_mini \%>\% tidybulk() \%>\% as_tibble() \%>\% symbol_to_entrez( .transcript = feature, .sample = sample) +df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) df_entrez = mutate(df_entrez, do_test = feature \%in\% c("TNFRSF4", "PLCH2", "PADI4", "PAX7")) diff --git a/man/test_gene_rank-methods.Rd b/man/test_gene_rank-methods.Rd index df3d02e8..a62bc521 100644 --- a/man/test_gene_rank-methods.Rd +++ b/man/test_gene_rank-methods.Rd @@ -132,7 +132,7 @@ mutate(fit = } \examples{ -df_entrez = tidybulk::se_mini \%>\% tidybulk() \%>\% as_tibble() \%>\% symbol_to_entrez( .transcript = feature, .sample = sample) +df_entrez = tidybulk::se_mini |> tidybulk() |> as_tibble() |> symbol_to_entrez( .transcript = feature, .sample = sample) df_entrez = aggregate_duplicates(df_entrez, aggregation_function = sum, .sample = sample, .transcript = entrez, .abundance = count) df_entrez = mutate(df_entrez, do_test = feature \%in\% c("TNFRSF4", "PLCH2", "PADI4", "PAX7")) df_entrez = df_entrez \%>\% test_differential_abundance(~ condition) diff --git a/man/test_stratification_cellularity-methods.Rd b/man/test_stratification_cellularity-methods.Rd index 8a2da82a..629b8d6e 100644 --- a/man/test_stratification_cellularity-methods.Rd +++ b/man/test_stratification_cellularity-methods.Rd @@ -129,16 +129,16 @@ deconvolve_cellularity( library(dplyr) library(tidyr) -tidybulk::se_mini \%>\% - tidybulk() \%>\% +tidybulk::se_mini |> + tidybulk() |> # Add survival data -nest(data = -sample) \%>\% +nest(data = -sample) |> mutate( days = c(1, 10, 500, 1000, 2000), dead = c(1, 1, 1, 0, 1) ) \%>\% -unnest(data) \%>\% +unnest(data) |> test_stratification_cellularity( survival::Surv(days, dead) ~ ., cores = 1 diff --git a/man/test_stratification_cellularity_.Rd b/man/test_stratification_cellularity_.Rd deleted file mode 100644 index 1dc0d76b..00000000 --- a/man/test_stratification_cellularity_.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{test_stratification_cellularity_} -\alias{test_stratification_cellularity_} -\title{Get differential composition information to a tibble using edgeR.} -\usage{ -test_stratification_cellularity_( - .data, - .formula, - .sample = NULL, - .transcript = NULL, - .abundance = NULL, - method = "cibersort", - reference = NULL, - ... -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.formula}{a formula with no response variable, referring only to numeric variables} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} - -\item{method}{A string character. Either "edgeR_quasi_likelihood" (i.e., QLF), "edgeR_likelihood_ratio" (i.e., LRT)} - -\item{reference}{A data frame. The transcript/cell_type data frame of integer transcript abundance} - -\item{significance_threshold}{A real between 0 and 1} -} -\value{ -A tibble with edgeR results -} -\description{ -Get differential composition information to a tibble using edgeR. -} -\keyword{internal} diff --git a/man/tidybulk-methods.Rd b/man/tidybulk-methods.Rd index 1d35ae50..1ef8cbce 100644 --- a/man/tidybulk-methods.Rd +++ b/man/tidybulk-methods.Rd @@ -54,9 +54,6 @@ arguments are stored as metadata. They can be extracted as attr(, "inter } \examples{ - - - my_tt = tidybulk(tidybulk::se_mini) diff --git a/man/tidybulk_to_SummarizedExperiment.Rd b/man/tidybulk_to_SummarizedExperiment.Rd deleted file mode 100644 index 65f3d95d..00000000 --- a/man/tidybulk_to_SummarizedExperiment.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/functions.R -\name{tidybulk_to_SummarizedExperiment} -\alias{tidybulk_to_SummarizedExperiment} -\title{tidybulk_to_SummarizedExperiment} -\usage{ -tidybulk_to_SummarizedExperiment( - .data, - .sample = NULL, - .transcript = NULL, - .abundance = NULL -) -} -\arguments{ -\item{.data}{A tibble} - -\item{.sample}{The name of the sample column} - -\item{.transcript}{The name of the transcript/gene column} - -\item{.abundance}{The name of the transcript/gene abundance column} -} -\value{ -A SummarizedExperiment -} -\description{ -tidybulk_to_SummarizedExperiment -} -\keyword{internal}