SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pearson correlation in R gene_x Bioinformatics 10 10-29-2015 07:25 AM
WGCNA eigengene correlation tethys Bioinformatics 0 11-18-2014 07:08 AM
Correlation Plots willemate RNA Sequencing 0 05-06-2014 12:09 AM
Wig correlation Liy Bioinformatics 2 10-31-2013 06:55 AM
Clusters-reads correlation? cggj Bioinformatics 5 03-10-2010 07:10 PM

Reply
 
Thread Tools
Old 04-24-2015, 12:43 PM   #1
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Question 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!
Marcos Lancia is offline   Reply With Quote
Old 04-27-2015, 04:53 AM   #2
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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().
blakeoft is offline   Reply With Quote
Old 04-27-2015, 10:36 AM   #3
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

That's my big problem right now. I'd like to know how can I use cor() with CuffData.
Marcos Lancia is offline   Reply With Quote
Old 04-27-2015, 10:44 AM   #4
cmbetts
Member
 
Location: Bay Area

Join Date: Jun 2012
Posts: 99
Default

Quote:
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.
cmbetts is offline   Reply With Quote
Old 04-27-2015, 10:51 AM   #5
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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])
blakeoft is offline   Reply With Quote
Old 04-29-2015, 09:31 AM   #6
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default 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!
Marcos Lancia is offline   Reply With Quote
Old 05-01-2015, 08:47 AM   #7
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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.
blakeoft is offline   Reply With Quote
Old 05-04-2015, 10:17 AM   #8
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

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?
Marcos Lancia is offline   Reply With Quote
Old 05-04-2015, 10:27 AM   #9
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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 at 10:36 AM.
blakeoft is offline   Reply With Quote
Old 05-04-2015, 11:09 AM   #10
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

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.
Marcos Lancia is offline   Reply With Quote
Old 05-04-2015, 11:59 AM   #11
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

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"
Marcos Lancia is offline   Reply With Quote
Old 05-05-2015, 04:53 AM   #12
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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.
blakeoft is offline   Reply With Quote
Old 05-05-2015, 09:38 AM   #13
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

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.
Marcos Lancia is offline   Reply With Quote
Old 05-05-2015, 11:27 AM   #14
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

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().
blakeoft is offline   Reply With Quote
Old 05-08-2015, 10:18 AM   #15
Marcos Lancia
Member
 
Location: Argentina

Join Date: Apr 2015
Posts: 31
Default

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.
Marcos Lancia is offline   Reply With Quote
Old 05-08-2015, 10:35 AM   #16
blakeoft
Member
 
Location: Connecticut

Join Date: Oct 2013
Posts: 79
Default

The help file of the version of cummeRbund that I'm using says that the labels parameter isn't implemented yet, in other words it doesn't do anything yet. Besides, the plot would probably be extremely crowded if you added labels like that. You might find the colorByStatus parameter useful though. Set it to true, and the colors of the points should indicate if they are significant or not. It seems to slow down the plotting quite a bit though.
blakeoft is offline   Reply With Quote
Reply

Tags
correlation coefficient, cummerbund, scatter plot

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 03:53 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO