Agent skill · Data & Analytics

bio-expression-matrix-sparse-handling

Work with sparse matrices for memory-efficient storage of count data. Use when dealing with single-cell data or large bulk RNA-seq datasets where most values are zero.

BioTender-maxgithub.com/BioTender-maxGitHub ↗
claude-codeships scriptsNOASSERTION
Install
npx skills add BioTender-max/awesome-bio-agent-skills --skill sparse-handling --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 3
SKILL.md size: 10 KB
Bundled scripts: yes
Path: skills/bioskills/sparse-handling/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 135
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

## Version Compatibility Reference examples tested with: numpy 1.26+, pandas 2.2+ Before using code patterns, verify installed versions match. If versions differ: - Python: `pip show <package>` then `help(module.function)` to check signatures If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying. # Sparse Matrix Handling **"Convert counts to sparse matrix"** → Store zero-heavy expression data (especially single-cell) in memory-efficient sparse format. - Python: `scipy.sparse.csr_matrix(dense_array)`, `anndata.X` stores sparse by default - Python: `scipy.io.mmread('matrix.mtx')` for Market Matrix format (10x Genomics) ## Check Sparsity ```python 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 ```python import scipy.sparse as sp import pandas as pd # From pandas DataFrame dense_df = pd.read_csv('counts.csv', ind

What's inside
Steps it walks through
  1. Version Compatibility
  2. Check Sparsity
  3. Convert Dense to Sparse
  4. Convert Sparse to Dense
  5. Memory Comparison
  6. Save/Load Sparse Matrices
  7. AnnData with Sparse Matrices
  8. Sparse Operations
  9. Subsetting Sparse Matrices
  10. Normalization on Sparse
  11. 10X Matrix Format
  12. Backed Mode for Large Datasets
  13. Sparsity Changes After Transformation
  14. Sparse-Dense Arithmetic Gotcha
Ships with 2 files
  • examples/sparse_operations.py
  • usage-guide.md
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-expression-matrix-sparse-handling skill do?

Work with sparse matrices for memory-efficient storage of count data. Use when dealing with single-cell data or large bulk RNA-seq datasets where most values are zero.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill sparse-handling --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going