LinkageIO / Camoco

Camoco is a fully-fledged software package for building co-expression networks and analyzing the overlap interactions among genes.
MIT License
41 stars 32 forks source link

Ontology enrichment overwrites itself #61

Closed schae234 closed 6 years ago

schae234 commented 7 years ago

There is a bug in the ontology.enrichment function that, when you give it a list of terms (e.g. an ontology) the same label gets used for all of the significant terms enriched:

It should look like:

Out[51]: 
   bonferroni          id            label  num_common  num_sampled  num_terms  num_universe      pval                                               term  term_size  term_tested
0        True  GO:0000271    P31PlusZmRoot         3.0          6.0     3054.0       16953.0  0.000005                polysaccharide biosynthetic process      108.0         44.0
0        True  GO:0000271     P31PlusZmPAN         2.0          6.0     3054.0       16953.0  0.000593                polysaccharide biosynthetic process      108.0         63.0
0        True  GO:0000271     P31PlusZmSAM         2.0          6.0     3054.0       16953.0  0.000593                polysaccharide biosynthetic process      108.0         50.0

But when returned as not a table it looks like:

In [46]: [(t.id,t.attrs['hyper']) for t in x]
Out[46]: 
[('GO:0000271',
  OrderedDict([('pval', 0.00059317015952030892),
               ('term_tested', 50),
               ('num_common', 2),
               ('num_universe', 16953),
               ('term_size', 108),
               ('num_terms', 3054),
               ('num_sampled', 6),
               ('bonferroni', True)])),
 ('GO:0000271',
  OrderedDict([('pval', 0.00059317015952030892),
               ('term_tested', 50),
               ('num_common', 2),
               ('num_universe', 16953),
               ('term_size', 108),
               ('num_terms', 3054),
               ('num_sampled', 6),
               ('bonferroni', True)])),
 ('GO:0000271',
  OrderedDict([('pval', 0.00059317015952030892),
               ('term_tested', 50),
               ('num_common', 2),
               ('num_universe', 16953),
               ('term_size', 108),
               ('num_terms', 3054),
               ('num_sampled', 6),
               ('bonferroni', True)])),
 ('GO:0000786',
  OrderedDict([('pval', 8.0189815111004464e-05),
               ('term_tested', 280),
               ('num_common', 7),
               ('num_universe', 16953),
               ('term_size', 151),
               ('num_terms', 3054),
               ('num_sampled', 116),
               ('bonferroni', True)])),
schae234 commented 7 years ago

A regression test needs to be added for this.