YuLab-SMU / GOSemSim

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

Uninformative error #9

Closed llrs closed 7 years ago

llrs commented 7 years ago

I was exploring the methods and I found a couple of issues ( I will send a pull request if I can):

library("org.Hs.eg.db")
library("GOSemSim")
> BP.hs.GO <- godata('org.Hs.eg.db', ont="BP")
[1] "preparing gene to GO mapping data..."
[1] "preparing IC data..."
> geneSim("241", "251", semData=BP.hs.GO, measure="Wang", combine="BMA")
Error in if (is.na(go1) || is.na(go2)) return(NA) : 
  missing value where TRUE/FALSE needed
>geneSim("241", "251", semData=BP.hs.GO, measure="Wang", combine="BMA", drop = NULL)
$geneSim
[1] 0.221

$GO1
[1] "GO:0006691" "GO:0019370" "GO:0019372" "GO:0043085" "GO:0070207" "GO:0071277"
[7] "GO:2001300"

$GO2
[1] "GO:0016311"

Whenever sending a message to the user, the right way is with message, not print. The function doesn't seem to check if there is any GO left to calculate the similarity. So It could be useful to provide an error more informative, maybe pointing to the drop option.

llrs commented 7 years ago

Thanks for the quick change! I would recommend to add a test for each bug/issue, this way you can know if any further change breaks other previous solved cases.