bio-expression-matrix-sparse-handling

Installation
SKILL.md

Sparse Matrix Handling

Check Sparsity

import numpy as np

# Calculate sparsity (proportion of zeros)
def check_sparsity(counts):
    zeros = (counts == 0).sum().sum()
    total = counts.size
    sparsity = zeros / total
    print(f'Sparsity: {sparsity:.1%} ({zeros:,} / {total:,} zeros)')
    return sparsity

# Rule of thumb: use sparse if >50% zeros

Convert Dense to Sparse

Installs
3
GitHub Stars
1.1K
First Seen
Jan 24, 2026
bio-expression-matrix-sparse-handling — gptomics/bioskills