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

Is any mapping from patch index to spot index? #83

Open
windygoo opened this issue Dec 31, 2024 · 0 comments
Open

Is any mapping from patch index to spot index? #83

windygoo opened this issue Dec 31, 2024 · 0 comments

Comments

@windygoo
Copy link

windygoo commented Dec 31, 2024

with h5py.File(f'patches/{lung_files[0][:-5]}.h5') as f:
    img = f['img'][:]
    coords = f['coords'][:]
    downsample = dict(f['img'].attrs)['downsample']
    
with h5py.File(f'st/{lung_files[0][:-5]}.h5ad') as f:
    gene_names = f['var']['_index']
    spot_coords = f['obsm']['spatial']

np.where(np.all(spot_coords == (coords[[0]] + 224 * downsample // 2).astype(int), axis=1))

The last line in the codes seems a solution but I am worried about its universality.

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

No branches or pull requests

1 participant