methylKit icon indicating copy to clipboard operation
methylKit copied to clipboard

Possible to let getCorrelation return the correlation matrix instead of printing it?

Open tmms1 opened this issue 4 years ago • 8 comments

Hello

Would it be possible the let the getCorrelation function return the correlation matrix instead of just printing it? Now it is very hard to do anything more with that matrix then printing it.

Thanks.

tmms1 avatar Oct 25 '19 11:10 tmms1

a correlation matrix is already returned. You need to assign the output of the function to a variable

On Fri, Oct 25, 2019 at 1:49 PM tmms1 [email protected] wrote:

Hello

Would it be possible the let the getCorrelation function return the correlation matrix instead of just printing it? Now it is very hard to do anything more with that matrix then printing it.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/al2na/methylKit/issues/168?email_source=notifications&email_token=AAE32EIMCCHXVHLTL5TDQMTQQLMLPA5CNFSM4JFCK2T2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HULWL7Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE32EMDRZ6W4UG46SVIGTTQQLMLPANCNFSM4JFCK2TQ .

al2na avatar Oct 25 '19 12:10 al2na

Thank you for the reply.

However, I tried your suggestion but I did not work. If I assign the output of getCorrelation() to a variable and call that variable, the result is NULL. I attached a pdf that illustrates this.

test_correlation_methylKit.pdf

tmms1 avatar Oct 25 '19 14:10 tmms1

OK, this is something we should fix. But getting the correlation matrix is a oneliner cor.mat = cor(percMethylation(methBase)) let me know if this works

al2na avatar Oct 25 '19 19:10 al2na

Thanks for your reply. That works!

tmms1 avatar Oct 28 '19 07:10 tmms1

Unfortunately, cor(percMethylation(methBase)) doesn't solve the problem for me. I get the following error message:

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘1.100257985.100257985’, ‘1.100731534.100731534’, ‘1.101106647.101106647’, ‘1.101754029.101754029’, ‘1.102248305.102248305’, ‘1.102297481.102297481’, ‘1.102667622.102667622’, ‘1.104404436.104404436’, ‘1.105814622.105814622’, ‘1.106061430.106061430’, ‘1.106133508.106133508’, ‘1.106769095.106769095’, ‘1.106998668.106998668’, ‘1.107102713.107102713’, ‘1.107511959.107511959’, ‘1.107602027.107602027’, ‘1.108049895.108049895’, ‘1.108249979.108249979’, ‘1.108481586.108481586’, ‘1.108580629.108580629’, ‘1.108642663.108642663’, ‘1.109447782.109447782’, ‘1.109646194.109646194’, ‘1.110591777.110591777’, ‘1.110944821.110944821’, ‘1.110944826.110944826’, ‘1.111083951.111083951’, ‘1.111169953.111169953’, ‘1.111196458.111196458’, ‘1.11142815.11142815’, ‘1.111665583.111665583’, ‘1.112333415.112333415’, ‘1.112605046.112605046’,  [... truncated] ```

boryanakis avatar Aug 10 '20 19:08 boryanakis

Hi @boryanakis,

it seems like you are having duplicated chromosome positions in your methylBase object. Could you please tell me which version of methylKit you are using and show me the full code how you arrived at that error?

Best, Alex

alexg9010 avatar Aug 11 '20 08:08 alexg9010

Hi @alexg9010,

I was using 1.10.0 but upgraded to the latest version 1.15.3 this morning, and I am getting the same error. Here are the main commands in my code:

methDataDB <- methRead(as.list(sample_files),
                       sample.id = as.list(labels), 
                       treatment=rep(0, length(sample_files)),
                       assembly="GRCh37", 
                       dbtype = "tabix",
                       dbdir = "methylDB")

methDataDBUnited <- unite(methDataDB, destrand = FALSE)

percMethylation(methDataDBUnited)

My input files have the following structure:


chrBase	chr	base	strand	coverage	freqC	freqT
chr1.750261	1	750261	F	2	100	0
chr1.750261	1	750261	R	27	92.593	7.407
chr1.750504	1	750504	F	12	100	0
chr1.750504	1	750504	R	12	91.667	8.333
chr1.750717	1	750717	F	45	100	0
chr1.750717	1	750717	R	1	100	0
chr1.750798	1	750798	F	28	100	0
chr1.750798	1	750798	R	2	100	0
chr1.750878	1	750878	F	26	84.615	15.385

Thank you for your help.

boryanakis avatar Aug 12 '20 15:08 boryanakis

How did you create this methylation call file? The coordinates seem wrong. Forward and reverse strands can't have a cytosine in the same position

On Wed, Aug 12, 2020 at 5:56 PM Boryana Koseva [email protected] wrote:

Hi @alexg9010 https://github.com/alexg9010,

I was using 1.10.0 but upgraded to the latest version 1.15.3 this morning, and I am getting the same error. Here are the main commands in my code:

methDataDB <- methRead(as.list(sample_files), sample.id = as.list(labels), treatment=rep(0, length(sample_files)), assembly="GRCh37", dbtype = "tabix", dbdir = "methylDB")

methDataDBUnited <- unite(methDataDB, destrand = FALSE)

percMethylation(methDataDBUnited)

My input files have the following structure:

chrBase chr base strand coverage freqC freqT chr1.750261 1 750261 F 2 100 0 chr1.750261 1 750261 R 27 92.593 7.407 chr1.750504 1 750504 F 12 100 0 chr1.750504 1 750504 R 12 91.667 8.333 chr1.750717 1 750717 F 45 100 0 chr1.750717 1 750717 R 1 100 0 chr1.750798 1 750798 F 28 100 0 chr1.750798 1 750798 R 2 100 0 chr1.750878 1 750878 F 26 84.615 15.385

Thank you for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/al2na/methylKit/issues/168#issuecomment-672960357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE32EP6QTLZ5J6ZEOBBEQLSAK3SHANCNFSM4JFCK2TQ .

al2na avatar Aug 15 '20 05:08 al2na