Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Marcos Lancia
    Member
    • Apr 2015
    • 31

    correlation value in scatterplots using cummerbund??

    Hi,
    I'm running cummerbund and I made a scatterplot of my data, but I'd like to see the correlation value of that plot. Is it possible? Is there any command to see the R value of that correlation?? Thanks!
  • blakeoft
    Member
    • Oct 2013
    • 79

    #2
    You might have to use cor(), a base R function. However, I don't know exactly how to subset a CuffData object so that you get the proper input for cor().

    Comment

    • Marcos Lancia
      Member
      • Apr 2015
      • 31

      #3
      That's my big problem right now. I'd like to know how can I use cor() with CuffData.

      Comment

      • cmbetts
        Senior Member
        • Jun 2012
        • 120

        #4
        Originally posted by Marcos Lancia View Post
        That's my big problem right now. I'd like to know how can I use cor() with CuffData.
        It's been a while since I've used cummeRbund, but I remember that you can use the fpkmMatrix() function (can't remember the exact usage) to get a matrix that plays nicely with the base R functions.

        Comment

        • blakeoft
          Member
          • Oct 2013
          • 79

          #5
          Thanks for the tip cmbetts. It looks like you want to execute
          Code:
          m <- fpkmMatrix(genes(cuffdiff_output))
          cor(m[, 1], m[, 2]) # or whatever columns you need
          Keep in mind that csScatter() might discard some of the data points. You can verify this by running
          Code:
          csScatter(genes(cuffdiff_output))
          # compare to
          plot(m[, 1], m[, 2])

          Comment

          • Marcos Lancia
            Member
            • Apr 2015
            • 31

            #6
            I'm progressing, now a new problem

            Thanks for writing everyone! I finally could see the correlation value, but I crashed with another new problem. One of the r value is near to 0, but the plot looks very good, near to 1. I'm pretty sure that data plotted is the same analized. Anybody saw something similar? What did you do? Thanks!

            Comment

            • blakeoft
              Member
              • Oct 2013
              • 79

              #7
              Marcos,

              Did you ever sort this out? I would double check that you're supplying the right vectors to cor(). It might also have to do with how csScatter doesn't plot all of the data points. It's hard for me to think of anything else since I don't have the data to play with myself.

              Comment

              • Marcos Lancia
                Member
                • Apr 2015
                • 31

                #8
                Hi, again

                For example: I want to analyze TRAP_Sm_rep1 vs TRAP_Sm_rep2. So, I write:

                >samples (cuff)

                sample_index sample_name sample_name parameter value
                1 1 SN16K_mock_rep2 <NA> <NA> <NA>
                2 2 SN16K_mock_rep1 <NA> <NA> <NA>
                3 3 SN16K_Sm_rep2 <NA> <NA> <NA>
                4 4 SN16K_Sm_rep1 <NA> <NA> <NA>
                5 5 TRAP_mock_rep1 <NA> <NA> <NA>
                6 6 TRAP_mock_rep2 <NA> <NA> <NA>
                7 7 TRAP_Sm_rep1 <NA> <NA> <NA>
                8 8 TRAP_Sm_rep2 <NA> <NA> <NA>

                So, I write:

                >cor(m[, 7],m[, 8])

                Is it right?

                Comment

                • blakeoft
                  Member
                  • Oct 2013
                  • 79

                  #9
                  I have a couple questions for you. Are you following some sort of published analysis? Also, does each row of samples(cuff) have a column in m? In other words, what does
                  Code:
                  all(colnames(m) %in% samples(cuff)[, 2])
                  say when you enter it into your R session?

                  Edit: I realize that the code above isn't exactly what I meant to ask for. Can you paste what R prints for
                  Code:
                  colnames(m)
                  Last edited by blakeoft; 05-04-2015, 10:36 AM.

                  Comment

                  • Marcos Lancia
                    Member
                    • Apr 2015
                    • 31

                    #10
                    all(colnames(m) %in% samples(cuff)[, 2])
                    [1] TRUE

                    I'm working by myself. I don't following any published analysis. Do you know any? The R help isn't good either.

                    Comment

                    • Marcos Lancia
                      Member
                      • Apr 2015
                      • 31

                      #11
                      colnames(m)

                      [1] "SN16K_mock_rep2" "SN16K_mock_rep1" "SN16K_Sm_rep2" "SN16K_Sm_rep1"
                      [5] "TRAP_mock_rep1" "TRAP_mock_rep2" "TRAP_Sm_rep1" "TRAP_Sm_rep2"

                      Comment

                      • blakeoft
                        Member
                        • Oct 2013
                        • 79

                        #12
                        I saw the prefix "TRAP", and it made me think of Trapnell, as in Cole Trapnell. This is why I was curious if you were working with some kind of sample data set or something.

                        Your code should be correct though,
                        Code:
                        cor(m[, 7], m[, 8])
                        should give you what you want. Have you tried checking the correlation between both of these columns with all of the others?

                        You might also compare the following values:

                        Code:
                        sum(m[, 7] == 0)
                        sum(m[, 8] == 0)
                        sum(m[, 7] == 0 & m[, 8] == 0)
                        to see if you have many more zeros in one the columns or if they don't share many of the same zeros.

                        My suggestions are shots in the dark, so I apologize if nothing enlightening happens.

                        Comment

                        • Marcos Lancia
                          Member
                          • Apr 2015
                          • 31

                          #13
                          No, I´m not working with Cole Trapnell datasets, these data are mine.
                          Question: How can I be sure that data plotted are the same analyzed by correlation? Make some kind of matrix, maybe?
                          Thanks so much for writing, you've been very helpful.

                          Comment

                          • blakeoft
                            Member
                            • Oct 2013
                            • 79

                            #14
                            After reading in some of my old cufflinks data, I've realized that my second post in this discussion has some incorrect code. Please plot these two figures for comparison:

                            Code:
                            csScatter(genes(cuff), "TRAP_Sm_rep1", "TRAP_Sm_rep2")
                            # compare to
                            plot(log(m[, 7] + 1), log(m[, 8] + 1))
                            These plots should look pretty similar. You should be able to tell that you're passing the right vectors into cor().

                            Comment

                            • Marcos Lancia
                              Member
                              • Apr 2015
                              • 31

                              #15
                              Hi,
                              Your suggestion of plotting log(m[, ]+1) gaves me an idea. I made the cor(log(m[, ]+1)) and it worked! The cor() values are up to 0.95 all of them. Thanks for your help, mission accomplished, up to now.
                              Do you know how can I put labels in genes with differential expression? I tried with labels=T in scatterplots, but it didn´t work.

                              Comment

                              Latest Articles

                              Collapse

                              • 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...
                                Yesterday, 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
                              • 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, Yesterday, 10:08 AM
                              0 responses
                              6 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-07-2026, 11:05 AM
                              0 responses
                              8 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-02-2026, 11:08 AM
                              0 responses
                              31 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-30-2026, 05:37 AM
                              0 responses
                              29 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...