R/anglemania.R
anglemania.Rd
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.
anglemania(
angl,
method = "cosine",
zscore_mean_threshold = 2.5,
zscore_sn_threshold = 2.5,
max_n_genes = 2000
)
An anglemania_object-class
containing gene
expression data and associated metadata.
Character string specifying the method to use for calculating
the relationship between gene pairs. Default is "cosine"
.
Other options include "diem"
(see https://bytez.com/docs/arxiv/2407.08623/paper).
Numeric value specifying the threshold
for the mean z-score. Default is 2.5
.
Numeric value specifying the threshold for the
signal-to-noise z-score. Default is 2.5
.
Integer specifying the maximum number of genes to select.
Default is 2000
.
An updated anglemania_object-class
with computed statistics and
selected genes based on the specified thresholds.
This function performs the following steps:
Computes angles between genes for each sample in the
angl
using the specified method
, via
factorise
.
Transforms the angles to z-scores.
Computes statistical measures (mean z-score, signal-to-noise ratio)
across samples using get_list_stats
.
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.
# Set seed for reproducibility (optional)
sce <- sce_example()
angl <- create_anglemania_object(sce, batch_key = "batch")
#> No dataset_key specified.
#> Assuming that all samples belong to the same dataset and are separated by batch_key: batch
#> 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: 300
angl <- anglemania(
angl,
method = "cosine",
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=01s, remaining~00s
#> Computing statistics...
#> Weighting matrix_list...
#> Calculating mean...
#> Calculating sds...
#> Filtering features...
#> [1] "Selected 214 genes for integration."
# Access the selected genes
selected_genes <- get_anglemania_genes(angl)
selected_genes[1:10]
#> [1] "gene43" "gene207" "gene119" "gene130" "gene69" "gene184" "gene25"
#> [8] "gene209" "gene53" "gene113"