Skip to content

Instantly share code, notes, and snippets.

@brwnj
Last active December 17, 2015 03:28
Show Gist options
  • Save brwnj/5543321 to your computer and use it in GitHub Desktop.
Save brwnj/5543321 to your computer and use it in GitHub Desktop.
Return a normalized counts table from DESeq by calling Rscript. Assumes DESeq library is installed and file is tab delimited.
# Usage:
# Rscript norm_count_table.R file_in.tab file_out.tab
# source("http://bioconductor.org/biocLite.R")
# biocLite("DESeq")
library(DESeq)
args <- commandArgs(TRUE)
filein <- args[1]
fileout <- args[2]
ct <- read.table(filein, header=TRUE, row.names=1, sep="\t")
cds <- newCountDataSet(ct, condition=c(rep("t", ncol(ct))))
cds <- estimateSizeFactors(cds)
write.table(counts(cds, normalized=TRUE), file=fileout, sep="\t", col.names=NA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment