Skip to content

Error: std::bad_alloc #299

@ConYel

Description

@ConYel

I am using a SingleCellExperiment object to create a reference.
The object is quite large and I have imported it using zellkonverter using out of memory representation.
The data is public and can be downloaded using these steps from here: https://github.com/AllenInstitute/abc_atlas_access/blob/main/notebooks/WHB_cluster_annotation_tutorial.ipynb

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path

from abc_atlas_access.abc_atlas_cache.abc_project_cache import AbcProjectCache
abc_cache.get_directory_metadata('WHB-taxonomy')
abc_cache.get_directory_metadata('WHB-10Xv3')
abc_cache.get_directory_data('WHB-10Xv3') # ~70 Gb

Then after some preprocessing to find the classes I wanted a subset the dataset I tried to make a reference using:

h5ad_file <- "./vol_data/_data/expression_matrices/WHB-10Xv3/20240330/WHB-10Xv3-Nonneurons-log2.h5ad"
sce <- zellkonverter::readH5AD(h5ad_file, use_hdf5 = TRUE)
identical(colnames(sce), cell_extended$cell_label)
colData(sce)$supercluster <- cell_extended$supercluster
names(assays(sce)) <- "logcounts"
trained <- trainSingleR(sce, labels = sce$supercluster, test.genes = rownames(sce), aggr.ref = TRUE)
Error: std::bad_alloc

How could I trace what could cause the error?

Thank you in advance!

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