te-gene-featurecounts

Generates gene and TE subfamily count matrices from STAR BAMs using containerized featureCounts.

1|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/tony-zhelonkin/scio --skill te-gene-featurecounts-tony-zhelonkin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: te-gene-featurecounts
Source: https://github.com/tony-zhelonkin/scio/tree/main/skills/te-gene-featurecounts
Command: npx skills add https://github.com/tony-zhelonkin/scio --skill te-gene-featurecounts-tony-zhelonkin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Counting transposable elements alongside genes from RNA-seq BAMs is error-prone: multimapping reads need special handling, strandedness must be verified per library, and featureCounts version drift breaks reproducibility. This Skill turns nf-core/rnaseq star_salmon BAMs plus a pre-built grouped TE SAF into integer gene + TE subfamily count matrices inside a version-locked Docker container (te-fc:2.0.2, featureCounts v2.0.2). ## Core Features & Use Cases - Env-locked two-pass counting: A vendored driver runs a TE pass (SAF, -M integer Random-One, no --fraction) and a gene pass (GTF, per-library strandedness), then row-binds them into a combined matrix. - Docker staging wrapper: scripts/run_te_counting.sh symlinks BAMs into bam_fin/ and bind-mounts targets at identical host=container paths so symlinks resolve and column names come out clean. - Strand-split QC suite: qc/run_qc.sh runs a 3-pass -R CORE regime witness, closure audit, -O silent-loss attribution, young-family gate, and geometry concordance, printing a consolidated GREEN/RED verdict. - Use Case: You have finished an nf-core/rnaseq run on mouse mm39 samples and need a combined gene + TE subfamily count matrix ready for DESeq2/edgeR differential expression, with verified integer counts and a QC gate before handoff. ## Quick Start Run scripts/run_te_counting.sh with your BAM directory, gene GTF, grouped TE SAF, verified gene strandedness, and output directory to produce the gene, TE, and combined count matrices inside the locked te-fc:2.0.2 container.

Frequently Asked Questions about te-gene-featurecounts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I count transposable elements and genes from RNA-seq BAMs?▼

Run scripts/run_te_counting.sh with your star_salmon BAM directory, gene GTF, grouped TE SAF, gene strandedness, and output directory. It stages BAM symlinks, bind-mounts them into the te-fc:2.0.2 Docker container, and produces TE, gene, and combined count matrices.

What featureCounts settings for TE subfamily counting?▼

The TE pass uses -M -F SAF -p --countReadPairs -B -C with no --fraction, giving integer Random-One counts because STAR emits one alignment per read. Do not add --primary, -O, or --largestOverlap on the grouped exon-subtracted SAF.

Should TE counting be stranded or unstranded?▼

For standalone TE quantification, unstranded (-s 0) matches the TEtranscripts default and is defensible. For a joint gene+TE matrix on a stranded library, use --te-strand sense_antisense to emit sense and antisense matrices matched to gene strandedness; the field genuinely splits.

Why does featureCounts fail inside the Docker container?▼

The scdock-r-dev:v0.5.x images do not contain subread/featureCounts, only MultiQC's parser. Build and use the locked te-fc:2.0.2 image via env/build.sh, or fall back to the legacy scdock-r-dev:v0.2 image.

Why are my gene counts near zero or half of expected?▼

The gene strandedness flag is almost certainly wrong for the library. Verify it per dataset using MultiQC inferred strandedness and the featureCounts header; dUTP/TruSeq libraries are typically reverse (-s 2), never assume 1 versus 2.

When should I not use featureCounts for TE quantification?▼

Do not use it for locus-level or copy-resolved TE quantification; the grouped SAF is subfamily-level, so use SQuIRE or Telescope instead. It also does not build the TE SAF, run STAR alignment, or perform differential expression.