Skip to contents

anglemania computes critical angles between genes across all samples provided in an anglemania_object-class. It calculates angles, transforms them to z-scores, computes statistical measures, and selects genes based on specified thresholds.

Usage

anglemania(
  angl,
  method = "pearson",
  zscore_mean_threshold = 2.5,
  zscore_sn_threshold = 2.5,
  max_n_genes = 2000
)

Arguments

angl

An anglemania_object-class containing gene expression data and associated metadata.

method

Character string specifying the method to use for calculating the relationship between gene pairs. Default is "pearson". Other options include "diem" (see https://bytez.com/docs/arxiv/2407.08623/paper).

zscore_mean_threshold

Numeric value specifying the threshold for the mean z-score. Default is 2.5.

zscore_sn_threshold

Numeric value specifying the threshold for the signal-to-noise z-score. Default is 2.5.

max_n_genes

Integer specifying the maximum number of genes to select. Default is 2000.

Value

An updated anglemania_object-class with computed statistics and selected genes based on the specified thresholds.

Details

This function performs the following steps:

  1. Computes angles between genes for each sample in the angl using the specified method, via factorise.

  2. Transforms the angles to z-scores.

  3. Computes statistical measures (mean z-score, signal-to-noise ratio) across samples using get_list_stats.

  4. Selects genes based on specified z-score thresholds using select_genes.

The computed statistics and selected genes are added to the angl, which is returned.

Examples

se <- SeuratObject::pbmc_small
angl <- create_anglemania_object(se, batch_key = "groups")
#> No dataset_key specified.
#> Assuming that all samples belong to the same dataset and are separated by batch_key: groups
#> Extracting count matrices...
#> Filtering each batch to at least 1 cells per gene...
#> Using the intersection of filtered genes from all batches...
#> Number of genes in intersected set: 228
angl <- anglemania(
  angl,
  method = "pearson",
  zscore_mean_threshold = 2,
  zscore_sn_threshold = 2,
  max_n_genes = 2000
)
#> Computing angles and transforming to z-scores...
#> 
  |                                                  | 0 % elapsed=00s   
  |=========================                         | 50% elapsed=00s, remaining~00s
  |==================================================| 100% elapsed=00s, remaining~00s
#> Computing statistics...
#> Weighting matrix_list...
#> Calculating mean...
#> Calculating sds...
#> Filtering features...

# Access the selected genes
selected_genes <- get_anglemania_genes(angl)
selected_genes[1:10]
#>  [1] "GNG11"     "CLU"       "SDPR"      "PF4"       "GP9"       "SPARC"    
#>  [7] "PPBP"      "HIST1H2AC" "CD9"       "NRGN"