data2intelligence / SpaCET

Spatial Cellular Estimator for Tumors
GNU General Public License v3.0
42 stars 4 forks source link

Error in cor(x, y, use = use, method = method) #7

Open zhangqiannn opened 1 year ago

zhangqiannn commented 1 year ago

hi, first, i wanna thank you for developing this package. It is wonderful in cancer research. i try to use function SpaCET_obj1 <- SpaCET.deconvolution(SpaCET_obj1, cancerType="CESC", coreNo=8) in my data the error is as following:

Error in cor(x, y, use = use, method = method) : 
  long vectors not supported yet: cov.c:722
Calls: SpaCET.deconvolution -> inferMal_cor -> corMat -> <Anonymous> -> cor

i have two sample with different size, the smaller can run normally, the larger not. i'd like to know why and how to solve this problem? Best, Qian

beibeiru commented 1 year ago

Hi, Qian,

Would you please deposit your larger sample (which reports errors) in the following folder? I will figure out the bug. Thanks.

Best, Beibei

zhangqiannn commented 1 year ago

Hi, Beibei, Thank you for your reply. I've uploaded the data in the folder.

Best, Qian

On Feb 21, 2023, at 22:40, Beibei Ru @.***> wrote:

Hi, Qian,

Would you please deposit your larger sample (which reports errors) in the following folder? I will figure out the bug. Thanks.

https://connecthkuhk-my.sharepoint.com/:f:/g/personal/bbru_connect_hku_hk/EpzSwS9WfOZDrELV9aIeO1UBLUu6PibkUG16Ffvx_dxL4g?e=Z8y4wm

Best, Beibei

— Reply to this email directly, view it on GitHub https://github.com/data2intelligence/SpaCET/issues/7#issuecomment-1438602633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTS4WVB2KMFJFRNMFWQYEDWYTHULANCNFSM6AAAAAAVCXFRW4. You are receiving this because you authored the thread.

zhangqiannn commented 1 year ago

Hi, Beibei, I’m surprisingly find this software works so well in my other small samples just now. I truly want to apply it in larger samples. Did the data upload successfully? Looking forward to your reply. Best, Qian

On Feb 27, 2023, at 10:08, 张倩 @.***> wrote:

Hi, Beibei, Thank you for your reply. I've uploaded the data in the folder.

Best, Qian

On Feb 21, 2023, at 22:40, Beibei Ru @.***> wrote:

Hi, Qian,

Would you please deposit your larger sample (which reports errors) in the following folder? I will figure out the bug. Thanks.

https://connecthkuhk-my.sharepoint.com/:f:/g/personal/bbru_connect_hku_hk/EpzSwS9WfOZDrELV9aIeO1UBLUu6PibkUG16Ffvx_dxL4g?e=Z8y4wm

Best, Beibei

— Reply to this email directly, view it on GitHub https://github.com/data2intelligence/SpaCET/issues/7#issuecomment-1438602633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTS4WVB2KMFJFRNMFWQYEDWYTHULANCNFSM6AAAAAAVCXFRW4. You are receiving this because you authored the thread.

beibeiru commented 1 year ago

Hi, Qian,

Thank you for uploading your data and I can access them right now. I am wondering whether your larger sample is ONE visium dataset? Because I observe 58,432 spots in the larger sample.

Best, Beibei

zhangqiannn commented 1 year ago

Hi, Beibei, The sequencing platform used for this sample is Stereo-seq. The data is derived from a single sample, rather than a mix of samples. Best, Qian

On Feb 28, 2023, at 00:05, Beibei Ru @.***> wrote:

Hi, Qian,

Thank you for uploading your data and I can access them right now. I am wondering whether your larger sample is ONE visium dataset? Because I observe 58,432 spots in the larger sample.

Best, Beibei

— Reply to this email directly, view it on GitHub https://github.com/data2intelligence/SpaCET/issues/7#issuecomment-1446601222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTS4WSI2Z3VWKE2GYCSMA3WZTGEDANCNFSM6AAAAAAVCXFRW4. You are receiving this because you authored the thread.

beibeiru commented 1 year ago

Sure. Thank you for the clarification. I will let you know once I fix it. Thanks.

Best, Beibei

beibeiru commented 1 year ago

Hi, Qian,

I notice that the spot size of Stereo-seq is 0.22 um. In your dataset, you got 58,432 bins finally. Just wondering what the size of a bin is. Do you mind telling me how you transform the Stereo-seq data from spot-level to bin-level? Thanks.

Best, Beibei

zhangqiannn commented 1 year ago

Hi, Beibei, Standard DNB chips have spots with approximately 220 nm diameter and a center-to-center distance of 500 or 715 nm. Here, we used the distance of center to center is 500 nm. The capture spots were grouped into bins to include sufficient genes per bin. The bin size we selected is bin 50 (50 × 50 spots, i.e., 24.72 × 24.72 μm).This article provides a detailed introduction to the principles of Stereo-Seq. Title: Spatiotemporal transcriptomic atlas of mouse organogenesis using DNA nanoball-patterned arrays. Original link: https://www.cell.com/cell/fulltext/S0092-8674(22)00399-3?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0092867422003993%3Fshowall%3Dtrue Best, Qian

On Mar 1, 2023, at 10:16, Beibei Ru @.***> wrote:

Hi, Qian,

I notice that the spot size of Stereo-seq is 0.22 um. In your dataset, you got 58,432 bins finally. Just wondering what the size of a bin is. Do you mind telling me how you transform the Stereo-seq data from spot-level to bin-level? Thanks.

Best, Beibei

— Reply to this email directly, view it on GitHub https://github.com/data2intelligence/SpaCET/issues/7#issuecomment-1449219004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTS4WQQOLR55M2RHU7GVKDWZ2WOZANCNFSM6AAAAAAVCXFRW4. You are receiving this because you authored the thread.

beibeiru commented 1 year ago

Hi, Qian,

I have updated SpaCET to process a larger ST dataset (e.g., >50,000 spots or bins). Please reinstall SpaCET and try the following code. I also deposited the results that I got in the following link.

# reinstall SpaCET
remove.packages("SpaCET")
devtools::install_github("data2intelligence/SpaCET")
library(SpaCET)

# load data
SpaCET_obj <- readRDS("SpaCET_raw.rds")

# modify the input data
SpaCET_obj@input$image$path <- NA
SpaCET_obj@input$image$grob <- NA
SpaCET_obj@input$platform <- "Stereo-seq"

# save fig1 for EPCAM expression
pdf("fig1.pdf",  width = 7.5, height = 7)
SpaCET.visualize.spatialFeature(
  SpaCET_obj, 
  spatialType = "GeneExpression", 
  spatialFeatures=c("EPCAM"),
  pointSize = 0.01, 
  nrow=1
)
dev.off()

SpaCET_obj <- SpaCET.quality.control(SpaCET_obj)

# save fig2 for QC
pdf("fig2.pdf",  width = 15, height = 7)
SpaCET.visualize.spatialFeature(
  SpaCET_obj, 
  spatialType = "QualityControl", 
  spatialFeatures=c("UMI","Gene"),
  pointSize = 0.01, 
  nrow=1
)
dev.off()

# run deconvolution
SpaCET_obj <- SpaCET.deconvolution(SpaCET_obj, cancerType="CESC", coreNo=8)

# save fig3 for cell type fraction
pdf("fig3.pdf",  width = 50, height = 35)
SpaCET.visualize.spatialFeature(
  SpaCET_obj, 
  spatialType = "CellFraction", 
  spatialFeatures=c("All"), 
  pointSize = 0.01, 
  nrow=5
)
dev.off()

# save new data
saveRDS(SpaCET_obj, file = "SpaCET_new.rds")

Please let me know if you have any further questions.

Best, Beibei

zhangqiannn commented 1 year ago

Hi, Beibei,

First of all, thank you very much for your efforts for my larger sample. I have reinstalled SpaCET and started testing it. 

Best, Qian

On Mar 6, 2023, at 11:56, Beibei Ru @.***> wrote:

Hi, Qian,

I have updated SpaCET to process a larger ST dataset (e.g., >50,000 spots or bins). Please reinstall SpaCET and try the following code. I also deposited the results that I got in the following link. https://connecthkuhk-my.sharepoint.com/:f:/g/personal/bbru_connect_hku_hk/EpzSwS9WfOZDrELV9aIeO1UBLUu6PibkUG16Ffvx_dxL4g?e=BOMpjO

reinstall SpaCET

remove.packages("SpaCET") devtools::install_github("data2intelligence/SpaCET") library(SpaCET)

load data

SpaCET_obj <- readRDS("SpaCET_raw.rds")

modify the input data

@.$image$path <- NA @.$image$grob <- NA @.***$platform <- "Stereo-seq"

save fig1 for EPCAM expression

pdf("fig1.pdf", width = 7.5, height = 7) SpaCET.visualize.spatialFeature( SpaCET_obj, spatialType = "GeneExpression", spatialFeatures=c("EPCAM"), pointSize = 0.01, nrow=1 ) dev.off()

SpaCET_obj <- SpaCET.quality.control(SpaCET_obj)

save fig2 for QC

pdf("fig2.pdf", width = 15, height = 7) SpaCET.visualize.spatialFeature( SpaCET_obj, spatialType = "QualityControl", spatialFeatures=c("UMI","Gene"), pointSize = 0.01, nrow=1 ) dev.off()

run deconvolution

SpaCET_obj <- SpaCET.deconvolution(SpaCET_obj, cancerType="CESC", coreNo=10)

save fig3 for cell type fraction

pdf("fig3.pdf", width = 50, height = 35) SpaCET.visualize.spatialFeature( SpaCET_obj, spatialType = "CellFraction", spatialFeatures=c("All"), pointSize = 0.01, nrow=5 ) dev.off()

save new data

saveRDS(SpaCET_obj, file = "SpaCET_new.rds") Please let me know if you have any further questions.

Best, Beibei

— Reply to this email directly, view it on GitHub https://github.com/data2intelligence/SpaCET/issues/7#issuecomment-1455400879, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTS4WRRKBP3MTFU44XALKLW2VOAJANCNFSM6AAAAAAVCXFRW4. You are receiving this because you authored the thread.