Select Genes Based on Statistical Thresholds from an anglemania_object
Source:R/anglemanise_utils.R
select_genes.Rd
Selects genes from an anglemania_object-class
based on specified
thresholds for the absolute mean z-score and signal-to-noise ratio
(SNR) z-score. It updates the integration_genes
slot of the
anglemania_object
with the selected genes and associated
information.
Arguments
- angl
An
anglemania_object
containing statistical matrices such as mean z-scores and SNR z-scores.- zscore_mean_threshold
Numeric value specifying the threshold for the absolute mean z-score. Default is 2.
- zscore_sn_threshold
Numeric value specifying the threshold for the SNR z-score. Default is 2.
- max_n_genes
Integer specifying the maximum number of genes to select. If
NULL
, all genes that pass the thresholds are used. Default isNULL
.
Value
The input anglemania_object
with the
integration_genes
slot updated to include the selected genes and
their statistical information.
Details
The function performs the following steps:
Checks if the input object is of class
anglemania_object-class
.If
max_n_genes
is not specified, it uses all genes that pass the thresholds.Identifies gene pairs where both the mean z-score and SNR z-score exceed the specified thresholds.
If no gene pairs meet the criteria, it adjusts the thresholds to the 99th percentile values of the corresponding statistics and re-selects.
Extracts unique genes from the selected gene pairs using
extract_rows_for_unique_genes
.Updates the
integration_genes
slot of theanglemania_object
with the selected genes and their statistics.
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
#>
| | 0 % elapsed=00s
|==================================================| 100% elapsed=00s, remaining~00s
angl <- anglemania(angl)
#> 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...
angl <- select_genes(angl,
zscore_mean_threshold = 2.5,
zscore_sn_threshold = 2.5,
max_n_genes = 2000)
anglemania_genes <- get_anglemania_genes(angl)
# View the selected genes and use for integration