I'm now running code to filter my data with different cut-offs and generating new histograms, however, while going through the code again I noticed something:
dds <- DESeqDataSetFromMatrix(countData = cts,
colData = coldata,
design = ~ batch + condition)
dds <- DESeq(dds)
normalized_counts <- counts(dds, normalized=TRUE)
vsd <- vst(dds, blind=TRUE)
assay(vsd)
counts_norm_logged <- as.data.frame(assay(vsd))
hist(counts_norm_logged[,1])
Now, aside from the fact that I've called them logged counts, I don't see how I'm actually using the normalized counts here to for my histogram...: I create a new table containing the normalized counts (normalized_counts) and then I run the vst function, but I run it on dds, not on the table of normalized counts. And then I make a histograms based on the result from the vst function, that, as far as I'm aware doesn't contain the normalized counts.
Is this correct?
And if so, should I do it as follows:
dds <- counts(dds, normalized=TRUE)
vsd <- vst(dds, blind=TRUE)
This doesn't work, give me the error: Error in DESeqDataSet(se, design = design, ignoreRank) : some values in assay are not integers
or should I do the vst function on the normalized_counts table:
vsd <- vst(normalized_counts, blind=TRUE)
Here I obviously get the same error, since I'm basically only changing the name of the thing.
I'm sure I'm misunderstanding something somewhere, so I hope you will be able to help me clear it up :) Thanks!!



PCA usually benefit from first z-scoring, which only make sense if you a normal distribution for the expression data. Typically take a simple cut off at 1 will do, as it is predominately the 0s that you don't want. Gene pattern recommended 1 read per million for the gene over n samples as the threshold. Hannun from WCGNA wrote something about filtering on mean/std. Usually, after a log transforms on the expression level distribution, it becomes bimodal, which is unclear in your case. Can you plot the histograms with more bins?
Anyhow, if you are only interested in generating a PCA plot, just take the genes with highest STD for now, and see if the signal is there. Forget about the batch for now. The PCA will show if it is there.
http://software.broadinstitute.org/cancer/software/genepattern/modules/docs/PreprocessReadCounts/1?print=yes
Hi btsui, Thanks for you reply!
First of all, I've generated a few histograms with more bins (these are made from the whole datasets of 64 samples together, as suggested by Kevin below, I can also make them for a single sample if that is what you were looking for):
Histogram with the original number of bins, but with all 64 samples together:
Twice as many bins:
Five times as many bins:
Then I have a few questions: What is and how do I do z-scoring?
And a cut-off of 1, that is then based on a single sample I guess? And is this based on raw counts or something else?
I'm also trying to filter out the highest STD genes as you suggested, using the following code with an totally arbitrary cut-off of 10:
Of the 63677 original genes, I am then left with 15894 genes. Would you say that the way I do this is correct?
Then, my histogram looks like this:
I've generated a PCA on the data as is, with the histogram that I've provided before, and I actually think it already looks nice, but now I want it to be solid of course, based on actually normallly distributed data.
I've generated three PCA plots (plotPCA(vsd,intgroup="condition")) with their own histograms, 1 based on all the genes, 1 based on the genes for which rowSums>=10 and one for which rowSds>=10:
all genes (63677 genes):
rowSums>=10 (31748 genes):
rowSds>=10 (15894 genes):
All three PCA plots look very very similar I would say (there are tiny difference, but the shape is very similar). I guess this makes sense, since PCA looks at the genes with the highest STD anyway, and ignores the genes that are lowly expressed in all samples and the genes that have a low STD? And I'm expecting the groups to be very similar also, so I guess it makes sense that the PCA plot looks like this.
Thanks in advance!