Skip to content

Conversation

@shashkat
Copy link

Description

Modified visium read function (squidpy.read.visium) by correcting header argument of pd.read_csv when reading tissue_positions.csv (Ref: #1089). Earlier, it was reading the tissue_positions.csv with pd.read_csv(file, header=1, ...) which was leading to the second row of the csv being read as header, which skipped one row of data. Changing to header=0 makes it function as expected. I don't know why it was header=1 in the first place (my guess is likely there used to be an extra line in tissue_positions.csv earlier, which is not there in the outputs now):

$ head tissue_positions.csv
barcode,in_tissue,array_row,array_col,pxl_row_in_fullres,pxl_col_in_fullres
GTCACTTCCTTCTAGA-1,1,0,0,23891.771232682222,39028.97429208872
CACGGTCTCCTTACGA-1,1,0,2,23897.618791707442,38663.634433938605
ATAGCTGCGGATAAGA-1,1,0,4,23903.46462886722,38298.2952273851
GTCAGTATGTCCGGCG-1,1,0,6,23909.31218148734,37932.95571104603
ATGTACCAGTTACTCG-1,1,0,8,23915.159740512565,37567.615852895906
ACGCTCAGTGCACCGT-1,1,0,10,23921.00558727999,37202.276133625826
TCACTAACGTATAGTT-1,1,0,12,23926.853130292468,36836.93713000333
CGGTTAGGCCTGGACG-1,1,0,14,23932.699492979013,36471.59724943537
GATATCACCAGCATGG-1,1,0,16,23938.546539287658,36106.257381677606

Closes

Closes #1089

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.17%. Comparing base (83a11d5) to head (06af281).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1094   +/-   ##
=======================================
  Coverage   66.17%   66.17%           
=======================================
  Files          44       44           
  Lines        7160     7160           
  Branches     1218     1218           
=======================================
  Hits         4738     4738           
  Misses       1944     1944           
  Partials      478      478           
Files with missing lines Coverage Δ
src/squidpy/read/_read.py 35.16% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@selmanozleyen
Copy link
Member

selmanozleyen commented Jan 19, 2026

thanks a lot, have you tried this with all the notebooks? When I check the notebooks and make sure the case when we need header=1 is more clear. I'd like to clarify the reason why it was written like that initially @timtreis @giovp any ideas?

The line was written by @stephenwilliams22 and @michalk8 , in #583.

Do you guys remember the reason for this? in which case would it crash if we set header=0

@shashkat
Copy link
Author

Hello, thanks for your points. I have tested on some notebooks in docs/notebooks/examples, and it seems to work as expected. I will check on the other notebooks too in a few days and confirm if it looks fine.

Thanks!

@shashkat
Copy link
Author

Hello, I ran all the notebooks in docs/notebooks/examples and relevant notebooks in docs/notebooks/tutorials and they seem to run successfully with the change, and the outputs seem to match visually at least. Let me know if anything else is required!

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

Successfully merging this pull request may close these issues.

Bug for reading the tissue_positions.csv

2 participants