You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I preprocessed the snRNA of my multiome using scanpy and it has 59000 cells with different var attributes (‘highly variable’), while obs are ‘sample’ and ‘leiden’. The obs attributes are the same in ATAC processed using snapatac2 but var attributes are not.
When I run, assert (rna.obs_names == atac.obs_names).all() I get an error saying the “lengths should match”.
The text was updated successfully, but these errors were encountered:
yojetsharma
changed the title
Are number of cells and var attributes required to be the same while performing rna atac embedding?
[Multi modality pipeline] Are number of cells and var attributes required to be the same while performing rna atac embedding?
Oct 1, 2024
Variable length doesn't need to be the same. ATAC and RNA must share exactly the same barcodes, i.e., the data are coming from the same cell. You can run assert (rna.obs_names == atac.obs_names).all() yourself to make sure.
After running assert (rna.obs_names == atac.obs_names).all() I get the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[27], line 1
----> 1 assert (rna.obs_names == atac.obs_names).all()
File ~/.conda/envs/scarches/lib/python3.9/site-packages/pandas/core/ops/common.py:72, in _unpack_zerodim_and_defer.<locals>.new_method(self, other)
68 return NotImplemented
70 other = item_from_zerodim(other)
---> 72 return method(self, other)
File ~/.conda/envs/scarches/lib/python3.9/site-packages/pandas/core/arraylike.py:42, in OpsMixin.__eq__(self, other)
40 @unpack_zerodim_and_defer("__eq__")
41 def __eq__(self, other):
---> 42 return self._cmp_method(other, operator.eq)
File ~/.conda/envs/scarches/lib/python3.9/site-packages/pandas/core/indexes/base.py:6962, in Index._cmp_method(self, other, op)
6957 return arr
6959 if isinstance(other, (np.ndarray, Index, ABCSeries, ExtensionArray)) and len(
6960 self
6961 ) != len(other):
-> 6962 raise ValueError("Lengths must match to compare")
6964 if not isinstance(other, ABCMultiIndex):
6965 other = extract_array(other, extract_numpy=True)
ValueError: Lengths must match to compare
Since, mine is a multiome expt, could this be due to order in which the barcodes are present in both modalities are not the same?
Update: there seems to be a barcode mismatch in my multiome RNA preprocessed using scanpy and multiome ATAC preprocessed using SnapATAC2. Any idea how I can prevent this?
I preprocessed the snRNA of my multiome using scanpy and it has 59000 cells with different var attributes (‘highly variable’), while obs are ‘sample’ and ‘leiden’. The obs attributes are the same in ATAC processed using snapatac2 but var attributes are not.
When I run,
assert (rna.obs_names == atac.obs_names).all()
I get an error saying the “lengths should match”.The text was updated successfully, but these errors were encountered: