Hi there,
When I checked the parameters of create.RCTD, I came across the class_df parameter. Its help message reads:

Based on this, I assumed I could upload my custom cell type-class mapping data frame (structured as shown below) to aggregate scores from sub-cell types to the class level:

I then ran the following code and successfully generated an RCTD object:
RCTD <- create.RCTD(query, reference,
max_cores = ncores,
UMI_min = UMI_min,
UMI_min_sigma = UMI_min,
CELL_MIN_INSTANCE=20,
class_df=class_df,
MAX_MULTI_TYPES=1,
test_mode = FALSE)
# RCTD <- create.RCTD(query, reference, max_cores = ncores, UMI_min = UMI_min,UMI_min_sigma = UMI_min,CELL_MIN_INSTANCE=20)
RCTD <- run.RCTD(RCTD, doublet_mode = "doublet")
However, I cannot find the class-level scores (aggregated scores for the higher-level classes) in the resulting RCTD object. I’ve inspected key result slots (e.g., RCTD@results) but haven’t located the aggregated class-level data.

To summarize, I’d like to ask two questions:
Where are the class-level scores stored in the RCTD object after passing class_df?
What is the best practice for aggregating sub-cell type scores to the class level (e.g., summing weights of sub-cell types belonging to the same class for each spot)?
Thank you for your help!
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.4.0 (2024-04-24)
os Ubuntu 22.04.2 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate zh_CN.utf8
ctype zh_CN.utf8
tz Asia/Aden
date 2025-12-19
pandoc NA
quarto NA
─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
abind 1.4-8 2024-09-12 [4] CRAN (R 4.4.0)
arrow * 21.0.0 2025-07-24 [4] CRAN (R 4.4.0)
assertthat 0.2.1 2019-03-21 [4] CRAN (R 4.3.1)
bit 4.6.0 2025-03-06 [4] CRAN (R 4.4.0)
bit64 4.6.0-1 2025-01-16 [2] CRAN (R 4.4.0)
cli 3.6.5 2025-04-23 [2] CRAN (R 4.4.0)
cluster 2.1.8.1 2025-03-12 [4] CRAN (R 4.4.0)
codetools 0.2-20 2024-03-31 [4] CRAN (R 4.4.0)
cowplot 1.2.0 2025-07-07 [2] CRAN (R 4.4.0)
crayon 1.5.3 2024-06-20 [4] CRAN (R 4.4.0)
data.table 1.17.8 2025-07-10 [2] CRAN (R 4.4.0)
deldir 2.0-4 2024-02-28 [4] CRAN (R 4.4.0)
dichromat 2.0-0.1 2022-05-02 [4] CRAN (R 4.3.1)
digest 0.6.37 2024-08-19 [4] CRAN (R 4.4.0)
doParallel 1.0.17 2022-02-07 [4] CRAN (R 4.3.1)
dotCall64 1.2 2024-10-04 [4] CRAN (R 4.4.0)
dplyr * 1.1.4 2023-11-17 [4] CRAN (R 4.4.0)
farver 2.1.2 2024-05-13 [4] CRAN (R 4.4.0)
fastDummies 1.7.5 2025-01-20 [2] CRAN (R 4.4.0)
fastmap 1.2.0 2024-05-15 [4] CRAN (R 4.4.0)
fitdistrplus 1.2-4 2025-07-03 [2] CRAN (R 4.4.0)
foreach 1.5.2 2022-02-02 [4] CRAN (R 4.3.1)
future 1.67.0 2025-07-29 [2] CRAN (R 4.4.0)
future.apply 1.20.0 2025-06-06 [2] CRAN (R 4.4.0)
generics 0.1.4 2025-05-09 [2] CRAN (R 4.4.0)
getopt 1.20.4 2023-10-01 [4] CRAN (R 4.4.0)
ggplot2 * 4.0.0 2025-09-11 [2] CRAN (R 4.4.0)
ggrepel 0.9.6 2024-09-07 [4] CRAN (R 4.4.0)
ggridges 0.5.6 2024-01-23 [4] CRAN (R 4.4.0)
globals 0.18.0 2025-05-08 [2] CRAN (R 4.4.0)
glue * 1.8.0 2024-09-30 [4] CRAN (R 4.4.0)
goftest 1.2-3 2021-10-07 [4] CRAN (R 4.3.1)
gridExtra 2.3 2017-09-09 [4] CRAN (R 4.3.1)
gtable 0.3.6 2024-10-25 [4] CRAN (R 4.4.0)
htmltools 0.5.8.1 2024-04-04 [4] CRAN (R 4.4.0)
htmlwidgets 1.6.4 2023-12-06 [4] CRAN (R 4.4.0)
httpuv 1.6.16 2025-04-16 [4] CRAN (R 4.4.0)
httr 1.4.7 2023-08-15 [4] CRAN (R 4.4.0)
ica 1.0-3 2022-07-08 [4] CRAN (R 4.3.1)
igraph 2.1.4 2025-01-23 [2] CRAN (R 4.4.0)
irlba 2.3.5.1 2022-10-03 [4] CRAN (R 4.4.0)
iterators 1.0.14 2022-02-05 [4] CRAN (R 4.3.1)
jsonlite 2.0.0 2025-03-27 [2] CRAN (R 4.4.0)
KernSmooth 2.23-26 2025-01-01 [4] CRAN (R 4.4.0)
labeling 0.4.3 2023-08-29 [4] CRAN (R 4.4.0)
later 1.4.4 2025-08-27 [2] CRAN (R 4.4.0)
lattice 0.22-7 2025-04-02 [4] CRAN (R 4.4.0)
lazyeval 0.2.2 2019-03-15 [4] CRAN (R 4.3.1)
lifecycle 1.0.4 2023-11-07 [4] CRAN (R 4.4.0)
listenv 0.10.0 2025-11-02 [4] CRAN (R 4.4.0)
lmtest 0.9-40 2022-03-21 [4] CRAN (R 4.3.1)
magrittr 2.0.4 2025-09-12 [4] CRAN (R 4.4.0)
MASS 7.3-65 2025-02-28 [4] CRAN (R 4.4.0)
Matrix 1.7-3 2025-03-11 [4] CRAN (R 4.4.0)
matrixStats 1.5.0 2025-01-07 [2] CRAN (R 4.4.0)
mime 0.13 2025-03-17 [2] CRAN (R 4.4.0)
miniUI 0.1.2 2025-04-17 [4] CRAN (R 4.4.0)
nlme 3.1-168 2025-03-31 [4] CRAN (R 4.4.0)
optparse * 1.7.5 2024-04-16 [4] CRAN (R 4.4.0)
otel 0.2.0 2025-08-29 [2] CRAN (R 4.4.0)
parallelly 1.45.1 2025-07-24 [2] CRAN (R 4.4.0)
patchwork * 1.3.2 2025-08-25 [2] CRAN (R 4.4.0)
pbapply 1.7-4 2025-07-20 [2] CRAN (R 4.4.0)
pillar 1.11.1 2025-09-17 [2] CRAN (R 4.4.0)
pkgconfig 2.0.3 2019-09-22 [4] CRAN (R 4.3.1)
plotly 4.11.0 2025-06-19 [2] CRAN (R 4.4.0)
plyr 1.8.9 2023-10-02 [4] CRAN (R 4.4.0)
png 0.1-8 2022-11-29 [4] CRAN (R 4.3.1)
polyclip 1.10-7 2024-07-23 [4] CRAN (R 4.4.0)
progressr 0.18.0 2025-11-06 [4] CRAN (R 4.4.0)
promises 1.5.0 2025-11-01 [2] CRAN (R 4.4.0)
purrr 1.2.0 2025-11-04 [2] CRAN (R 4.4.0)
quadprog 1.5-8 2019-11-20 [4] CRAN (R 4.4.0)
R6 2.6.1 2025-02-15 [2] CRAN (R 4.4.0)
ragg 1.5.0 2025-09-02 [4] CRAN (R 4.4.0)
RANN 2.6.2 2024-08-25 [4] CRAN (R 4.4.0)
rappdirs 0.3.3 2021-01-31 [4] CRAN (R 4.3.1)
RColorBrewer 1.1-3 2022-04-03 [4] CRAN (R 4.3.1)
Rcpp 1.1.0 2025-07-02 [2] CRAN (R 4.4.0)
RcppAnnoy 0.0.22 2024-01-23 [4] CRAN (R 4.4.0)
RcppHNSW 0.6.0 2024-02-04 [4] CRAN (R 4.4.0)
reshape2 * 1.4.4 2020-04-09 [4] CRAN (R 4.3.1)
reticulate 1.43.0 2025-07-21 [2] CRAN (R 4.4.0)
rlang 1.1.6 2025-04-11 [2] CRAN (R 4.4.0)
ROCR 1.0-11 2020-05-02 [4] CRAN (R 4.3.1)
RSpectra 0.16-2 2024-07-18 [4] CRAN (R 4.4.0)
Rtsne 0.17 2023-12-07 [4] CRAN (R 4.4.0)
S7 0.2.0 2024-11-07 [2] CRAN (R 4.4.0)
scales * 1.4.0 2025-04-24 [2] CRAN (R 4.4.0)
scattermore 1.2 2023-06-12 [4] CRAN (R 4.3.1)
sctransform 0.4.2 2025-04-30 [2] CRAN (R 4.4.0)
sessioninfo 1.2.3 2025-02-05 [4] CRAN (R 4.4.0)
Seurat * 5.3.0 2025-11-11 [2] local
SeuratData * 0.2.2.9001 2024-07-23 [4] Github (satijalab/seurat-data@4dc08e0)
SeuratObject * 5.1.0 2025-04-22 [4] CRAN (R 4.4.0)
shiny 1.11.1 2025-07-03 [2] CRAN (R 4.4.0)
sp * 2.2-0 2025-02-01 [2] CRAN (R 4.4.0)
spacexr * 2.2.1 2024-06-17 [4] local
spam 2.11-1 2025-01-20 [2] CRAN (R 4.4.0)
spatstat.data 3.1-6 2025-03-17 [2] CRAN (R 4.4.0)
spatstat.explore 3.5-2 2025-07-22 [2] CRAN (R 4.4.0)
spatstat.geom 3.5-0 2025-07-20 [2] CRAN (R 4.4.0)
spatstat.random 3.4-2 2025-09-21 [2] CRAN (R 4.4.0)
spatstat.sparse 3.1-0 2024-06-21 [4] CRAN (R 4.4.0)
spatstat.univar 3.1-4 2025-07-13 [2] CRAN (R 4.4.0)
spatstat.utils 3.2-0 2025-09-20 [2] CRAN (R 4.4.0)
stringi 1.8.7 2025-03-27 [2] CRAN (R 4.4.0)
stringr * 1.5.1 2023-11-14 [4] CRAN (R 4.4.0)
survival 3.8-3 2024-12-17 [4] CRAN (R 4.4.0)
systemfonts 1.3.1 2025-10-01 [2] CRAN (R 4.4.0)
tensor 1.5.1 2025-06-17 [2] CRAN (R 4.4.0)
textshaping 1.0.4 2025-10-10 [2] CRAN (R 4.4.0)
tibble 3.3.0 2025-06-08 [2] CRAN (R 4.4.0)
tidyr * 1.3.1 2024-01-24 [4] CRAN (R 4.4.0)
tidyselect 1.2.1 2024-03-11 [4] CRAN (R 4.4.0)
uwot 0.2.4 2025-11-10 [2] CRAN (R 4.4.0)
vctrs 0.6.5 2023-12-01 [4] CRAN (R 4.4.0)
viridisLite 0.4.2 2023-05-02 [4] CRAN (R 4.3.1)
withr 3.0.2 2024-10-28 [4] CRAN (R 4.4.0)
xtable 1.8-4 2019-04-21 [4] CRAN (R 4.3.1)
zoo 1.8-14 2025-04-10 [2] CRAN (R 4.4.0)
Hi there,


When I checked the parameters of create.RCTD, I came across the class_df parameter. Its help message reads:
Based on this, I assumed I could upload my custom cell type-class mapping data frame (structured as shown below) to aggregate scores from sub-cell types to the class level:
I then ran the following code and successfully generated an RCTD object:
However, I cannot find the class-level scores (aggregated scores for the higher-level classes) in the resulting RCTD object. I’ve inspected key result slots (e.g., RCTD@results) but haven’t located the aggregated class-level data.

To summarize, I’d like to ask two questions:
Where are the class-level scores stored in the RCTD object after passing class_df?
What is the best practice for aggregating sub-cell type scores to the class level (e.g., summing weights of sub-cell types belonging to the same class for each spot)?
Thank you for your help!
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.4.0 (2024-04-24)
os Ubuntu 22.04.2 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate zh_CN.utf8
ctype zh_CN.utf8
tz Asia/Aden
date 2025-12-19
pandoc NA
quarto NA
─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
abind 1.4-8 2024-09-12 [4] CRAN (R 4.4.0)
arrow * 21.0.0 2025-07-24 [4] CRAN (R 4.4.0)
assertthat 0.2.1 2019-03-21 [4] CRAN (R 4.3.1)
bit 4.6.0 2025-03-06 [4] CRAN (R 4.4.0)
bit64 4.6.0-1 2025-01-16 [2] CRAN (R 4.4.0)
cli 3.6.5 2025-04-23 [2] CRAN (R 4.4.0)
cluster 2.1.8.1 2025-03-12 [4] CRAN (R 4.4.0)
codetools 0.2-20 2024-03-31 [4] CRAN (R 4.4.0)
cowplot 1.2.0 2025-07-07 [2] CRAN (R 4.4.0)
crayon 1.5.3 2024-06-20 [4] CRAN (R 4.4.0)
data.table 1.17.8 2025-07-10 [2] CRAN (R 4.4.0)
deldir 2.0-4 2024-02-28 [4] CRAN (R 4.4.0)
dichromat 2.0-0.1 2022-05-02 [4] CRAN (R 4.3.1)
digest 0.6.37 2024-08-19 [4] CRAN (R 4.4.0)
doParallel 1.0.17 2022-02-07 [4] CRAN (R 4.3.1)
dotCall64 1.2 2024-10-04 [4] CRAN (R 4.4.0)
dplyr * 1.1.4 2023-11-17 [4] CRAN (R 4.4.0)
farver 2.1.2 2024-05-13 [4] CRAN (R 4.4.0)
fastDummies 1.7.5 2025-01-20 [2] CRAN (R 4.4.0)
fastmap 1.2.0 2024-05-15 [4] CRAN (R 4.4.0)
fitdistrplus 1.2-4 2025-07-03 [2] CRAN (R 4.4.0)
foreach 1.5.2 2022-02-02 [4] CRAN (R 4.3.1)
future 1.67.0 2025-07-29 [2] CRAN (R 4.4.0)
future.apply 1.20.0 2025-06-06 [2] CRAN (R 4.4.0)
generics 0.1.4 2025-05-09 [2] CRAN (R 4.4.0)
getopt 1.20.4 2023-10-01 [4] CRAN (R 4.4.0)
ggplot2 * 4.0.0 2025-09-11 [2] CRAN (R 4.4.0)
ggrepel 0.9.6 2024-09-07 [4] CRAN (R 4.4.0)
ggridges 0.5.6 2024-01-23 [4] CRAN (R 4.4.0)
globals 0.18.0 2025-05-08 [2] CRAN (R 4.4.0)
glue * 1.8.0 2024-09-30 [4] CRAN (R 4.4.0)
goftest 1.2-3 2021-10-07 [4] CRAN (R 4.3.1)
gridExtra 2.3 2017-09-09 [4] CRAN (R 4.3.1)
gtable 0.3.6 2024-10-25 [4] CRAN (R 4.4.0)
htmltools 0.5.8.1 2024-04-04 [4] CRAN (R 4.4.0)
htmlwidgets 1.6.4 2023-12-06 [4] CRAN (R 4.4.0)
httpuv 1.6.16 2025-04-16 [4] CRAN (R 4.4.0)
httr 1.4.7 2023-08-15 [4] CRAN (R 4.4.0)
ica 1.0-3 2022-07-08 [4] CRAN (R 4.3.1)
igraph 2.1.4 2025-01-23 [2] CRAN (R 4.4.0)
irlba 2.3.5.1 2022-10-03 [4] CRAN (R 4.4.0)
iterators 1.0.14 2022-02-05 [4] CRAN (R 4.3.1)
jsonlite 2.0.0 2025-03-27 [2] CRAN (R 4.4.0)
KernSmooth 2.23-26 2025-01-01 [4] CRAN (R 4.4.0)
labeling 0.4.3 2023-08-29 [4] CRAN (R 4.4.0)
later 1.4.4 2025-08-27 [2] CRAN (R 4.4.0)
lattice 0.22-7 2025-04-02 [4] CRAN (R 4.4.0)
lazyeval 0.2.2 2019-03-15 [4] CRAN (R 4.3.1)
lifecycle 1.0.4 2023-11-07 [4] CRAN (R 4.4.0)
listenv 0.10.0 2025-11-02 [4] CRAN (R 4.4.0)
lmtest 0.9-40 2022-03-21 [4] CRAN (R 4.3.1)
magrittr 2.0.4 2025-09-12 [4] CRAN (R 4.4.0)
MASS 7.3-65 2025-02-28 [4] CRAN (R 4.4.0)
Matrix 1.7-3 2025-03-11 [4] CRAN (R 4.4.0)
matrixStats 1.5.0 2025-01-07 [2] CRAN (R 4.4.0)
mime 0.13 2025-03-17 [2] CRAN (R 4.4.0)
miniUI 0.1.2 2025-04-17 [4] CRAN (R 4.4.0)
nlme 3.1-168 2025-03-31 [4] CRAN (R 4.4.0)
optparse * 1.7.5 2024-04-16 [4] CRAN (R 4.4.0)
otel 0.2.0 2025-08-29 [2] CRAN (R 4.4.0)
parallelly 1.45.1 2025-07-24 [2] CRAN (R 4.4.0)
patchwork * 1.3.2 2025-08-25 [2] CRAN (R 4.4.0)
pbapply 1.7-4 2025-07-20 [2] CRAN (R 4.4.0)
pillar 1.11.1 2025-09-17 [2] CRAN (R 4.4.0)
pkgconfig 2.0.3 2019-09-22 [4] CRAN (R 4.3.1)
plotly 4.11.0 2025-06-19 [2] CRAN (R 4.4.0)
plyr 1.8.9 2023-10-02 [4] CRAN (R 4.4.0)
png 0.1-8 2022-11-29 [4] CRAN (R 4.3.1)
polyclip 1.10-7 2024-07-23 [4] CRAN (R 4.4.0)
progressr 0.18.0 2025-11-06 [4] CRAN (R 4.4.0)
promises 1.5.0 2025-11-01 [2] CRAN (R 4.4.0)
purrr 1.2.0 2025-11-04 [2] CRAN (R 4.4.0)
quadprog 1.5-8 2019-11-20 [4] CRAN (R 4.4.0)
R6 2.6.1 2025-02-15 [2] CRAN (R 4.4.0)
ragg 1.5.0 2025-09-02 [4] CRAN (R 4.4.0)
RANN 2.6.2 2024-08-25 [4] CRAN (R 4.4.0)
rappdirs 0.3.3 2021-01-31 [4] CRAN (R 4.3.1)
RColorBrewer 1.1-3 2022-04-03 [4] CRAN (R 4.3.1)
Rcpp 1.1.0 2025-07-02 [2] CRAN (R 4.4.0)
RcppAnnoy 0.0.22 2024-01-23 [4] CRAN (R 4.4.0)
RcppHNSW 0.6.0 2024-02-04 [4] CRAN (R 4.4.0)
reshape2 * 1.4.4 2020-04-09 [4] CRAN (R 4.3.1)
reticulate 1.43.0 2025-07-21 [2] CRAN (R 4.4.0)
rlang 1.1.6 2025-04-11 [2] CRAN (R 4.4.0)
ROCR 1.0-11 2020-05-02 [4] CRAN (R 4.3.1)
RSpectra 0.16-2 2024-07-18 [4] CRAN (R 4.4.0)
Rtsne 0.17 2023-12-07 [4] CRAN (R 4.4.0)
S7 0.2.0 2024-11-07 [2] CRAN (R 4.4.0)
scales * 1.4.0 2025-04-24 [2] CRAN (R 4.4.0)
scattermore 1.2 2023-06-12 [4] CRAN (R 4.3.1)
sctransform 0.4.2 2025-04-30 [2] CRAN (R 4.4.0)
sessioninfo 1.2.3 2025-02-05 [4] CRAN (R 4.4.0)
Seurat * 5.3.0 2025-11-11 [2] local
SeuratData * 0.2.2.9001 2024-07-23 [4] Github (satijalab/seurat-data@4dc08e0)
SeuratObject * 5.1.0 2025-04-22 [4] CRAN (R 4.4.0)
shiny 1.11.1 2025-07-03 [2] CRAN (R 4.4.0)
sp * 2.2-0 2025-02-01 [2] CRAN (R 4.4.0)
spacexr * 2.2.1 2024-06-17 [4] local
spam 2.11-1 2025-01-20 [2] CRAN (R 4.4.0)
spatstat.data 3.1-6 2025-03-17 [2] CRAN (R 4.4.0)
spatstat.explore 3.5-2 2025-07-22 [2] CRAN (R 4.4.0)
spatstat.geom 3.5-0 2025-07-20 [2] CRAN (R 4.4.0)
spatstat.random 3.4-2 2025-09-21 [2] CRAN (R 4.4.0)
spatstat.sparse 3.1-0 2024-06-21 [4] CRAN (R 4.4.0)
spatstat.univar 3.1-4 2025-07-13 [2] CRAN (R 4.4.0)
spatstat.utils 3.2-0 2025-09-20 [2] CRAN (R 4.4.0)
stringi 1.8.7 2025-03-27 [2] CRAN (R 4.4.0)
stringr * 1.5.1 2023-11-14 [4] CRAN (R 4.4.0)
survival 3.8-3 2024-12-17 [4] CRAN (R 4.4.0)
systemfonts 1.3.1 2025-10-01 [2] CRAN (R 4.4.0)
tensor 1.5.1 2025-06-17 [2] CRAN (R 4.4.0)
textshaping 1.0.4 2025-10-10 [2] CRAN (R 4.4.0)
tibble 3.3.0 2025-06-08 [2] CRAN (R 4.4.0)
tidyr * 1.3.1 2024-01-24 [4] CRAN (R 4.4.0)
tidyselect 1.2.1 2024-03-11 [4] CRAN (R 4.4.0)
uwot 0.2.4 2025-11-10 [2] CRAN (R 4.4.0)
vctrs 0.6.5 2023-12-01 [4] CRAN (R 4.4.0)
viridisLite 0.4.2 2023-05-02 [4] CRAN (R 4.3.1)
withr 3.0.2 2024-10-28 [4] CRAN (R 4.4.0)
xtable 1.8-4 2019-04-21 [4] CRAN (R 4.3.1)
zoo 1.8-14 2025-04-10 [2] CRAN (R 4.4.0)