Skip to content

read_dropest error  #3

@apdavid

Description

@apdavid
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [38], in <cell line: 1>()
----> 1 adata = QCPipe.qc.read_dropest("raw_matrix")

File ~/pipseq/qc_utils.py:29, in read_dropest(dir_path, reorder)
     27 adata.obs.index.name = 'Cells'
     28 adata.var.index.name = 'Genes'
---> 29 adata = reorder_AnnData(adata,descending=True)
     30 adata.raw = adata
     31 return(adata)

File ~/pipseq/qc_utils.py:13, in reorder_AnnData(AnnData, descending)
     11 AnnData.obs['total_counts'] = AnnData.X.sum(axis=1)
     12 if(descending==True):
---> 13     AnnData = AnnData[np.argsort(AnnData.obs['total_counts'])[::-1]].copy()
     14     AnnData.uns['Order'] = 'Descending'
     15 elif(descending==False):

File <__array_function__ internals>:180, in argsort(*args, **kwargs)

File ~/.local/lib/python3.9/site-packages/numpy/core/fromnumeric.py:1120, in argsort(a, axis, kind, order)
   1012 @array_function_dispatch(_argsort_dispatcher)
   1013 def argsort(a, axis=-1, kind=None, order=None):
   1014     """
   1015     Returns the indices that would sort an array.
   1016 
   (...)
   1118 
   1119     """
-> 1120     return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order)

File ~/.local/lib/python3.9/site-packages/numpy/core/fromnumeric.py:57, in _wrapfunc(obj, method, *args, **kwds)
     54     return _wrapit(obj, method, *args, **kwds)
     56 try:
---> 57     return bound(*args, **kwds)
     58 except TypeError:
     59     # A TypeError occurs if the object does have such a method in its
     60     # class, but its signature is not identical to that of NumPy's. This
   (...)
     64     # Call _wrapit from within the except clause to ensure a potential
     65     # exception has a traceback chain.
     66     return _wrapit(obj, method, *args, **kwds)

File ~/.local/lib/python3.9/site-packages/pandas/core/series.py:3667, in Series.argsort(self, axis, kind, order)
   3663     return self._constructor(result, index=self.index).__finalize__(
   3664         self, method="argsort"
   3665     )
   3666 else:
-> 3667     return self._constructor(
   3668         np.argsort(values, kind=kind), index=self.index, dtype="int64"
   3669     ).__finalize__(self, method="argsort")

File ~/.local/lib/python3.9/site-packages/pandas/core/series.py:430, in Series.__init__(self, data, index, dtype, name, copy, fastpath)
    428     index = ibase.default_index(len(data))
    429 elif is_list_like(data):
--> 430     com.require_length_match(data, index)
    432 # create/copy the manager
    433 if isinstance(data, (SingleBlockManager, SingleArrayManager)):

File ~/.local/lib/python3.9/site-packages/pandas/core/common.py:531, in require_length_match(data, index)
    527 """
    528 Check the length of data matches the length of the index.
    529 """
    530 if len(data) != len(index):
--> 531     raise ValueError(
    532         "Length of values "
    533         f"({len(data)}) "
    534         "does not match length of index "
    535         f"({len(index)})"
    536     )

ValueError: Length of values (1) does not match length of index (404099)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions