-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fail to filter loom by CellID extracted from Seurat #4
Comments
I met the same problem.
|
Hi to both of you! If you could, please open up your cell observation file (either in excel or python) and look to see the name of the column that has the ids. Use this name for subsetting the loom file (so if the column is named "x"): sample[np.isin(sample.obs.index,cellID_obs["x"])] Thanks! |
Go ahead and make them unique. Check this out for more information. |
Hi, IndexError Traceback (most recent call last) ~/.local/lib/python3.6/site-packages/anndata/_core/anndata.py in getitem(self, index) ~/.local/lib/python3.6/site-packages/anndata/_core/anndata.py in _normalize_indices(self, index) ~/.local/lib/python3.6/site-packages/anndata/_core/index.py in _normalize_indices(index, names0, names1) ~/.local/lib/python3.6/site-packages/anndata/_core/index.py in _normalize_index(indexer, index) IndexError: Unknown indexer View of AnnData object with n_obs × n_vars = 0 × 32285 |
Just realized the typo. It should be: sample[np.isin(sample.obs.index,cellID_obs["x"])] Edit: In your case, I'm guessing "z" would be the column name. |
Yes, sample_one = sample_one[np.isin(sample_one.obs.index,cellID_obs["z"])] worked. |
Hi all, |
Hello everyone! First time user of bioinformatics tools and curious to why would we want the variable names to be unique? According to this AnnData page, the variable names are genes ... if more than one cell is expressing a gene, would we not expect repeats? And would it not be more relevant for us to make the obs_names unique since that holds our CellIDs? I am having siillar issues to the OP - my post #13 outlines everything I have tried ....any clarification would be appreciated! |
Hi,
I have problem when trying to filter loom with CellID extracted from Seurat object.
.var_names_make_unique
. Do I need to run sample.var_names_make_unique()?KeyError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2890 try:
-> 2891 return self._engine.get_loc(casted_key)
2892 except KeyError as err:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 0
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
in
----> 1 sample = sample[sample[np.isin(sample.obs.index,cellID_obs[0])]]
~/.local/lib/python3.6/site-packages/pandas/core/frame.py in getitem(self, key)
2900 if self.columns.nlevels > 1:
2901 return self._getitem_multilevel(key)
-> 2902 indexer = self.columns.get_loc(key)
2903 if is_integer(indexer):
2904 indexer = [indexer]
~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2891 return self._engine.get_loc(casted_key)
2892 except KeyError as err:
-> 2893 raise KeyError(key) from err
2894
2895 if tolerance is not None:
KeyError: 0
Could you help me with this?
Thank you so much!
The text was updated successfully, but these errors were encountered: