noriakis / ggkegg

Analyzing and visualizing KEGG information using the grammar of graphics
https://noriakis.github.io/software/ggkegg
MIT License
201 stars 16 forks source link

Something wrong with module_completeness funciton #25

Closed wangshiming closed 2 months ago

wangshiming commented 2 months ago

Thank you very much for the wonderful pacakge! I have two queries: query1, and query2, and query1 is a subset of query2, module_completeness(query1) returns all TRUE, while query2 returns a FALSE item.

query2 <- c(query1, "K00242") mod <- module("M00011", use_cache = TRUE) mod |> module_completeness(query1) mod |> module_completeness(query2)

query1 = c("K00241","K00239","K00240","K00954","K00677","K16363","K02536","K01555","K00162","K01745","K01755","K01438","K00930","K00821","K00145","K01940","K03585","K00925","K01961","K02160","K00648","K00097","K00645","K00948","K01595","K01952","K01684","K13877","K12658","K01911","K01661","K02551","K19222","K00912","K14652","K03787","K15777","K00215","K01937","K01657","K01658","K01609","K01817","K01695","K11381","K01923","K00626","K00845","K03270","K01627","K01903","K01835","K00457","K00252","K00453","K00548","K00297","K12524","K00872","K01733","K03831","K03392","K01897","K01480","K00059","K00831","K00058","K00615","K00700","K08289","K01962","K01712","K11754","K01783","K01686","K00275","K01810","K00850","K00688","K00232","K00287","K12373","K00174","K00175","K00226","K03737","K01737","K01495","K01681","K00765","K00013","K00817","K02501","K01814","K02500","K11755","K00382","K01596","K00854","K15736","K00074","K00674","K01647","K01714","K12340","K01752","K00560","K07282","K01640","K01812","K00134","K00627","K00499","K00873","K02078","K09458","K01950","K03526","K02276","K02257","K02259","K02274","K02275","K04561","K00376","K01785","K00849","K03639","K03635","K03637","K03750","K21071","K00927","K13766","K02609","K02610","K02611","K02612","K01053","K02613","K01756","K01625","K00874","K01685","K00024","K13038","K00979","K00796","K00558","K01468","K01951","K15866","K00033","K00333","K00332","K00331","K00330","K00067","K00991","K02517","K02169","K00757","K01591","K00254","K03786","K00341","K00318","K01735","K00800","K08641","K00655","K06016","K00919","K00208","K00337","K00338","K00339","K00340","K00342","K00343","K00764","K00609","K01697","K01584","K07250","K04516","K04517","K04518","K00161","K00031","K00606","K06041","K01945","K07665","K00940","K01689","K01956","K01902","K00826","K01687","K01652","K01653","K00053","K01754","K02566","K01703","K01704","K00052","K01649","K00693","K00368","K00891","K00973","K03644","K00965","K01770","K11752","K00819","K01077","K03272","K00703","K00820","K01885","K01719","K03517","K02305","K00372","K03886","K00371","K00278","K01933","K00249","K05783","K13789","K03801","K15916","K00549","K01803","K03527","K01679","K03474","K02548","K01589","K01588","K15746","K01823","K15633","K00767","K03525","K05710","K00632","K07516","K00116","K00390","K01784","K00286","K01808","K00600","K00133","K00012","K00789","K01586","K03783","K00859","K01662","K01465","K02108","K02110","K02109","K02113","K02111","K02115","K00088","K00957","K00860","K02204","K01113","K17103","K01479","K00003","K00641","K00131","K01778","K01955","K01790","K01710","K00942","K00969","K00486","K01556","K00452","K09903","K01960","K03179","K11175","K00451","K00602","K01613","K00261","K00981","K01736","K01895","K00525","K00526","K01963","K11645","K00164","K00658","K01092","K00928","K17836","K02114","K02112","K00939","K01966","K05979","K00605","K00798","K02527","K03841","K03183","K01633","K05606","K01491","K03274","K00748","K01939","K01006","K03273","K01585","K00643","K01749","K01698","K15862","K00406","K00014","K08097","K00128","K00588","K03269","K01251","K01847","K00099")

noriakis commented 2 months ago

Hi, thank you very much for using the package.

This is obviously a bug, and thanks for reporting.

The problem was that the non-essential components in reactions (in this example K00242) affected the other boolean expressions.

I have made a change to ignore the non-essential part and committed to the devel branch. I will update this in the main and devel branches of the Bioconductor release as soon as possible.

If you find other bugs regarding parsing or evaluating the module, please feel free to report them here.

library(ggkegg)
query1 = c("K00241","K00239","K00240","K00954","K00677","K16363","K02536","K01555","K00162","K01745","K01755","K01438","K00930","K00821","K00145","K01940","K03585","K00925","K01961","K02160","K00648","K00097","K00645","K00948","K01595","K01952","K01684","K13877","K12658","K01911","K01661","K02551","K19222","K00912","K14652","K03787","K15777","K00215","K01937","K01657","K01658","K01609","K01817","K01695","K11381","K01923","K00626","K00845","K03270","K01627","K01903","K01835","K00457","K00252","K00453","K00548","K00297","K12524","K00872","K01733","K03831","K03392","K01897","K01480","K00059","K00831","K00058","K00615","K00700","K08289","K01962","K01712","K11754","K01783","K01686","K00275","K01810","K00850","K00688","K00232","K00287","K12373","K00174","K00175","K00226","K03737","K01737","K01495","K01681","K00765","K00013","K00817","K02501","K01814","K02500","K11755","K00382","K01596","K00854","K15736","K00074","K00674","K01647","K01714","K12340","K01752","K00560","K07282","K01640","K01812","K00134","K00627","K00499","K00873","K02078","K09458","K01950","K03526","K02276","K02257","K02259","K02274","K02275","K04561","K00376","K01785","K00849","K03639","K03635","K03637","K03750","K21071","K00927","K13766","K02609","K02610","K02611","K02612","K01053","K02613","K01756","K01625","K00874","K01685","K00024","K13038","K00979","K00796","K00558","K01468","K01951","K15866","K00033","K00333","K00332","K00331","K00330","K00067","K00991","K02517","K02169","K00757","K01591","K00254","K03786","K00341","K00318","K01735","K00800","K08641","K00655","K06016","K00919","K00208","K00337","K00338","K00339","K00340","K00342","K00343","K00764","K00609","K01697","K01584","K07250","K04516","K04517","K04518","K00161","K00031","K00606","K06041","K01945","K07665","K00940","K01689","K01956","K01902","K00826","K01687","K01652","K01653","K00053","K01754","K02566","K01703","K01704","K00052","K01649","K00693","K00368","K00891","K00973","K03644","K00965","K01770","K11752","K00819","K01077","K03272","K00703","K00820","K01885","K01719","K03517","K02305","K00372","K03886","K00371","K00278","K01933","K00249","K05783","K13789","K03801","K15916","K00549","K01803","K03527","K01679","K03474","K02548","K01589","K01588","K15746","K01823","K15633","K00767","K03525","K05710","K00632","K07516","K00116","K00390","K01784","K00286","K01808","K00600","K00133","K00012","K00789","K01586","K03783","K00859","K01662","K01465","K02108","K02110","K02109","K02113","K02111","K02115","K00088","K00957","K00860","K02204","K01113","K17103","K01479","K00003","K00641","K00131","K01778","K01955","K01790","K01710","K00942","K00969","K00486","K01556","K00452","K09903","K01960","K03179","K11175","K00451","K00602","K01613","K00261","K00981","K01736","K01895","K00525","K00526","K01963","K11645","K00164","K00658","K01092","K00928","K17836","K02114","K02112","K00939","K01966","K05979","K00605","K00798","K02527","K03841","K03183","K01633","K05606","K01491","K03274","K00748","K01939","K01006","K03273","K01585","K00643","K01749","K01698","K15862","K00406","K00014","K08097","K00128","K00588","K03269","K01251","K01847","K00099")
query2 <- c(query1, "K00242")
mod <- module("M00011")
mod |> module_completeness(query1)
#> # A tibble: 5 × 5
#>   block                                       all_num present_num ratio complete
#>   <chr>                                         <int>       <int> <dbl> <lgl>   
#> 1 ((K00164+K00658,K01616)+K00382,K00174+K001…       8           5 0.625 TRUE    
#> 2 (K01902+K01903,K01899+K01900,K18118)              5           2 0.4   TRUE    
#> 3 (K00234+K00235+K00236+(K00237,K25801),K002…      15           3 0.2   TRUE    
#> 4 (K01676,K01679,K01677+K01678)                     4           1 0.25  TRUE    
#> 5 (K00026,K00025,K00024,K00116)                     4           2 0.5   TRUE
mod |> module_completeness(query2)
#> # A tibble: 5 × 5
#>   block                                       all_num present_num ratio complete
#>   <chr>                                         <int>       <int> <dbl> <lgl>   
#> 1 ((K00164+K00658,K01616)+K00382,K00174+K001…       8           5 0.625 TRUE    
#> 2 (K01902+K01903,K01899+K01900,K18118)              5           2 0.4   TRUE    
#> 3 (K00234+K00235+K00236+(K00237,K25801),K002…      15           4 0.267 TRUE    
#> 4 (K01676,K01679,K01677+K01678)                     4           1 0.25  TRUE    
#> 5 (K00026,K00025,K00024,K00116)                     4           2 0.5   TRUE

Created on 2024-04-18 with reprex v2.0.2

wangshiming commented 2 months ago

Thank you very much!