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

Handle Situation where V1 Visium tissue_positions_list.csv Has a Header #146

Closed
jeffquinn-msk opened this issue May 17, 2024 · 4 comments · Fixed by #200
Closed

Handle Situation where V1 Visium tissue_positions_list.csv Has a Header #146

jeffquinn-msk opened this issue May 17, 2024 · 4 comments · Fixed by #200

Comments

@jeffquinn-msk
Copy link

I've been given a new dataset where the positions file is in the V1 location spatial/tissue_positions_list.csv, but it has a header. Really annoying I know. This ends up causing an exception in the Visium loader as the coordinates are loaded as string type by pandas. You might see similar data eventually as well I'm guessing..

Could we add something to the code to check for header in both locations? This is the function I wrote to deal with this:

def read_with_maybe_header(path, header):
    df = pd.read_csv(path)
    seen_header = df.columns
    if set(seen_header).issubset(set(header)):
        return df
    else:
        return pd.read_csv(path, names=header)
@LucaMarconato
Copy link
Member

Hi @jeffquinn-msk @inodb, thanks for reporting. Do you know any publicly available dataset that presents this structure?

@LucaMarconato
Copy link
Member

To reproduce I am taking the visium_1.3.0_io dataset from the sandbox and replacing the tissue_positions_list.csv file (=> no header) with the tissue_positions.csv file (=> with header) from the visium_2.1.0_1_io dataset from the sandbox, and renaming it to tissue_positions_list.csv. In this way we have a < 2.0.0 filename, but with a header (as found with 2.x datasets)

@LucaMarconato
Copy link
Member

Btw, this issue reminds me of this one (Xenium), where data processed with an old version of Xenium Onboard Analysis is partly reprocessed with a recent version of SpaceRanger, creating confusion when parsing. Anyway, the case that you reported seems easy to address, I'll work on a fix now.

@LucaMarconato
Copy link
Member

Hi made a fix in the linked PR. Some details:

LucaMarconato added a commit that referenced this issue Aug 16, 2024
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 a pull request may close this issue.

2 participants