Example #1
0
  def test_plot_enrichment(self):
    if not HAS_MPL or not HAS_PIL:
      return
    tab = Tab(['score', 'rmsd', 'classific'], 'ffb',
               score=[2.64,1.11,2.17,0.45,0.15,0.85,1.13,2.90,0.50,1.03,1.46,2.83,1.15,2.04,0.67,1.27,2.22,1.90,0.68,0.36,1.04,2.46,0.91,0.60],
               rmsd=[9.58,1.61,7.48,0.29,1.68,3.52,3.34,8.17,4.31,2.85,6.28,8.78,0.41,6.29,4.89,7.30,4.26,3.51,3.38,0.04,2.21,0.24,7.58,8.40],
               classific=[False,True,False,True,True,False,False,False,False,False,False,False,True,False,False,False,False,False,False,True,False,True,False,False])
 
    pl = tab.plot_enrichment(score_col='score', score_dir='-',
                            class_col='rmsd', class_cutoff=2.0,
                            class_dir='-',
                            save=os.path.join("tests/data","enrichment-out.png"))
    img1 = Image.open(os.path.join("tests/data","enrichment-out.png"))
Example #2
0
def create_test_table():
  '''
  creates a table with some test data
  
    first  second  third 
  ----------------------
    x            3     NA
    foo         NA  2.200
    NA           9  3.300

  '''
  tab = Tab()
  tab.add_col('first', 'string')
  tab.add_col('second', 'int')
  tab.add_col('third', 'float')
  tab.add_row(['x',3, None], overwrite=None)
  tab.add_row(['foo',None, 2.2], overwrite=None)
  tab.add_row([None,9, 3.3], overwrite=None)
  return tab