Closed xhNorthwestern closed 1 year ago
Hello @xhNorthwestern, I suspect that there is an overlap issue with the data used in the combination Giotto Object, testcombo
. For simplicity, I will refer to the two Giotto objects used to form the combined object as gobejct1
and gobject2
. To help you troubleshoot, could you please provide the results from the following:
get_cell_metadata(testcombo)[1:20]
get_feature_metadata(testcombo)[1:20]
get_cell_id(gobject1)[1:20]
get_feat_id(gobject1)[1:20]
get_cell_id(gobject2)[1:20]
get_feat_id(gobject2)[1:20]
Additionally, indicating the data which was used to create the Giotto objects will assist me in attempting to reproduce your error.
Hi @mattobny , the datasets which were used to create the Giotto objects were my personal spatial transcriptomic data. As individual dataset, they can be analyzed with Giotto suite package smoothly. But some errors happened when I tried to do integration analysis between two datasets.
Here are the results of your suggested running:
get_cell_metadata(testcombo)[1:20] Error in get_cell_metadata(testcombo) : could not find function "get_cell_metadata" get_feature_metadata(testcombo)[1:20] Error in get_feature_metadata(testcombo) : could not find function "get_feature_metadata" get_cell_id(MDS_sample)[1:20] Error in get_cell_id(MDS_sample) : could not find function "get_cell_id" get_feat_id(MDS_sample)[1:20] Error in get_feat_id(MDS_sample) : could not find function "get_feat_id"
It seems that there are no those four functions including "get_cell_metadata", "get_feature_metadata", "get_cell_id" and "get_feat_id". My Giotto suite version is 3.0.1. Something wrong?
Thanks a lot!
@xhNorthwestern I apologize, the functions I referenced above are internal functions; nothing is wrong with your installation. Instead, try to run these:
dim(pDataDT(testcombo))
dim(fDataDT(testcombo))
length(pDataDT(gobject1)$cell_ID)
length(fDataDT(gobject1)$feat_ID)
length(pDataDT(gobject2)$cell_ID)
length(fDataDT(gobject2)$feat_ID)
The above are the exported versions of the cell (pDataDT()
) and feature (fDataDT()
) metadata accessors. I'm glad to hear that the analysis of the datasets is running smoothly separately.
Hi @mattobny ,
Here are the results of your suggested running:
dim(pDataDT(testcombo)) [1] 9640 5 dim(fDataDT(testcombo)) [1] 19143 1 length(pDataDT(MDS_sample)$cell_ID) [1] 4969 length(fDataDT(MDS_sample)$feat_ID) [1] 18820 length(pDataDT(YoungControl_sample)$cell_ID) [1] 4671 length(fDataDT(YoungControl_sample)$feat_ID) [1] 18730
Thanks a lot!
@xhNorthwestern it would appear that testcombo
has been created properly and successfully using joinGiottoObjects()
. Are the spatial unit and feature type pairs the same for MDS_sample
and YoungControl_sample
? When plotting a combined object in this way, the expression data is subset under the hood and is plotted separately. If spatial units or feature types differ, the code used to subset the object may be accessing the incorrect expression information, resulting in the dimensionality disagreement.
Alternatively, there could be an issue with list_ID
, but this is harder to troubleshoot without your data.
Can you please show the results from the following:
dim(get_expression_values(testcombo)[])
get_expression_values(testcombo)@spat_unit
get_expression_values(testcombo)@feat_type
dim(get_expression_values(MDS_sample)[])
dim(get_expression_values(YoungControl_sample)[])
unique(pDataDT(testcombo)[["list_ID"]])
Hi @mattobny ,
Here are the results of your suggested running:
dim(get_expression_values(testcombo)[]) NULL
get_expression_values(testcombo)@spat_unit [1] "cell" get_expression_values(testcombo)@feat_type [1] "rna" dim(get_expression_values(MDS_sample)[]) [1] 18820 4969 dim(get_expression_values(YoungControl_sample)[]) [1] 18730 4671 unique(pDataDT(testcombo)[["list_ID"]]) [1] "MDS" "Control"
Thanks a lot!
@xhNorthwestern that is strange. Because dim(get_expression_values(testcombo)[])
returned NULL, it would appear that the combined Giotto Object testcombo
contains no expression information. This could be why the error occurred: under the hood, Giotto is attempting to subset the expression information, which seemingly does not exist.
Can you provide the code you ran to combine MDS_sample
and YoungControl_sample
into testcombo
as well as the results from the following:
length(dimnames(get_expression_values(testcombo)[])[[1]])
length(dimnames(get_expression_values(testcombo)[])[[2]])
Hi @mattobny ,
Here is the code:
MDS_sample = createGiottoVisiumObject( visium_dir = paste0(dataDir, '/BM21-780'), expr_data = 'raw', png_name = 'tissue_lowres_image.png', gene_column_index = 2, instructions = instrs)
YoungControl_sample = createGiottoVisiumObject( visium_dir = paste0(dataDir, '/NMB21-141C1'), expr_data = 'raw', png_name = 'tissue_lowres_image.png', gene_column_index = 2, instructions = instrs)
testcombo = joinGiottoObjects(gobject_list = list(MDS_sample, YoungControl_sample), gobject_names = c('MDS', 'Control'), join_method = 'shift', x_padding = 1000)
testcombo@join_info
And here are the results of your suggested running:
length(dimnames(get_expression_values(testcombo)[])[[1]]) [1] 0 length(dimnames(get_expression_values(testcombo)[])[[2]]) [1] 0
Thanks a lot!
@xhNorthwestern Unfortunately I have been unable to replicate your error after several attempts. What version of Giotto are you currently running (i.e. please run sessionInfo()
), and were these Giotto objects all created using the same version of the package?
Hi @mattobny ,
Here is the result of running sessionInfo():
R version 4.2.2 (2022-10-31) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.1
Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] Giotto_3.0.1
loaded via a namespace (and not attached):
[1] fansi_1.0.3 assertthat_0.2.1 dplyr_1.0.10 utf8_1.2.2 grid_4.2.2 R6_2.5.1 DBI_1.1.3 lifecycle_1.0.3 gtable_0.3.1 magrittr_2.0.3
[11] scales_1.2.1 pillar_1.8.1 ggplot2_3.4.0 rlang_1.0.6 cli_3.5.0 data.table_1.14.6 rstudioapi_0.14 generics_0.1.3 vctrs_0.5.1 tools_4.2.2
[21] glue_1.6.2 munsell_0.5.0 compiler_4.2.2 pkgconfig_2.0.3 colorspace_2.0-3 tidyselect_1.2.0 tibble_3.1.8
Yes, I think so. And all these Giotto objects were created with the Giotto_3.0.1.
Thanks a lot!
@xhNorthwestern The best course of action I can recommend at this time is to try updating the package (i.e., reinstalling via devtools::install_github("drieslab/Giotto@suite")
), reloading the update package, and remaking each of these three Giotto objects. joinGiottoObjects()
should create a Giotto Object with expression data, even for features that are included in only one of the two Giotto objects used to create it. If issues are still presenting themselves after updating, we can continue to troubleshoot. Please let me know how this develops.
Hi @mattobny, I just reinstalled the package, and everything is OK. No error occurred. Thanks a lot!
@xhNorthwestern I'm glad to hear that! Please don't hesitate to let us know if anything else arises.
Hi, I used Giotto Suite to do visium integration analysis between two spatial datasets, and I encountered an error as followed:
When I ran the code:
spatPlot2D(gobject = testcombo, cell_color = 'in_tissue',
An error appeared:
Error in S4_expr@exprMat[filter_bool_feats, filter_bool_cells] : incorrect number of dimensions
I do not know what happened. And I really appreciate it if you could give me some suggestions.
Thanks a lot!