Coder Social home page Coder Social logo

Comments (4)

lfranzen avatar lfranzen commented on August 24, 2024

Hi! Not sure I recognise the error entirely, however it looks a bit like the file paths might be the issue? Could you double check to make sure the paths in your infoTable is pointing to your data files correctly?

from scwat-st.

dm8000 avatar dm8000 commented on August 24, 2024

Thank you for the reply @lfranzen

the infotable is as original. I imagined it could be a path problem as I did not edit anything, but I assumed it was working fine as the Sample meta data block loaded the table without problems


```{r create_infotable}
sample_select_ids <- metadata_selected[, "novaseq_id"]
data_proc <- "trimmed"
sample_dirs_all <- c()
sample_names_all <- c()
for (s in sample_select_ids){
  message("Fetching data path for sample ", s)
  sample_dirs <- grep(pattern = s, x = list.dirs(path = file.path(DIR_DATA), recursive = F, full.names = T), value = T)
  sample_dirs <- grep(pattern = data_proc, x = sample_dirs, value = T)
  sample_dirs_all <- c(sample_dirs_all, sample_dirs)
  
  sample_names <- grep(pattern = s, x = list.dirs(path = file.path(DIR_DATA), recursive = F, full.names = F), value = T)
  sample_names <- grep(pattern = data_proc, x = sample_names, value = T)
  sample_names_all <- c(sample_names_all, sample_names)
}

data_dirs <- paste0(sample_dirs_all, "/filtered_feature_bc_matrix.h5")
spot_dirs <- paste0(sample_dirs_all, "/spatial/tissue_positions_list.csv")
img_dirs <- paste0(sample_dirs_all, "/spatial/tissue_hires_image.png")
img_scale_dirs <- paste0(sample_dirs_all, "/spatial/scalefactors_json.json")

infoTable <- data.frame(samples = data_dirs,
                        spotfiles = spot_dirs,
                        imgs = img_dirs,
                        json = img_scale_dirs,
                        metadata_selected, 
                        stringsAsFactors = F)

I downloaded the data and put it in the data folder, but maybe I did not structured it correctly?
Here is what the data folder looks like

~/Documents/visiumadipocyte/scwat-st/data/visium$ ls
S41_trimmed  S46_trimmed  S51_trimmed  se-object.visium_baseline.rds.zip
S42_trimmed  S47_trimmed  S52_trimmed  se-object.visium_insulin.rds.zip
S43_trimmed  S48_trimmed  S53_trimmed  stereoscope_210322.zip
S44_trimmed  S49_trimmed  S54_trimmed  visium_sample_metadata.tsv
S45_trimmed  S50_trimmed  S55_trimmed

Neatly organized code btw

from scwat-st.

lfranzen avatar lfranzen commented on August 24, 2024

Thank you for the reply @lfranzen

the infotable is as original. I imagined it could be a path problem as I did not edit anything, but I assumed it was working fine as the Sample meta data block loaded the table without problems


```{r create_infotable}
sample_select_ids <- metadata_selected[, "novaseq_id"]
data_proc <- "trimmed"
sample_dirs_all <- c()
sample_names_all <- c()
for (s in sample_select_ids){
  message("Fetching data path for sample ", s)
  sample_dirs <- grep(pattern = s, x = list.dirs(path = file.path(DIR_DATA), recursive = F, full.names = T), value = T)
  sample_dirs <- grep(pattern = data_proc, x = sample_dirs, value = T)
  sample_dirs_all <- c(sample_dirs_all, sample_dirs)
  
  sample_names <- grep(pattern = s, x = list.dirs(path = file.path(DIR_DATA), recursive = F, full.names = F), value = T)
  sample_names <- grep(pattern = data_proc, x = sample_names, value = T)
  sample_names_all <- c(sample_names_all, sample_names)
}

data_dirs <- paste0(sample_dirs_all, "/filtered_feature_bc_matrix.h5")
spot_dirs <- paste0(sample_dirs_all, "/spatial/tissue_positions_list.csv")
img_dirs <- paste0(sample_dirs_all, "/spatial/tissue_hires_image.png")
img_scale_dirs <- paste0(sample_dirs_all, "/spatial/scalefactors_json.json")

infoTable <- data.frame(samples = data_dirs,
                        spotfiles = spot_dirs,
                        imgs = img_dirs,
                        json = img_scale_dirs,
                        metadata_selected, 
                        stringsAsFactors = F)

I downloaded the data and put it in the data folder, but maybe I did not structured it correctly? Here is what the data folder looks like

~/Documents/visiumadipocyte/scwat-st/data/visium$ ls
S41_trimmed  S46_trimmed  S51_trimmed  se-object.visium_baseline.rds.zip
S42_trimmed  S47_trimmed  S52_trimmed  se-object.visium_insulin.rds.zip
S43_trimmed  S48_trimmed  S53_trimmed  stereoscope_210322.zip
S44_trimmed  S49_trimmed  S54_trimmed  visium_sample_metadata.tsv
S45_trimmed  S50_trimmed  S55_trimmed

Neatly organized code btw

I see, that code should hopefully work, or at least I thought I made it so that it should work! However could you print out one example row from the infoTable and make sure the entire path are pointing to the correct locations? Especially the scalefactors_json.json files since it seems that's what the initial error was complaining about

from scwat-st.

dm8000 avatar dm8000 commented on August 24, 2024

Hello @lfranzen

It seems it could have been a problem with my environment, as the code seems to run smoothly after I restarted. I ran into another problem though, which I will open another issue.

Thank you for the help!

from scwat-st.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.