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

Can't read in protein antibody capture data #3113

Open
3 tasks done
alexanderchang1 opened this issue Jun 18, 2024 · 4 comments · Fixed by alexanderchang1/scanpy#1 · May be fixed by #3278
Open
3 tasks done

Can't read in protein antibody capture data #3113

alexanderchang1 opened this issue Jun 18, 2024 · 4 comments · Fixed by alexanderchang1/scanpy#1 · May be fixed by #3278
Labels
Needs info❔ More information needed

Comments

@alexanderchang1
Copy link

alexanderchang1 commented Jun 18, 2024

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.

What happened?

I'm trying to read in visium data with antibody capture data but for some reason the antibody capture data is not registering. Is there something I'm doing wrong? I couldn't find documentation on how to do this. Although I do see the antibody capture data in the web_summary.html

However read_10x_mtx method works directly on the folder, is there a way to add gex_only functionality to the read_visium function?

Minimal code sample

print(key)
        adata = sc.read_visium(path, count_file='filtered_feature_bc_matrix.h5', load_images=True, )
        print(adata)
        
        # Separate RNA and protein data
        rna_data = adata[:, adata.var['feature_types'] == 'Gene Expression']
        protein_data = adata[:, adata.var['feature_types'] == 'Antibody Capture']
        
        # Verify the separated data
        print("RNA data shape:", rna_data.shape)
        print("Protein data shape:", protein_data.shape)

Error output

MWS22-14789

AnnData object with n_obs × n_vars = 2256 × 18085
    obs: 'in_tissue', 'array_row', 'array_col'
    var: 'gene_ids', 'feature_types', 'genome', 'isotype_control', 'normalized', 'pattern', 'read', 'secondary_name', 'sequence'
    uns: 'spatial'
    obsm: 'spatial'
RNA data shape: (2256, 18085)
Protein data shape: (2256, 0)

Versions

1.10.1
@alexanderchang1 alexanderchang1 added Bug 🐛 Triage 🩺 This issue needs to be triaged by a maintainer labels Jun 18, 2024
@alexanderchang1
Copy link
Author

Hi, I just wanted to follow up on this.

@flying-sheep
Copy link
Member

Hi, I don’t have much experience with that data. Does squidpy work better? https://squidpy.readthedocs.io/en/stable/api/squidpy.read.visium.html

scanpy doesn’t have much support for spatial analysis, squidpy is built for it.

@flying-sheep flying-sheep added Needs info❔ More information needed and removed Triage 🩺 This issue needs to be triaged by a maintainer labels Aug 5, 2024
@alexanderchang1
Copy link
Author

Hi, let me give that a shot.

@alexanderchang1
Copy link
Author

Hi, I tried that and got this error. I think it's because it's recognizing both antibody data and gene data and throwing an error.


TypeError Traceback (most recent call last)
Cell In[7], line 13
11 key = get_second_to_last_split(path)
12 print(key)
---> 13 adata = sq.read.visium(path, count_file='filtered_feature_bc_matrix.h5', load_images=True)
15 # Create unique cell identifiers
16 adata.obs_names = f'sample_{key}_' + adata.obs_names

File /bgfs/alee/LO_LAB/Personal/Alexander_Chang/alc376/envs/popari_env/lib/python3.12/site-packages/squidpy/read/_read.py:67, in visium(path, counts_file, library_id, load_images, source_image_path, **kwargs)
34 """
35 Read 10x Genomics Visium formatted dataset.
36
(...)
64 - :attr:anndata.AnnData.uns ['spatial']['{library_id}']['metadata'] - various metadata.
65 """ # noqa: E501
66 path = Path(path)
---> 67 adata, library_id = _read_counts(path, count_file=counts_file, library_id=library_id, **kwargs)
69 if not load_images:
70 return adata

TypeError: squidpy.read._utils._read_counts() got multiple values for keyword argument 'count_file'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs info❔ More information needed
Projects
None yet
2 participants