How to implement the code in MonkeyBread package
0
0
Entering edit mode
15 months ago
piotto ▴ 20

I get the following error when I want to implement this :

(older_path = '/Users/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 [16], 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', 'AAACT

Visium spatial_transcriptomics MonkeyBread • 364 views
ADD COMMENT

Login before adding your answer.

Traffic: 1677 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6