Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issues in data_process function in R_utils.R #8

Closed
bsungwoo opened this issue Jul 18, 2021 · 3 comments
Closed

Potential issues in data_process function in R_utils.R #8

bsungwoo opened this issue Jul 18, 2021 · 3 comments

Comments

@bsungwoo
Copy link

Hello,

Thank you for providing a nice tool for decomposing cellular composition in spatial transcriptomic data. I was trying to utilize DSTG for my Visium spatial transcriptomics dataset and ran into an error.

The error occurred when I was running the below command in the Ubuntu terminal with R version 4.0.3.

Rscript convert_data.R scRNAseq_data.RDS spatial_data.RDS scRNAseq_label.RDS

I created a count matrix of single-cell data for scRNAseq_data.RDS (dim: total number of genes * total number of cells), a count matrix for spatial data for spatial_data.RDS (dim: total number of genes * total number of spatial spots) and a cell type label for each cell barcode (dim: total number of cells * 1) for scRNAseq_label.RDS.

The error message told me that in line 110 in R_utils.R, "st_labels" is not defined.

label.list2 <- do.call("rbind", rep(list(st_labels[[1]]), round(N2/N1)+1))[1:N2]

I presumed that since "st_labels" is defined in the next line (111), fixing st_labels[[1]] to st_label[[1]] may resolve the issue. Or is there any problem with my input for the convert_data.R?

Could you kindly check-up with the data_process function in R_utils.R?

Thanks a lot for creating the nice tool!

@bsungwoo
Copy link
Author

bsungwoo commented Jul 18, 2021

When I changed "st_labels" to "st_label" in line 110 of R_utils.R, another error message appeared in the same line.

run real data...
[1] "Generating synthetic test spots..."
|======================================================================| 100%
[1] "Generation of 1000 test spots took 0.21 mins"
[1] "output consists of a list with two dataframes, this first one has the weighted count matrix and the second has the metadata for each spot"
Error in [.data.frame(do.call("rbind", rep(list(st_label[[1]]), round(N2/N1) + :
undefined columns selected
Calls: Convert_Data -> data_process -> [ -> [.data.frame
Execution halted

My guess is that line 110 in R_utils.R may be changed from 1 to 2?
(Changed st_labels[[1]] to st_label[[1]] and [1:N2] to [1:N2,])

  1. label.list2 <- do.call("rbind", rep(list(st_labels[[1]]), round(N2/N1)+1))[1:N2]
  2. label.list2 <- do.call("rbind", rep(list(st_label[[1]]), round(N2/N1)+1))[1:N2,]

Thanks!

@bsungwoo
Copy link
Author

bsungwoo commented Jul 19, 2021

When I changed the line 110 in R_utils.R as above, I crossed with another error.

[1] "Generation of 1000 test spots took 0.2 mins"
[1] "output consists of a list with two dataframes, this first one has the weighted count matrix and the second has the metadata for each spot"
Error in label.list[[i]] : subscript out of bounds
Calls: Convert_Data ... eval.parent -> eval -> eval -> write.table -> is.data.frame
Execution halted

Is it possibly related to "label.list[[i]]" in line 149 in R_utils.R? I presumed that since "label.list" contains the single-cell annotation data and its length is 1, label.list[[i]] needs to be changed to st.label[[i]] defined in line 126 (From 1 to 2 below).

  1. write.csv(label.list[[i]],file=paste0(inforDir,'/ST_label/ST_label_',i,'.csv'),quote=F)
  2. write.csv(st.label[[i]],file=paste0(inforDir,'/ST_label/ST_label_',i,'.csv'),quote=F)

It seems that all the issues are resolved by changing line 110 and 149 as above.
Could you check on with the issues?

Thank you!

@QSong-github
Copy link
Collaborator

When I changed "st_labels" to "st_label" in line 110 of R_utils.R, another error message appeared in the same line.

run real data...
[1] "Generating synthetic test spots..."
|======================================================================| 100%
[1] "Generation of 1000 test spots took 0.21 mins"
[1] "output consists of a list with two dataframes, this first one has the weighted count matrix and the second has the metadata for each spot"
Error in [.data.frame(do.call("rbind", rep(list(st_label[[1]]), round(N2/N1) + :
undefined columns selected
Calls: Convert_Data -> data_process -> [ -> [.data.frame
Execution halted

My guess is that line 110 in R_utils.R may be changed from 1 to 2?
(Changed st_labels[[1]] to st_label[[1]] and [1:N2] to [1:N2,])

  1. label.list2 <- do.call("rbind", rep(list(st_labels[[1]]), round(N2/N1)+1))[1:N2]
  2. label.list2 <- do.call("rbind", rep(list(st_label[[1]]), round(N2/N1)+1))[1:N2,]

Thanks!

It should be correct if changing "st_labels" to "st_label" in line 110 of R_utils.R. I will verify and modify it. However, I am not sure about the other errors that you mentioned. I will check on my side or can you share me your toy data that I can check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants