YuLab-SMU / GOSemSim

:golf: GO-terms Semantic Similarity Measures
https://yulab-smu.top/biomedical-knowledge-mining-book/
58 stars 26 forks source link

mgoSim can not get values when r -f file.R from command line #2

Closed tkosaka1976 closed 9 years ago

tkosaka1976 commented 9 years ago

Thank you for your developing effort this R package. I tired to use "mgoSim" function and found a problem. I'm using R 3.1.2 installed by Homebrew on macosx 10.9.5

I made a simple code

library("GOSemSim")
go1 <- c("GO:0016021", "GO:0005622", "GO:0005886", "GO:0015450", "GO:0065002", "GO:0006605", "GO:0043952")
go2 <- c("GO:0016021", "GO:0008565")
mgoSim(go1, go2, ont = "BP", measure = "Wang", combine = "BMA")

when I did this in R console the result is:

mgoSim(go1, go2, ont = "BP", measure = "Wang", combine = "BMA") [1] 0.332

However, I ran this code using "r -f file.R" then:

mgoSim(go1, go2, ont = "BP", measure = "Wang", combine = "BMA") [1] 1

I investigated the results in detail then I found that the calculation was failed in "r -f file.R" as:

mgoSim(go1, go2, ont = "BP", measure = "Wang", combine = NULL) GO:0016021 GO:0008565 GO:0016021 1 NA GO:0005622 NA NA GO:0005886 NA NA GO:0015450 NA NA GO:0065002 NA NA

This result also got in R console as:

mgoSim(go1, go2, ont = "BP", measure = "Wang", combine = NULL) GO:0016021 GO:0008565 GO:0016021 1.000 0 GO:0005622 NA NA GO:0005886 0.327 0 GO:0015450 NA NA GO:0065002 0.000 0 GO:0006605 0.000 0 GO:0043952 0.000 0

I'm not sure about the real result but it looks like "r -f file.R" failed the calculation. I hope to know the solution. Please help me.

Kosaka

GuangchuangYu commented 9 years ago

run R script in R console and in a R script should give the same result.

I can't replicate your issue.

tkosaka1976 commented 9 years ago

I hope so. But my computer outputs like that. Which result is the true one?

GuangchuangYu commented 9 years ago

I run in a script and in console, they all give the result as you did in your r -file.R.