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

          • 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
          • SEQadmin2
            Nine Things a Sample Prep Scientist Thinks About Before Sequencing
            by SEQadmin2


            I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

            Here are nine questions we think about, in roughly the order they matter, before...
            06-18-2026, 07:11 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Today, 11:05 AM
          0 responses
          6 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-02-2026, 11:08 AM
          0 responses
          28 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-30-2026, 05:37 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-26-2026, 11:10 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Working...