reduce_dimensions: Dimension reduction of the transcript abundance data

reduce_dimensionsR Documentation

Dimension reduction of the transcript abundance data

Description

reduce_dimensions() takes as imput a 'tbl' formatted as | <SAMPLE> | <TRANSCRIPT> | <COUNT> | <...> | and calculates the reduced dimensional space of the transcript abundance.

Usage

reduce_dimensions(.data, method, .dims = 10, action = "add")

Arguments

.data

A 'tbl' formatted as | <SAMPLE> | <TRANSCRIPT> | <COUNT> | <...> |

method

A character string. The dimension reduction algorithm to use (PCA, MDS, tSNE).

.dims

A list of integer vectors corresponding to principal .dims of interest (e.g., list(1:2, 3:4, 5:6))

action

A character string. Whether to join the new information to the input tbl (add), or just get the non-redundant tbl with the new information (get).

.element

The name of the element column (normally samples).

.feature

The name of the feature column (normally transcripts/genes)

.value

The name of the column including the numerical value the clustering is based on (normally transcript abundance)

top

An integer. How many top genes to select for dimensionality reduction

of_samples

A boolean. In case the input is a tidysc object, it indicates Whether the element column will be sample or transcript column

log_transform

A boolean, whether the value should be log-transformed (e.g., TRUE for RNA sequencing data)

scale

A boolean for method="PCA", this will be passed to the 'prcomp' function. It is not included in the ... argument because although the default for 'prcomp' if FALSE, it is advisable to set it as TRUE.

...

Further parameters passed to the function prcomp if you choose method="PCA" or Rtsne if you choose method="tSNE"

Details

\lifecycle

experimental

This function reduces the dimensions of the transcript abundances. It can use multi-dimensional scaling (MDS) of principal component analysis (PCA).

Value

A tbl object with additional columns for the reduced dimensions

Examples




library(GGally)

counts.MDS =
    counts %>%
    reduce_dimensions(sample, transcript, count, method="MDS", .dims = 3)

counts.MDS %>%
    select(contains("Dim"), sample, `Cell type`) %>%
    distinct() %>%
    GGally::ggpairs(columns = 1:3, ggplot2::aes(colour=`Cell type`))

counts.PCA =
    counts.norm %>%
    reduce_dimensions(sample, transcript, count, method="PCA", .dims = 3)

counts.PCA %>%
   select(contains("PC"), sample, `Cell type`) %>%
   distinct() %>%
   GGally::ggpairs(columns = 1:3, ggplot2::aes(colour=`Cell type`))




stemangiola/ttSc documentation built on Dec. 8, 2022, 2:37 a.m.