Hi there!
I am trying to implement MonkeyBread package on my spatial transcriptomics data but I get some error while I have put all the data files needed in the directory:
I followed the tutorial so far exactly as explained. But get this error.
folder_path = ‘/Users/pedram/Desktop/MonkeyBread’
adata = mb.util.load_merscope(folder_path)
… reading from cache file cache/Users-pedram-Desktop-MonkeyBread-cell_by_gene.h5ad
KeyError Traceback (most recent call last)
Input In [25], in <cell line: 2>()
1 folder_path = '/Users/pedram/Desktop/MonkeyBread
----> 2 adata = mb.util.load_merscope(folder_path)
File ~/opt/anaconda3/lib/python3.9/site-packages/monkeybread/util/_load_merscope.py:74, in load_merscope(folder, use_cache, cell_bounds, transcript_locations, paths)
72 coordinates = pd.read_csv(f"{folder}/{paths[‘coordinates’]}")
73 coordinates = coordinates.rename({“Unnamed: 0”: “cell_id”}, axis=1)
—> 74 data = counts[coordinates.cell_id] # Slice data by coordinate index
75 data.obsm[“X_spatial”] = coordinates[[“center_x”, “center_y”]].to_numpy()
76 data.obs[“width”] = coordinates[“max_x”].to_numpy() - coordinates[“min_x”].to_numpy()
File ~/opt/anaconda3/lib/python3.9/site-packages/anndata/_core/anndata.py:1113, in AnnData.getitem(self, index)
1111 def getitem(self, index: Index) → “AnnData”:
1112 “”“Returns a sliced view of the object.”“”
→ 1113 oidx, vidx = self._normalize_indices(index)
1114 return AnnData(self, oidx=oidx, vidx=vidx, asview=True)
File ~/opt/anaconda3/lib/python3.9/site-packages/anndata/_core/anndata.py:1094, in AnnData._normalize_indices(self, index)
1093 def _normalize_indices(self, index: Optional[Index]) → Tuple[slice, slice]:
→ 1094 return _normalize_indices(index, self.obs_names, self.var_names)
File ~/opt/anaconda3/lib/python3.9/site-packages/anndata/_core/index.py:35, in _normalize_indices(index, names0, names1)
33 index = index[0].values, index[1]
34 ax0, ax1 = unpack_index(index)
—> 35 ax0 = _normalize_index(ax0, names0)
36 ax1 = _normalize_index(ax1, names1)
37 return ax0, ax1
File ~/opt/anaconda3/lib/python3.9/site-packages/anndata/_core/index.py:101, in _normalize_index(indexer, index)
99 if np.any(positions < 0):
100 not_found = indexer[positions < 0]
→ 101 raise KeyError(
102 f"Values {list(not_found)}, from {list(indexer)}, "
103 “are not valid obs/ var names or indices.”
104 )
105 return positions # np.ndarray[int]
106 else:
KeyError: “Values [‘AAACAAGTATCTCCCA.1’, ‘AAACAATCTACTAGCA.1’, ‘AAACACCAATAACTGC.1’, ‘AAACAGAGCGACTCCT.1’, ‘AAACAGGGTCTATATT.1’, ‘AAACAGTGTTCCTGGG.1’, ‘AAACATTTCCCGGATT.1’, ‘AAACCGGGTAGGTACC.1’, ‘AAACCGTTCGTCCAGG.1’, ‘AAACCTAAGCAGCCGG.1’, ‘AAACCTCATGAAGTTG.1’, ‘AAACGAAGAACATACC.1’, ‘AAACGAGACGGTTGAT.1’, ‘AAACGGGCGTACGGGT.1’, ‘AAACGGTTGCGAACTG.1’, ‘AAACGTGTTCGCCCTA.1’, ‘AAACTAACGTGGCGAC.1’, ‘AAACTCGGTTCGCAAT.1’, ‘AAACTCGTGATATAAG.1’, ‘AAACTGCTGGCTCCAA.1’, ‘AAACTTAATTGCACGC.1’, ‘AAACTTGCAAACGTAT.1’, ‘AAAGACCCAAGTCGCG.1’, ‘AAAGACTGGGCGCTTT.1’, ‘AAAGCTTGCCTACATA.1’, ‘AAAGGCCCTATAATAC.1’, ‘AAAGGCTACGGACCAT.1’, ‘AAAGGCTCTCGCGCCG.1’, ‘AAAGGGATGTAGCAAG.1’, ‘AAAGGGCAGCTTGAAT.1’, ‘AAAGGTAAGCTGTACC.1’, 'AAAGTAGCATTGC”