juanbot / CoExpNets

Co-expression network management based on WGCNA + k-means
Apache License 2.0
16 stars 8 forks source link

getModuleTOMGraph() and getModuleTOM() functions #20

Closed SoniaRuiz closed 4 years ago

SoniaRuiz commented 4 years ago

Hi Juan,

I am experiencing an issue when trying to request the TOM data from a specific category and network. What happens is that I am always obtaining the same list of genes within a specific category and network, regardless of the module selected.

I think that the reason might be related to the file path ("out.path" parameter) that I send to the functions getModuleTOMGraph() and getModuleTOM(). I think so because both functions return a message saying that they are reading the TOM file from the installation path, although the parameter 'out.path' is also correctly received:

The following output corresponds to the function 'getModuleTOMGraph()':

tom = getModuleTOMGraph(tissue="ad",module="plum1",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP", topgenes=2) Reading from /home_2/gsit/RLibrary/CoExpROSMAP//extdata/netad.8.it.50.rds [1] "/home_2/gsit/RLibrary/CoExpToms/"

On the other hand, the following output corresponds to the function 'getModuleTOM()':

tom = getModuleTOM(tissue="ad",module="plum1",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP") Reading from /home_2/gsit/RLibrary/CoExpROSMAP//extdata/netad.8.it.50.rds [1] "/home_2/gsit/RLibrary/CoExpToms/"

The path "/home_2/gsit/RLibrary/CoExpToms/" contains one TOM file per each category, network and module:

image

Let me know if you need any further information.

Sonia

SoniaRuiz commented 4 years ago

Hi Juan,

Not sure if you have had time to have a look into this issue. In case you need any further details about this issue, please let me know.

Sonia

juanbot commented 4 years ago

Sonia, working on this. I am not sure what is the problem. Do you mean that if you ask for the plum1 and then you ask for the blue module, it always return the same? Thanks

SoniaRuiz commented 4 years ago

The problem is that the function 'getModuleTOMGraph()' seems to be ignoring the parameter 'out.path'. I think so because the function 'getModuleTOMGraph()' always returns the TOM data from the installation path, instead of returning it from the path that I have indicated through the parameter 'out.path'.

The installation path only contains one TOM file per each network (i.e. "netad.8.it.50.rds"), which does not contain specific information about the module. In this sense, the plot graph always receives that type of file (i.e. "netad.8.it.50.rds") regardless of the module selected. And that is the reason why I think that the plot always shows the same information independently of the module selected.

juanbot commented 4 years ago

Hi Sonia, it is not exactly like that. When the function says "reading from ..." it means that it is reading the whole network and that is correct because the method has to. I would like to see a new code example in which you call

tom = getModuleTOMGraph(tissue="ad",module="plum1",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP", topgenes=2)

print(dim(tom))

tom = getModuleTOMGraph(tissue="ad",module="yellow",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP", topgenes=2)

print(dim(tom))

If the method works, the two dimensions should be different. Could you please try this? getModuleTOMGraph

SoniaRuiz commented 4 years ago

Sure!

After loading the packages:

image

This is the output that I have obtained:

image

juanbot commented 4 years ago

Sorry, I would ask you one more thing. Please run this code now. tom = getModuleTOMGraph(tissue="ad",module="plum1",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP", topgenes=2)

str(tom) print(tom) tom = getModuleTOMGraph(tissue="ad",module="yellow",out.path="/home_2/gsit/RLibrary/CoExpToms/",which.one="CoExpROSMAP", topgenes=2)

str(tom) print(tom)


Just want to check really whether the matrices are identical, but something does not seem right...

SoniaRuiz commented 4 years ago

Hi Juan!

I found the error, it was on my side!

Sorry, you were absolutely right, as the function getModuleTOMGraph() was working fine:

image

The error was a really silly one, I was hardcoding the module and always returning the 'black' one, regardless of the network and module selected. Not sure why I didn't realise about it before.

I have updated the test environment and now, the plot function works as expected:

If we select 'notad' and 'cyan', the top 2 genes are 'COMMD7' and 'MRPS24': image

On the contrary, if we select 'notad' and 'plum1', the top 2 genes are 'WDR47' and 'DNAJC6': image

Results that match with the ones returned by the function 'getModuleTOMGraph()': image

SoniaRuiz commented 4 years ago

Close the issue as it has been solved