Hy4m / linkET

Everything is Linkable
145 stars 39 forks source link

How to fill the missed values in matrix before running linkET? #18

Closed B-1991-ing closed 1 year ago

B-1991-ing commented 1 year ago

Hi Houyun,

How do you usually do when your matrix have some missed values? If I don't fill the missed values, I will have error when using the linkET.

Matrix matrix.txt

Thank you very much.

Best,

Bing

Hy4m commented 1 year ago

Compute correlation or others?

B-1991-ing commented 1 year ago

For mantel_test and qcorrplot(correlate()).


From: Hou Yun @.***> Sent: 10 May 2023 16:49:16 To: Hy4m/linkET Cc: Bing Song; Author Subject: Re: [Hy4m/linkET] How to fill the missed values in matrix before running linkET? (Issue #18)

Compute correlation or others?

— Reply to this email directly, view it on GitHubhttps://github.com/Hy4m/linkET/issues/18#issuecomment-1542340382, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM7LNIIBABVIYANIBRIWHWDXFOTGZANCNFSM6AAAAAAX3AUMHE. You are receiving this because you authored the thread.Message ID: @.***>

Hy4m commented 1 year ago

For mantel_test and qcorrplot(correlate()).

Maybe the use argument in the correlate function can solve your problem😂

B-1991-ing commented 1 year ago

What kind of argument in the correlate function?

I actually want to do the same figure as what i sent youu last time. But, this time, I have some missed values in the first matrix.

So, how do you usually deal with this kind of incomplete matrix?

Best,

Bing


From: Hou Yun @.***> Sent: 10 May 2023 17:36:19 To: Hy4m/linkET Cc: Bing Song; Author Subject: Re: [Hy4m/linkET] How to fill the missed values in matrix before running linkET? (Issue #18)

For mantel_test and qcorrplot(correlate()). …

Maybe the use argument in the correlate function can solve your problem😂

— Reply to this email directly, view it on GitHubhttps://github.com/Hy4m/linkET/issues/18#issuecomment-1542419793, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM7LNIMA5ERZGQGWDA6ILT3XFOYXHANCNFSM6AAAAAAX3AUMHE. You are receiving this because you authored the thread.Message ID: @.***>

Hy4m commented 1 year ago

What kind of argument in the correlate function? I actually want to do the same figure as what i sent youu last time. But, this time, I have some missed values in the first matrix. So, how do you usually deal with this kind of incomplete matrix? Best, Bing

The following example should solve your problem. However, there may be some errors when you run it, because there are bugs in the previous version, which can only be completely solved after I push the new version tomorrow.

## replace some data with NA
varespec[sample(nrow(varespec), 3), sample(ncol(varespec), 2)] <- NA
varechem[sample(nrow(varechem), 3), sample(ncol(varechem), 2)] <- NA

library(linkET)

set_corrplot_style()
qcorrplot(correlate(varechem, use = "pairwise.complete.obs")) +
  geom_square()

mantel_test(varespec, varechem)
B-1991-ing commented 1 year ago

Thank you very much.

Tomorrow is okay.

But, could you explain me a bit about the process of replacing NA in matrix tomorrow? By mean value, random forest or other algorithms?

Have a nice evening.

Best,

Bing


From: Hou Yun @.***> Sent: 10 May 2023 18:36:55 To: Hy4m/linkET Cc: Bing Song; Author Subject: Re: [Hy4m/linkET] How to fill the missed values in matrix before running linkET? (Issue #18)

What kind of argument in the correlate function? I actually want to do the same figure as what i sent youu last time. But, this time, I have some missed values in the first matrix. So, how do you usually deal with this kind of incomplete matrix? Best, Bing …

The following example should solve your problem. However, there may be some errors when you run it, because there are bugs in the previous version, which can only be completely solved after I push the new version tomorrow.

replace some data with NA

varespec[sample(nrow(varespec), 3), sample(ncol(varespec), 2)] <- NA varechem[sample(nrow(varechem), 3), sample(ncol(varechem), 2)] <- NA

library(linkET)

set_corrplot_style() qcorrplot(correlate(varechem, use = "pairwise.complete.obs")) + geom_square()

mantel_test(varespec, varechem)

— Reply to this email directly, view it on GitHubhttps://github.com/Hy4m/linkET/issues/18#issuecomment-1542505368, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM7LNIL3LKEKZ7XHVDQBM4TXFO72PANCNFSM6AAAAAAX3AUMHE. You are receiving this because you authored the thread.Message ID: @.***>

B-1991-ing commented 1 year ago

Hi Houyun,

In your code,

**## replace some data with NA varespec[sample(nrow(varespec), 3), sample(ncol(varespec), 2)] <- NA varechem[sample(nrow(varechem), 3), sample(ncol(varechem), 2)] <- NA

library(linkET)

set_corrplot_style() qcorrplot(correlate(varechem, use = "pairwise.complete.obs")) + geom_square()

mantel_test(varespec, varechem)**

Did you ignore the rows with the NA values or your code replaces the the NA values in the matrix as 0 or other automatic values?

Best,

Bing