This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to normalise a HTSEQ combined replicate count table

I have a htseq raw counts table of different tissues rna-seq counts against a custom set of sequences 300 genes. What I would like to do is normalise the counts for each tissue combining the replicates too. I have 2-4 replicates for different tissues with columns G1, G2, G3 etc for each sample followed by name and replicate. I can see code how to do it from raw individual htseq files of each sample but not an already combined table (I got this from galaxy). Any code for normalising a table like below including replicates into a normalised single value for each tissue.

row.names G1.grain_Z71 G1.grain_Z71.1 G2.Grain_Z75 G2.Grain_Z75.1

TRAES3AF032200050CFD_g. 1 2 2 29 36

TRAES3AF032200050CFD_g. 2 75 99 2 3

TRAES3AF035200150CFD_g 0 0 0 0

TRAES3AF107900020CFD_g 8 6 32 30

htseq deseq2

1 answer

I guess that the trick is mostly getting things into R in a convenient format for DESeq. Assuming the file is called foo.txt:

library(DESeq2)
tab = read.delim("foo.txt", header=T)
dds = DESeqDataSetFromMatrix(tab, colData=data.frame(group=rep(0, ncol(tab)), design=~1
dds = estimateSizeFactors(dds)
counts(dds, normalized=T)

Log in to answer this question.