Question: Help! How to plot RNASeq data in PCA
gravatar for elizabethR
9 weeks ago by
elizabethR30 wrote:

Hi! Could I ask advice? I would like to plot RNASeq data that I have downloaded from TCGA in a PCA plot. I have found some great guides on how to plot the actual data in PCA using r in ggplot2 and such but my main question is what format data should I plot?

I currently have raw counts and RSEM data. Should I input raw counts into something like edgeR or deseq2 and filter for expression by cpm first? Should I normalise it? Should I stabilise variance using rlog2? Or convert to TPM and plot that? Argh I'm so confused. Grateful for any advice you can give me :)

rna-seq pca • 328 views
ADD COMMENTlink modified 9 weeks ago • written 9 weeks ago by elizabethR30

As an alternative to PCA you can also try MDS plots : but it should give similar results

ADD REPLYlink written 9 weeks ago by Corentin100
gravatar for plat
9 weeks ago by
plat30 wrote:

I would recommend you to input your raw counts into DESeq2, run the pipeline, convert normalized reads to rlog (regularized log transformed reads) and then just run the plotPCA function from DESeq2. It is very easy if you are familiarized with the program.

 # Creating deseq2 object
 dds <- DESeqDataSetFromMatrix(countData = inputData, 
                            colData = samples, 
                            design = design)

dds <- DESeq(dds, betaPrior = betaPrior)
# Regularized log transformation for different analysis (clustering, heatmaps, etc)
rld <- rlogTransformation(dds)
pca <- plotPCA(rld, intgroup = c(colGroups))

The idea behind using rlog transformation for Quality Control checks is described in DESeq2 paper: "[...] Therefore, we use the shrinkage approach of DESeq2 to implement a regularized logarithm transformation (rlog), which behaves similarly to a log2 transformation for genes with high counts, while shrinking together the values for different samples for genes with low counts. It therefore avoids a commonly observed property of the standard logarithm transformation, the spreading apart of data for genes with low counts, where random noise is likely to dominate any biologically meaningful signal[...]"

ADD COMMENTlink written 9 weeks ago by plat30
gravatar for elizabethR
9 weeks ago by
elizabethR30 wrote:

Thank you that's really really helpful :)

ADD COMMENTlink written 9 weeks ago by elizabethR30
gravatar for elizabethR
9 weeks ago by
elizabethR30 wrote:

I am not familiar with DESeq2, I have been using edgeR up to now. I have just been reading the manuals and online tutorials and looking at how to input the data. I see it will accept a count matrix such as the one I have in csv format, but that it needs a metadata file. I am really not sure how to make one of these or what it must contain. Can anyone advise on how I can do this?

Thanks again in advance

ADD COMMENTlink written 9 weeks ago by elizabethR30

Dear Elizabeth,

In the simplest scenario (4 samples; 4 genes; 1 experimental condition), your metadata object, which you may have to read in from a file, could look like:

ID  Condition

...whilst your counts file could look like:

    MA  MB  PA  PB
gene1   45  46  25  22
gene2   45  45  45  44
gene3   10  10  9   4
gene4   88  67  34  44

This could then be read into DESeq2 as:

dds <- DESeqDataSetFromMatrix(rawcounts, colData=metadata, design=~Condition)
ADD REPLYlink modified 9 weeks ago • written 9 weeks ago by Kevin Blighe6.4k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 577 users visited in the last hour