Really silly loading problem, but cannot solve

I am a fairly experienced scanpy user on my 5th dataset :slight_smile: thus, it is very embarrassing that I am stuck on something I suspect is incredibly simple, but on day 2 of trying to troubleshoot and I still can’t figure it out.

This is my second 10X dataset, .h5 produced from 10X cloud output. Fresh install of scanpy on python 3.9

scanpy==1.7.2 anndata==0.7.6 umap==0.5.1 numpy==1.21.1 scipy==1.7.1 pandas==1.3.1 scikit-learn==0.24.2 statsmodels==0.12.2 python-igraph==0.9.6 louvain==0.7.0

Anndata seems to load fine.

adata = sc.read_10x_h5(full_path)

AnnData object with n_obs × n_vars = 16187 × 36601
var: ‘gene_ids’, ‘feature_types’, ‘genome’

sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3)

<16187x29819 sparse matrix of type ‘<class ‘numpy.float32’>’
with 36216661 stored elements in Compressed Sparse Row format>

# mitochondrial genes
adata.var['mt'] = adata.var_names.str.startswith('MT-') 
# calculate QC on the vars
sc.pp.calculate_qc_metrics(adata, qc_vars=['mt'], percent_top=None, log1p=True)

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

It seems like it’s a transposition issue, but the dimensions above seem correct. Thoughts?

EDIT: this may be either an install / env issue… I tried following tutorial code, and I get the same error. Code from :scanpy.pp.calculate_qc_metrics — Scanpy 1.9.0.dev17+g4e4e6abe documentation

pbmc.var["mito"] = pbmc.var_names.str.startswith("MT-")
sc.pp.calculate_qc_metrics(pbmc, qc_vars=["mito"], inplace=True)

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

EDIT 2: no error on old install/env of scanpy:
scanpy==1.4.5 anndata==0.7.4 umap==0.4.6 numpy==1.19.1 scipy==1.5.2 pandas==1.1.1 scikit-learn==0.23.2 statsmodels==0.11.1 python-igraph==0.7.1+5.3b99dbf6 louvain==0.6.1 leidenalg==0.7.0

How do I track down where this error is coming from? Would like to use modern scanpy…