digitalcytometry / cytospace

CytoSPACE: Optimal mapping of scRNA-seq data to spatial transcriptomics data
Other
115 stars 19 forks source link

OSError: Could not find 'spatial/tissue_positions_list.csv' #76

Closed gebdu closed 1 year ago

gebdu commented 1 year ago

spaceranger-2.0.0

In spaceranger output "spatial" folder, we have following files

aligned_fiducials.jpg detected_tissue_image.jpg scalefactors_json.json spatial_enrichment.csv tissue_hires_image.png tissue_lowres_image.png tissue_positions.csv

.........................................

but the CytoSPACE is looking for 'tissuepositionslist.csv' file Although manual renaming works! Later it failed giving another error:

cytospace \ --scRNA-path $sc/count_matrix.tsv \ --cell-type-path $sc/cell_types.tsv \ --spaceranger-path $sr/S1.tar.gz \ --output-prefix S1 \ --downsample-off

2023-06-06 20:08:12 Integration Performing PCA on the provided reference using 2373 features as input. Projecting PCA Finding neighborhoods Finding anchors Found 1831 anchors Filtering anchors Retained 1704 anchors Finding integration vectors Finding integration vector weights 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Predicting cell labels 100% |██████████████████████████████████████████████████| Reading data [done] Time to read and validate data: 539.98 seconds Estimating number of cells in each spot ... Time to estimate number of cells per spot: 1.16 seconds Down/up sample of scRNA-seq data according to estimated cell type fractions Time to down/up sample scRNA-seq data: 4.69 seconds Building cost matrix ... Time to build cost matrix: 2.92 seconds Solving linear assignment problem ... Time to solve linear assignment problem: 318.8 seconds Total time to run CytoSPACE core algorithm: 333.13 seconds Saving results ... Traceback (most recent call last): File "/home/.conda/envs/cytospace/bin/cytospace", line 8, in sys.exit(run_cytospace()) File "/home/.conda/envs/cytospace/lib/python3.8/site-packages/cytospace/cytospace.py", line 690, in run_cytospace main_cytospace(**arguments) File "/home/.conda/envs/cytospace/lib/python3.8/site-packages/cytospace/cytospace.py", line 682, in main_cytospace plot_results(output_path, output_prefix, coordinates_data=coordinates_data, geometry=geometry, num_cols=num_column, max_num_cells=max_num_cells_plot) File "/home/.conda/envs/cytospace/lib/python3.8/site-packages/cytospace/post_processing/plot.py", line 338, in plot_results plot_results_bulk_ST_by_spot(coordinates_data, metadata, output_directory, output_prefix, geometry=geometry, num_cols=num_cols) File "/home/.conda/envs/cytospace/lib/python3.8/site-packages/cytospace/post_processing/plot.py", line 63, in plot_results_bulk_ST_by_spot scale = Y.max() < 500 and ((Y - Y.round()).abs() < 1e-5).all() TypeError: '<' not supported between instances of 'str' and 'int'

.................................................................. As spaceranger failed. Tried Seurat object. Also the the helper R script: "generate_cytospace_from_seurat_object.R" doesn't subset the ST_expressions data based one image slice, only the coordinates. So, for merged Seurat object for multiple samples, get the entire ST_expression data for all image slices. Not sure if it creates any problem or not, but interestingly two of my samples (out of 8) got exact Seurat_weights.txt

hsjeon-k commented 1 year ago

Hi!

The tar.gz input for Space Ranger currently does not work well with outputs from Space Ranger v2.0.0+, and this is due to a small change in the output format for v2.0.0 and above. Please see the discussion in issue #70 for more details. We hope to fix this later, but in the meantime we recommend that you use the default tab-delimited file inputs. Apologies for the inconvenience!

Thank you for bringing up the point with generate_cytospace_from_seurat_object, and I will look into the function to see if it can be changed. The two spatial transcriptomics input files -- expression and coordinates -- must have spot names that exactly match each other, so please make sure that this condition is true (CytoSPACE will also check internally to make sure that you have matching spot names).

Thank you!