Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • xuenjun1
    Junior Member
    • Aug 2014
    • 9

    how to get variation of each component in function plotPCA(DEseq)?

    Hello all,

    I have the question regarding to the attached figure in this question: http://seqanswers.com/forums/showthr...hlight=plotPCA

    How to get those percentage from each component? I have used the DESeq function plotPCA.

    Here is the simplified code that I used:
    cdsFullBlind = estimateDispersions( cdsFull, method = "blind" )
    vsdFull = varianceStabilizingTransformation( cdsFullBlind )
    print(plotPCA(vsdFull, intgroup=c("condition", "genotype")))

    Thanks a lot!
    Attached Files
    Last edited by xuenjun1; 09-10-2014, 11:21 AM.
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    From the code for plotPCA:
    Code:
    rv = rowVars(exprs(x))
      select = order(rv, decreasing=TRUE)[seq_len(ntop)]
      pca = prcomp(t(exprs(x)[select,]))
    ntop defaults to 500 and "x" would be vsdFull in your example.

    Comment

    • xuenjun1
      Junior Member
      • Aug 2014
      • 9

      #3
      Originally posted by dpryan View Post
      From the code for plotPCA:
      Code:
      rv = rowVars(exprs(x))
        select = order(rv, decreasing=TRUE)[seq_len(ntop)]
        pca = prcomp(t(exprs(x)[select,]))
      ntop defaults to 500 and "x" would be vsdFull in your example.
      Thanks a lot!

      I just run and got this result
      summary(pca)
      Importance of components:
      PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8
      Standard deviation 91.3001 52.8806 26.28177 14.80544 12.35189 10.68246 9.35059 8.70695
      Proportion of Variance 0.6469 0.2170 0.05361 0.01701 0.01184 0.00886 0.00679 0.00588
      Cumulative Proportion 0.6469 0.8639 0.91755 0.93456 0.94640 0.95526 0.96204 0.96793
      PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17
      Standard deviation 7.61892 7.45351 7.31581 7.00614 6.63956 6.42668 6.28243 6.10567 5.91024
      Proportion of Variance 0.00451 0.00431 0.00415 0.00381 0.00342 0.00321 0.00306 0.00289 0.00271
      Cumulative Proportion 0.97243 0.97674 0.98090 0.98471 0.98813 0.99133 0.99440 0.99729 1.00000
      PC18
      Standard deviation 5.395e-14
      Proportion of Variance 0.000e+00
      Cumulative Proportion 1.000e+00

      I guess the Proportion of Variance of PC1 and PC2 are the percentage that I want? And one more question, is the plotPCA output PC1 and PC2 in the attached figure corresponding to the first two components out of 18 PCs? Thanks a lot again.

      Comment

      • dpryan
        Devon Ryan
        • Jul 2011
        • 3478

        #4
        Yes, the proportion of the variance is what you want. PC1 and PC2 are from pca$x (the summary function you used doesn't show you everything in the pca object).

        Comment

        • dvanic
          Member
          • Jan 2012
          • 61

          #5
          Just as a note for other who may come across this post, I tried to use the above code with DESeq2 version 1.6.1, and got an error of
          rv = rowVars(exprs(vsd))
          Error in (function (classes, fdef, mtable) :
          unable to find an inherited method for function ‘exprs’ for signature ‘"SummarizedExperiment
          And at least for the version of DESeq2 I am using, the expression is actually obtained by using:
          rv = rowVars(assay(vsd)
          Then everything else works as expected.

          /Posting this in case someone else google-finds this post and then gets the error I did/

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
            by SEQadmin2



            Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
            ...
            07-09-2026, 11:10 AM
          • SEQadmin2
            Cancer Drug Resistance: The Lingering Barrier to Rising Survival
            by SEQadmin2



            Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

            There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
            07-08-2026, 05:17 AM
          • GATTACAT
            Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
            by GATTACAT
            Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
            07-01-2026, 11:43 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 07-13-2026, 10:26 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-09-2026, 10:04 AM
          0 responses
          35 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-08-2026, 10:08 AM
          0 responses
          22 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-07-2026, 11:05 AM
          0 responses
          34 views
          0 reactions
          Last Post SEQadmin2  
          Working...