Miaoyx323 / stCancer

20 stars 4 forks source link

Error when running stStatistics(): Error in file(file, "rt") : cannot open the connection and "tissue_positions_list.csv" not found #8

Open YF972 opened 1 year ago

YF972 commented 1 year ago

I am trying to analyze my spatial transcriptomics data generated from 10X Genomics Visium using the stCancer package. However, when running the stStatistics() function, I encounter the following error:

results <- stStatistics(sample.name,

  • dataPath = data.path,
  • savePath = save.path,
  • species = "human") [2023-04-30 15:59:50] START: RUN stStatistics [1] "VLP67_C" Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'R:/BREASTCR-Q5004/Mapping_VLP67_68_YF/VLP67_C/outs/spatial/tissue_positions_list.csv': No such file or directory

I do have a CSV file called "tissue_positions.csv" in the "spatial" folder, but not "tissue_positions_list.csv". Here is the code I used and the list of files in the "outs" and "spatial" folders:

library(stCancer) sample.name <- "VLP67_C" data.path <- "R:/BREASTCR-Q5004/Mapping_VLP67_68_YF/VLP67_C/outs" # including 'filtered_feature_bc_matrix' and 'spatial' folders save.path <- "R:/BREASTCR-Q5004/Mapping_VLP67_68_YF/VLP67_C/outs/result_scCancer/" list.files("R:/BREASTCR-Q5004/Mapping_VLP67_68_YF/VLP67_C/outs") [1] "analysis" "cloupe.cloupe" "filtered_feature_bc_matrix"
[4] "filtered_feature_bc_matrix.h5" "metrics_summary.csv" "molecule_info.h5"
[7] "possorted_genome_bam.bam" "possorted_genome_bam.bam.bai" "probe_set.csv"
[10] "raw_feature_bc_matrix" "raw_feature_bc_matrix.h5" "result_scCancer"
[13] "result2_scCancer" "spatial" "web_summary.html"
list.files("R:/BREASTCR-Q5004/Mapping_VLP67_68_YF/VLP67_C/outs/spatial") [1] "aligned_fiducials.jpg" "detected_tissue_image.jpg" "scalefactors_json.json" "spatial_enrichment.csv"
[5] "tissue_hires_image.png" "tissue_lowres_image.png" "tissue_positions.csv"

Is there a workaround or solution for this issue? I'm relatively new to coding, I usually do wetlab work only, Sorry if I asking stupid question. I appreciate any help you can provide.

Miaoyx323 commented 1 year ago

Hi, After Spaceranger was upgraded to version 2.0, the previously named "tissue_positions_list.csv" output file became the "tissue_positions.csv" file you mentioned. The file name change caused this bug. The fastest solution is to copy the "tissue_positions.csv" file and name it "tissue_positions_list.csv", and delete the first line of the file. After that, you can run the code without this error. We will also update the code for SpaceRanger 2.0 later. Thank you for using stCancer.

Best, Miao