R/sig_genes_extract_all.R
sig_genes_extract_all.Rd
This function combines the output of sig_genes_extract()
from all the
layer-level (group-level) modeling results and builds the data required for
functions such as layer_boxplot()
.
sig_genes_extract_all(
n = 10,
modeling_results = fetch_data(type = "modeling_results"),
sce_layer = fetch_data(type = "sce_layer")
)
The number of the top ranked genes to extract.
Defaults to the output of
fetch_data(type = 'modeling_results')
. This is a list of tables with the
columns f_stat_*
or t_stat_*
as well as p_value_*
and fdr_*
plus
ensembl
. The column name is used to extract the statistic results, the
p-values, and the FDR adjusted p-values. Then the ensembl
column is used
for matching in some cases. See fetch_data()
for more details. Typically
this is the set of reference statistics used in layer_stat_cor()
.
Defaults to the output of
fetch_data(type = 'sce_layer')
. This is a
SingleCellExperiment
object with the spot-level Visium data compressed via pseudo-bulking to the
layer-level (group-level) resolution. See fetch_data()
for more details.
A DataFrame-class with the extracted statistics in long format. The specific columns are described further in the vignette.
Other Layer modeling functions:
layer_boxplot()
,
sig_genes_extract()
## Obtain the necessary data
if (!exists("modeling_results")) {
modeling_results <- fetch_data(type = "modeling_results")
}
#> 2024-12-13 19:42:20.719143 loading file /github/home/.cache/R/BiocFileCache/5c656d46b9_Human_DLPFC_Visium_modeling_results.Rdata%3Fdl%3D1
if (!exists("sce_layer")) sce_layer <- fetch_data(type = "sce_layer")
#> 2024-12-13 19:42:21.836976 loading file /github/home/.cache/R/BiocFileCache/5c643a903ea_Human_DLPFC_Visium_processedData_sce_scran_sce_layer_spatialLIBD.Rdata%3Fdl%3D1
## top 10 genes for all models
sig_genes_extract_all(
modeling_results = modeling_results,
sce_layer = sce_layer
)
#> DataFrame with 510 rows and 12 columns
#> top model_type test gene stat pval
#> <integer> <character> <character> <character> <numeric> <numeric>
#> 1 1 enrichment WM NDRG1 16.3053 1.25896e-26
#> 2 2 enrichment WM PTP4A2 16.1469 2.25133e-26
#> 3 3 enrichment WM AQP1 15.9927 3.97849e-26
#> 4 4 enrichment WM PAQR6 15.1971 7.86258e-25
#> 5 5 enrichment WM ANP32B 14.9798 1.80183e-24
#> ... ... ... ... ... ... ...
#> 506 6 anova noWM HOPX 157.180 3.16423e-33
#> 507 7 anova noWM CLSTN2 148.428 1.55814e-32
#> 508 8 anova noWM TUBA1B 135.620 1.89089e-31
#> 509 9 anova noWM HS3ST2 135.387 1.98244e-31
#> 510 10 anova noWM ETV1 130.017 6.03393e-31
#> fdr gene_index ensembl in_rows in_rows_top20
#> <numeric> <integer> <character> <IntegerList> <IntegerList>
#> 1 2.51372e-22 10404 ENSG00000104419 1,110,113,... 1,110,113,...
#> 2 2.51372e-22 487 ENSG00000184007 2,126 2,126
#> 3 2.96145e-22 8201 ENSG00000240583 3,104,112,... 3,104,112,...
#> 4 4.38948e-21 1501 ENSG00000160781 4,130 4,130
#> 5 8.04735e-21 10962 ENSG00000136938 5,123 5,123
#> ... ... ... ... ... ...
#> 506 1.17767e-29 5291 ENSG00000171476 234,248,256,...
#> 507 4.97068e-29 4638 ENSG00000158258 390,415,424,...
#> 508 4.91887e-28 13893 ENSG00000123416 360,362,373,...
#> 509 4.91887e-28 16964 ENSG00000122254 375,386,413,...
#> 510 1.34744e-27 8095 ENSG00000006468 446,464,510
#> results
#> <CharacterList>
#> 1 WM_top1,WM-Layer4_top10,WM-Layer5_top3,...
#> 2 WM_top2,WM-Layer6_top6
#> 3 WM_top3,WM-Layer4_top4,WM-Layer5_top2,...
#> 4 WM_top4,WM-Layer6_top10
#> 5 WM_top5,WM-Layer6_top3
#> ... ...
#> 506 Layer3-Layer5_top4,Layer3-Layer6_top8,Layer4-Layer5_top6,...
#> 507 Layer6-Layer1_top10,Layer5-Layer2_top5,Layer6-Layer2_top4,...
#> 508 Layer3-Layer1_top10,Layer4-Layer1_top2,Layer5-Layer1_top3,...
#> 509 Layer5-Layer1_top5,Layer6-Layer1_top6,Layer5-Layer2_top3,...
#> 510 Layer5-Layer3_top6,Layer5-Layer4_top4,noWM_top10