Closed cgoneill closed 4 months ago
I attempted this again but ran the subsetting on the SingleCellExperiment
object as follows:
senders_oi <- "Keratinocyte" # origin of signaling changes
receivers_oi <- unique(colData(unwounded_combined_sce)[, celltype_id])[-6]
# remove uninteresting cell type
unwounded_combined_sce <- unwounded_combined_sce[
,
colData(unwounded_combined_sce)[, celltype_id] %in%
c(senders_oi, receivers_oi)
]
for (i in 1:ncol(colData(unwounded_combined_sce))) {
if (is.factor(colData(unwounded_combined_sce)[, i])) {
colData(unwounded_combined_sce)[, i] <- droplevels(
colData(unwounded_combined_sce)[, i]
)
}
}
All other code was run as written above, and the error message and output from rlang::last_trace(drop = FALSE)
were the same.
I ran the multifactorial breast cancer vignette as written except for subsetting senders_oi
and receivers_oi
and subsetting the SingleCellExperiment
object accordingly:
senders_oi <- "CD4T"
receivers_oi <- unique(SummarizedExperiment::colData(sce)[, celltype_id])[-3]
sce <- sce[, colData(sce)[, celltype_id] %in% c(senders_oi, receivers_oi)]
When running this in a different interactive session on the same system, I did not encounter this error message. Below is the session information for that session:
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.7 (Green Obsidian)
Matrix products: default
BLAS/LAPACK: /usr/local/intel/2022.1.2.146/mkl/2022.0.2/lib/intel64/libmkl_rt.so.2; LAPACK version 3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/New_York
tzcode source: system (glibc)
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_1.3.1 stringr_1.5.1 magrittr_2.0.3 RColorBrewer_1.1-3 multinichenetr_1.0.3
[6] ggplot2_3.5.0 dplyr_1.1.4 SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0 Biobase_2.62.0
[11] GenomicRanges_1.54.1 GenomeInfoDb_1.38.8 IRanges_2.36.0 S4Vectors_0.40.2 BiocGenerics_0.48.1
[16] MatrixGenerics_1.14.0 matrixStats_1.2.0
loaded via a namespace (and not attached):
[1] progress_1.2.3 nnet_7.3-19 locfdr_1.1-8 goftest_1.2-3 Biostrings_2.70.3
[6] TH.data_1.1-2 vctrs_0.6.5 spatstat.random_3.2-3 proxy_0.4-27 digest_0.6.35
[11] png_0.1-8 corpcor_1.6.10 shape_1.4.6.1 ggrepel_0.9.5 deldir_2.0-4
[16] parallelly_1.37.1 MASS_7.3-60 reshape2_1.4.4 foreach_1.5.2 httpuv_1.6.14
[21] qvalue_2.34.0 withr_3.0.0 xfun_0.42 ggfun_0.1.4 ggpubr_0.6.0
[26] ellipsis_0.3.2 survival_3.5-7 memoise_2.0.1 ggbeeswarm_0.7.2 clusterProfiler_4.10.0
[31] emmeans_1.10.0 gson_0.1.0 tidytree_0.4.6 zoo_1.8-12 GlobalOptions_0.1.2
[36] gtools_3.9.5 pbapply_1.7-2 Formula_1.2-5 prettyunits_1.2.0 KEGGREST_1.42.0
[41] promises_1.2.1 httr_1.4.7 rstatix_0.7.2 globals_0.16.3 fitdistrplus_1.1-11
[46] rstudioapi_0.15.0 miniUI_0.1.1.1 generics_0.1.3 DOSE_3.28.2 base64enc_0.1-3
[51] zlibbioc_1.48.2 ScaledMatrix_1.10.0 ggraph_2.1.0 randomForest_4.7-1.1 polyclip_1.10-6
[56] GenomeInfoDbData_1.2.11 SparseArray_1.2.4 xtable_1.8-4 doParallel_1.0.17 evaluate_0.23
[61] S4Arrays_1.2.1 hms_1.1.3 irlba_2.3.5.1 visNetwork_2.1.2 colorspace_2.1-0
[66] ROCR_1.0-11 reticulate_1.35.0 spatstat.data_3.0-4 readr_2.1.5 lmtest_0.9-40
[71] later_1.3.2 viridis_0.6.5 ggtree_3.10.1 lattice_0.22-5 genefilter_1.84.0
[76] spatstat.geom_3.2-9 future.apply_1.11.1 XML_3.99-0.16.1 scattermore_1.2 scuttle_1.12.0
[81] shadowtext_0.1.3 cowplot_1.1.3 RcppAnnoy_0.0.22 Hmisc_5.1-2 class_7.3-22
[86] pillar_1.9.0 nlme_3.1-164 iterators_1.0.14 caTools_1.18.2 compiler_4.3.2
[91] beachmat_2.18.1 RSpectra_0.16-1 stringi_1.8.3 gower_1.0.1 lubridate_1.9.3
[96] tensor_1.5 minqa_1.2.6 plyr_1.8.9 crayon_1.5.2 abind_1.4-5
[101] scater_1.30.1 blme_1.0-5 gridGraphics_0.5-1 locfit_1.5-9.9 sp_2.1-3
[106] graphlayouts_1.1.1 bit_4.0.5 UpSetR_1.4.0 sandwich_3.1-0 fastmatch_1.1-4
[111] codetools_0.2-19 multcomp_1.4-25 recipes_1.0.10 BiocSingular_1.18.0 e1071_1.7-14
[116] GetoptLong_1.0.5 plotly_4.10.4 remaCor_0.0.18 mime_0.12 splines_4.3.2
[121] circlize_0.4.16 Rcpp_1.0.12 fastDummies_1.7.3 sparseMatrixStats_1.14.0 HDO.db_0.99.1
[126] knitr_1.45 blob_1.2.4 utf8_1.2.4 clue_0.3-65 lme4_1.1-35.1
[131] fs_1.6.3 checkmate_2.3.1 listenv_0.9.1 DelayedMatrixStats_1.24.0 Rdpack_2.6
[136] ggsignif_0.6.4 ggplotify_0.1.2 estimability_1.5 tibble_3.2.1 Matrix_1.6-5
[141] statmod_1.5.0 tzdb_0.4.0 fANCOVA_0.6-1 tweenr_2.0.3 pkgconfig_2.0.3
[146] tools_4.3.2 cachem_1.0.8 RhpcBLASctl_0.23-42 rbibutils_2.2.16 RSQLite_2.3.5
[151] viridisLite_0.4.2 DBI_1.2.2 numDeriv_2016.8-1.1 rmarkdown_2.26 fastmap_1.1.1
[156] scales_1.3.0 grid_4.3.2 ica_1.0-3 Seurat_5.0.1 nichenetr_2.0.5
[161] broom_1.0.5 patchwork_1.2.0 coda_0.19-4.1 dotCall64_1.1-1 carData_3.0-5
[166] rpart_4.1.23 RANN_2.6.1 farver_2.1.1 aod_1.3.3 tidygraph_1.3.0
[171] scatterpie_0.2.1 mgcv_1.9-1 foreign_0.8-86 DiagrammeR_1.0.11 cli_3.6.2
[176] purrr_1.0.2 leiden_0.4.3.1 lifecycle_1.0.4 caret_6.0-94 uwot_0.1.16
[181] glmmTMB_1.1.9 mvtnorm_1.2-4 bluster_1.12.0 lava_1.8.0 backports_1.4.1
[186] annotate_1.80.0 BiocParallel_1.36.0 timechange_0.3.0 gtable_0.3.4 rjson_0.2.21
[191] ggridges_0.5.6 progressr_0.14.0 pROC_1.18.5 parallel_4.3.2 ape_5.7-1
[196] limma_3.58.1 jsonlite_1.8.8 edgeR_4.0.16 RcppHNSW_0.6.0 bitops_1.0-7
[201] bit64_4.0.5 Rtsne_0.17 yulab.utils_0.1.4 spatstat.utils_3.0-4 BiocNeighbors_1.20.2
[206] SeuratObject_5.0.1 muscat_1.16.0 metapod_1.10.1 dqrng_0.3.2 GOSemSim_2.28.1
[211] timeDate_4032.109 pbkrtest_0.5.2 lazyeval_0.2.2 shiny_1.8.0 htmltools_0.5.7
[216] enrichplot_1.22.0 GO.db_3.18.0 sctransform_0.4.1 factoextra_1.0.7 glue_1.7.0
[221] spam_2.10-0 XVector_0.42.0 RCurl_1.98-1.14 treeio_1.26.0 scran_1.30.2
[226] gridExtra_2.3 EnvStats_2.8.1 boot_1.3-28.1 igraph_1.6.0 variancePartition_1.32.5
[231] TMB_1.9.10 R6_2.5.1 sva_3.50.0 fdrtool_1.2.17 DESeq2_1.42.1
[236] gplots_3.1.3.1 cluster_2.1.6 ipred_0.9-14 aplot_0.2.2 nloptr_2.0.3
[241] DelayedArray_0.28.0 tidyselect_1.2.1 vipor_0.4.7 htmlTable_2.4.2 ggforce_0.4.2
[246] car_3.1-2 AnnotationDbi_1.64.1 future_1.33.1 ModelMetrics_1.2.2.2 rsvd_1.0.5
[251] munsell_0.5.0 KernSmooth_2.23-22 data.table_1.15.0 htmlwidgets_1.6.4 fgsea_1.28.0
[256] ComplexHeatmap_2.18.0 rlang_1.1.3 spatstat.sparse_3.0-3 spatstat.explore_3.2-7 lmerTest_3.1-3
[261] ggnewscale_0.4.10 fansi_1.0.6 hardhat_1.3.1 prodlim_2023.08.28 beeswarm_0.4.0
I went through the pipeline without the wrapper and localized the problem to generate_prioritization_tables()
.
abundance_expression_info <- get_abundance_expression_info(
sce = unwounded_combined_sce,
sample_id = sample_id,
group_id = group_id,
celltype_id = celltype_id,
min_cells = min_cells,
senders_oi = senders_oi,
receivers_oi = receivers_oi,
lr_network = lr_network,
batches = batches
)
abundance_expression_info$abund_plot_sample +
NoLegend() +
theme(axis.text.x = element_text(angle = 0, hjust = 0.5)) +
theme(text = element_text(family = "Arial"))
DE_info <- get_DE_info(
sce = unwounded_combined_sce,
sample_id = sample_id,
group_id = group_id,
celltype_id = celltype_id,
batches = batches,
covariates = covariates,
contrasts_oi = contrasts_oi,
min_cells = min_cells
)
celltype_de <- DE_info$celltype_de$de_output_tidy
sender_receiver_de <- combine_sender_receiver_de(
sender_de = celltype_de,
receiver_de = celltype_de,
senders_oi = senders_oi,
receivers_oi = receivers_oi,
lr_network = lr_network
)
ligand_activities_targets_DEgenes <- get_ligand_activities_targets_DEgenes(
receiver_de = celltype_de,
receivers_oi = receivers_oi,
ligand_target_matrix = ligand_target_matrix,
logFC_threshold = logFC_threshold,
p_val_threshold = p_val_threshold,
p_val_adj = p_val_adj,
top_n_target = top_n_target,
verbose = TRUE,
n.cores = n.cores
)
sender_receiver_tbl <- dplyr::distinct(sender_receiver_de, sender, receiver)
metadata_combined <- as_tibble(colData(unwounded_combined_sce))
grouping_tbl <- metadata_combined[, c(sample_id, group_id)] %>%
as_tibble() %>%
dplyr::distinct()
colnames(grouping_tbl) <- c("sample", "group")
prioritization_tables <- generate_prioritization_tables(
sender_receiver_info = abundance_expression_info$sender_receiver_info,
sender_receiver_de = sender_receiver_de,
ligand_activities_targets_DEgenes = ligand_activities_targets_DEgenes,
contrast_tbl = contrast_tbl,
sender_receiver_tbl = sender_receiver_tbl,
grouping_tbl = grouping_tbl,
prioritizing_weights = prioritizing_weights,
fraction_cutoff = fraction_cutoff,
abundance_data_receiver = abundance_expression_info$abundance_data_receiver,
abundance_data_sender = abundance_expression_info$abundance_data_sender
)
Error in `dplyr::inner_join()`:
! Can't convert `out[merge]$target` <logical> to match type of `target` <character>.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/vctrs_error_cast>
Error in `dplyr::inner_join()`:
! Can't convert `out[merge]$target` <logical> to match type of `target` <character>.
---
Backtrace:
▆
1. ├─multinichenetr::generate_prioritization_tables(...)
2. │ └─... %>% dplyr::distinct()
3. ├─dplyr::distinct(.)
4. ├─dplyr::select(...)
5. ├─dplyr::inner_join(...)
6. └─dplyr:::inner_join.data.frame(...)
Run rlang::last_trace(drop = FALSE) to see 12 hidden frames.
I think I found the problem. At the step in generate_prioritization_tables()
that reads:
ligand_activities_target_de_tbl = dplyr::inner_join(
ligand_activities_targets_DEgenes$ligand_activities,
ligand_activities_targets_DEgenes$de_genes_df %>%
dplyr::rename(target = gene, p_val_adj = p_adj)
) %>%
dplyr::select(
contrast,
receiver,
ligand,
activity,
activity_scaled,
target,
ligand_target_weight,
logFC,
p_val,
p_val_adj,
direction_regulation
) %>%
dplyr::distinct()
ligand_activities_targets_DEgenes$de_genes_df
has no entries - it's listed as a tibble with 0 rows and 6 columns. I set p_val_adj = FALSE
in get_ligand_activities_targets_DEgenes()
, as it had previously been set to TRUE
, and that gave me some significant changes in signaling to work with - this also worked when running the wrapper function. I'll close the issue, as it appears to just be a shortcoming of my dataset.
This appears to be the same issue as #40; I'm opening a new issue, as that one is closed.
I'm following the steps laid out in the multifactorial breast cancer vignette but using my own data; none of the default parameters specified in the vignette were changed except for omitting one cell type from analysis entirely and setting one specific cell type as the sole sender. When I get to using the wrapper
multi_nichenet_analysis()
, I encounter an error message that appears to be indplyr::inner_join()
.The last call returns the following output and error message:
Session info is as follows: