#!/usr/bin/env Rscript # DESeq2 variance-stabilizing transform for the GSE205154 (Sears) VST sibling. # # Reads a gzipped integer counts matrix (genes x samples; first column = gene id, # header row = sample ids), applies DESeq2::vst (blind, no design — this is a QC/ # scoring transform, not a DE fit), and writes the gzipped VST matrix (same # orientation). Called as an Rscript subprocess from # assemble_gse205154_sears_vst.py (the ADR-0002 Rscript-subprocess pattern; no # rpy2). VST output is log2-like and homoscedastic → biodata-registry maps it to # data_level=log_expression (already-log; Path B). See ADR-0015. # # Usage: Rscript _vst_transform.R suppressMessages(library(DESeq2)) args <- commandArgs(trailingOnly = TRUE) if (length(args) != 2L) stop("usage: _vst_transform.R ") inp <- args[[1]] outp <- args[[2]] cts <- as.matrix(read.delim(gzfile(inp), row.names = 1, check.names = FALSE)) storage.mode(cts) <- "integer" cat(sprintf(" R: counts matrix %d genes x %d samples\n", nrow(cts), ncol(cts))) # vst() is DESeq2's fast VST (fits the dispersion trend on nsub genes, then # applies the closed-form transform to all genes). blind=TRUE => design-agnostic. vsd <- vst(cts, blind = TRUE) cat(sprintf(" R: vst done; range %.3f .. %.3f\n", min(vsd), max(vsd))) con <- gzfile(outp, "wt") write.table(vsd, con, sep = "\t", quote = FALSE, col.names = NA) close(con) cat(sprintf(" R: wrote %s\n", outp))