def databox(raw, which, outname=None, group=None, args=None):
    palette_up = {}
    palette_down = {}
    up = []
    down = []
    group1_data = raw[list(group.values())[0]]
    group1 = list(group.keys())[0]
    group2_data = raw[list(group.values())[1]]
    group2 = list(group.keys())[1]
    for gene in raw.index:
        if ((group1_data.ix[gene].sum() - group2_data.ix[gene].sum()) >= 0):
            up.append(gene)
            palette_up[group1] = 'red'
            palette_up[group2] = 'blue'
        else:
            down.append(gene)
            palette_down[group1] = 'blue'
            palette_down[group2] = 'red'
    if (len(palette_up) > 0):
        for i in up:
            plot_box(raw.ix[i], which, i, palette_up, 'up', group, args=args)
    if (len(palette_down) > 0):
        for i in down:
            plot_box(raw.ix[i], which, i, palette_down, 'down', group, args=args)
def databox(raw, which, outname=None, group=None, args=None):
    palette_up = {}
    palette_down = {}
    up = []
    down = []
    group1_data = raw[list(group.values())[0]]
    group1 = list(group.keys())[0]
    group2_data = raw[list(group.values())[1]]
    group2 = list(group.keys())[1]
    for gene in raw.index:
        if ((group1_data.ix[gene].sum() - group2_data.ix[gene].sum()) >= 0):
            up.append(gene)
            palette_up[group1] = 'red'
            palette_up[group2] = 'blue'
        else:
            down.append(gene)
            palette_down[group1] = 'blue'
            palette_down[group2] = 'red'
    if (len(palette_up) > 0):
        for i in up:
            plot_box(raw.ix[i], which, i, palette_up, 'up', group, args=args)
    if (len(palette_down) > 0):
        for i in down:
            plot_box(raw.ix[i], which, i, palette_down, 'down', group, args=args)