Bio Rna Quantification Tximport Workflow
Import transcript-level quantifications from Salmon/kallisto into R for gene-level analysis with DESeq2/edgeR using tximport or tximeta. Use when importing transcript counts into R for DESeq2/edgeR.
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install openclaw-medical-bio-rna-quantification-tximport-workflowManual setup by platform
Claude Code
~/.claude/skills/openclaw-medical-bio-rna-quantification-tximport-workflow/SKILL.md
Instructions
tximport Workflow
Import transcript-level estimates from Salmon, kallisto, or other quantifiers into R for gene-level differential expression analysis.
Basic tximport
library(tximport)
# Define sample files
files <- c(
sample1 = 'sample1_quant/quant.sf',
sample2 = 'sample2_quant/quant.sf',
sample3 = 'sample3_quant/quant.sf'
)
# Load transcript-to-gene mapping
tx2gene <- read.csv('tx2gene.csv') # columns: TXNAME, GENEID
# Import at gene level
txi <- tximport(files, type = 'salmon', tx2gene = tx2gene)
Creating tx2gene Mapping
From GTF (using GenomicFeatures)
library(GenomicFeatures)
txdb <- makeTxDbFromGFF('annotation.gtf')
k <- keys(txdb, keytype = 'TXNAME')
tx2gene <- select(txdb, k, 'GENEID', 'TXNAME')
From Ensembl (using biomaRt)
library(biomaRt)
mart <- useMart('ensembl', dataset = 'hsapiens_gene_ensembl')
tx2gene <- getBM(
attributes = c('ensembl_transcript_id_version', 'ensembl_gene_id_version'),
mart = mart
)
colnames(tx2gene) <- c('TXNAME', 'GENEID')
From Salmon quant.sf
quant <- read.table('sample1_quant/quant.sf', header = TRUE)
tx2gene <- data.frame(
TXNAME = quant$Name,
GENEID = gsub('\\..*', '', quant$Name) # Remove version
)
Import Types
Gene-Level Summarization (Default)
# Summarize transcripts to gene level
txi <- tximport(files, type = 'salmon', tx2gene = tx2gene)
# Returns: counts, abundance (TPM), length at gene level
Transcript-Level (No Summarization)
# Keep transcript-level estimates
txi <- tximport(files, type = 'salmon', txOut = TRUE)
# Returns: counts, abundance, length at transcript level
Scaled TPM (for visualization)
# Gene-level TPM
txi <- tximport(files, type = 'salmon', tx2gene = tx2gene,
countsFromAbundance = 'scaledTPM')
Source-Specific Import
Salmon
txi <- tximport(files, type = 'salmon', tx2gene = tx2gene)
kallisto
txi <- tximport(files, type = 'kallisto', tx2gene = tx2gene)
RSEM
txi <- tximport(files, type = 'rsem', tx2gene = tx2gene)
StringTie
txi <- tximport(files, type = 'stringtie', tx2gene = tx2gene)
Using with DESeq2
library(DESeq2)
# Create sample metadata
coldata <- data.frame(
condition = factor(c('control', 'control', 'treated', 'treated')),
row.names = names(files)
)
# Create DESeqDataSet from tximport
dds <- DESeqDataSetFromTximport(txi, colData = coldata, design = ~ condition)
# Filter low counts
dds <- dds[rowSums(counts(dds)) >= 10, ]
# Run DESeq2
dds <- DESeq(dds)
res <- results(dds)
Using with edgeR
library(edgeR)
# Create DGEList with offset
cts <- txi$counts
normMat <- txi$length
normMat <- normMat / exp(rowMeans(log(normMat)))
o <- log(calcNormFactors(cts / normMat)) + log(colSums(cts / normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# Continue with edgeR analysis
y <- estimateDisp(y, design)
tximeta: Metadata-Aware Import
tximeta automatically attaches transcript and gene information from the original annotation.
library(tximeta)
# First time: link transcriptome to annotation
makeLinkedTxome(
indexDir = 'salmon_index',
source = 'Ensembl',
organism = 'Homo sapiens',
release = '110',
genome = 'GRCh38',
fasta = 'transcripts.fa',
gtf = 'annotation.gtf'
)
# Import with full metadata
coldata <- data.frame(
files = files,
names = names(files),
condition = c('control', 'control', 'treated', 'treated')
)
se <- tximeta(coldata)
# Summarize to gene level
gse <- summarizeToGene(se)
# Convert to DESeqDataSet
dds <- DESeqDataSet(gse, design = ~ condition)
tximport Output Structure
names(txi)
# [1] "abundance" "counts" "length"
# [4] "countsFromAbundance"
# abundance: TPM values (genes x samples)
# counts: estimated counts (genes x samples)
# length: effective gene lengths (genes x samples)
Handling Version Numbers
# Remove version from transcript IDs
tx2gene$TXNAME <- gsub('\\.\\d+$', '', tx2gene$TXNAME)
# Or ignore version during import
txi <- tximport(files, type = 'salmon', tx2gene = tx2gene,
ignoreTxVersion = TRUE, ignoreAfterBar = TRUE)
Related Skills
- rna-quantification/alignment-free-quant - Upstream Salmon/kallisto
- differential-expression/deseq2-basics - DESeq2 analysis
- differential-expression/edger-basics - edgeR analysis
- genome-intervals/gtf-gff-handling - GTF annotation parsing
Security
Reviews (0)
Related skills
Browse all →More from OpenClaw Medical
View source →More Build skills
Browse category →Frequently asked questions about bio-rna-quantification-tximport-workflow
What does the bio-rna-quantification-tximport-workflow skill do?
Import transcript-level quantifications from Salmon/kallisto into R for gene-level analysis with DESeq2/edgeR using tximport or tximeta. Use when importing transcript counts into R for DESeq2/edgeR. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the bio-rna-quantification-tximport-workflow skill?
Run `npx @skills-hub-ai/cli install openclaw-medical-bio-rna-quantification-tximport-workflow` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/openclaw-medical-bio-rna-quantification-tximport-workflow/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does bio-rna-quantification-tximport-workflow work with?
bio-rna-quantification-tximport-workflow runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the bio-rna-quantification-tximport-workflow skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use bio-rna-quantification-tximport-workflow after installing it?
In Claude Code, type `/openclaw-medical-bio-rna-quantification-tximport-workflow` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the bio-rna-quantification-tximport-workflow skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.