Skip to content

RuntimeError: unrecognized data type for compressed sparse matrix initialization #36

@slee-ai

Description

@slee-ai

I am encountering an issue with singler.annotate_single

Here is the python code I ran

with open (<path>, "rb") as f: 
    adata = pickle.load(f)
adata.var_names_make_unique()

import singlecellexperiment as sce
sce_adata = sce.SingleCellExperiment.from_anndata(adata)

import celldex
ref_data = celldex.fetch_reference("blueprint_encode", "2024-02-26", realize_assays=True)

mat = sce_adata.assay("X")
features = [str(x) for x in sce_adata.row_data.row_names]

import singler
results = singler.annotate_single(
    test_data = mat,
    test_features = features,
    ref_data = ref_data,
    ref_labels = ref_data.get_column_data().column("label.main"),
)

But this code is giving me the following error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[9], line 2
      1 import singler
----> 2 results = singler.annotate_single(
      3     test_data = mat,
      4     test_features = features,
      5     ref_data = ref_data,
      6     ref_labels = ref_data.get_column_data().column("label.main"),
      7 )

File ~/miniconda3/envs/singler2/lib/python3.13/site-packages/singler/annotate_single.py:134, in annotate_single(test_data, ref_data, ref_labels, test_features, ref_features, test_assay_type, ref_assay_type, test_check_missing, ref_check_missing, train_args, classify_args, num_threads)
    118 test_data, test_features = _restrict_features(
    119     test_data,
    120     test_features,
    121     ref_features
    122 )
    124 built = train_single(
    125     ref_data=ref_data,
    126     ref_labels=ref_labels,
   (...)    131     **train_args,
    132 )
--> 134 return classify_single(
    135     test_data,
    136     ref_prebuilt=built,
...
     70 itmp = _contiguify(x.indices)
     71 indtmp = x.indptr.astype(numpy.uint64, copy=False, order="A")
---> 72 return InitializedMatrix(lib.initialize_compressed_sparse_matrix(x.shape[0], x.shape[1], dtmp, itmp, indtmp, False))

RuntimeError: unrecognized data type '������������������������������������������������������������������������������������������������������8' for compressed sparse matrix initialization

I have Python version 3.13.3
scipy version 1.15.2

I used the following commands to install the package

git clone <ssh link to this github repo> 
cd singler-py
conda create -n singler "python>=3.9"
conda install -c conda-forge cmake
pip install -e . 
pip install celldex
conda install jupyter

I want to ask the following
(1) could you clarify the expected data types to singler.annotate_single?
(2) Is there a recommended conda-based installation method that ensures all build tools (like CMake) are properly available?

I appreciate your help resolving this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions