Exemple #1
0
    elif overall_min >= 0:
        colormap = cm.Reds

    norm = mpl.colors.SymLogNorm(linthresh=0.001,
                                 vmin=overall_min,
                                 vmax=overall_max,
                                 clip=True)
    mapper = cm.ScalarMappable(norm=norm, cmap=colormap)

    for data in datasets:
        # We can only use a single row at the moment, so process through fold change etc. first
        values = data.iloc[0]
        for n, v in enumerate(values):
            color = rgb2hex(mapper.to_rgba(v))
            if luminahex(color) < 0.5:
                contrast = "#FFFFFF"
            else:
                contrast = "#000000"

            node_colors[('PATHOMX%d' % id(data), n)] = (color, contrast)

        xref_syns = dict(xref_syns.items() + build_xref_list(data).items())

else:
    node_colors = None
    #for n, m in enumerate(dso.entities[1]):
    #    xref = self.get_xref(m)
    #    ecol = utils.calculate_rdbu9_color(scale, dso.data[0, n])
    #    #print xref, ecol
    #    if xref is not None and ecol is not None:
Exemple #2
0
        colormap = cm.Blues_r

    elif overall_min >= 0:
        colormap = cm.Reds

    norm = mpl.colors.SymLogNorm(linthresh=0.001, vmin=overall_min, vmax=overall_max, clip=True)
    mapper = cm.ScalarMappable(norm=norm, cmap=colormap)
    
    for data in datasets:
        ids = [e[ data.columns.names.index('BioCyc') ] for e in data.columns.values]
        # We can only use a single row at the moment, so process through fold change etc. first
        values = data.iloc[0]
        for e,v in zip(ids, values):
            if type(e) in [Gene, Compound, Protein]:
                hexcol = rgb2hex( mapper.to_rgba(v) )
                l = luminahex(hexcol)
                if l < 0.5:
                    contrasthexcol = '#ffffff'
                else:
                    contrasthexcol = '#000000'
                
                analysis[e] = (hexcol, contrasthexcol)

    print "Range %.2f..%.2f" % (overall_min, overall_max)
    
else:
    analysis = None


if suggested_pathways is not None:
    # Pathways should come in as a column set named 'BioCyc' but containing Pathway objects
Exemple #3
0
    norm = mpl.colors.SymLogNorm(linthresh=0.001,
                                 vmin=overall_min,
                                 vmax=overall_max,
                                 clip=True)
    mapper = cm.ScalarMappable(norm=norm, cmap=colormap)

    for data in datasets:
        ids = [
            e[data.columns.names.index('BioCyc')] for e in data.columns.values
        ]
        # We can only use a single row at the moment, so process through fold change etc. first
        values = data.iloc[0]
        for e, v in zip(ids, values):
            if type(e) in [Gene, Compound, Protein]:
                hexcol = rgb2hex(mapper.to_rgba(v))
                l = luminahex(hexcol)
                if l < 0.5:
                    contrasthexcol = '#ffffff'
                else:
                    contrasthexcol = '#000000'

                analysis[e] = (hexcol, contrasthexcol)

    print "Range %.2f..%.2f" % (overall_min, overall_max)

else:
    analysis = None

if suggested_pathways is not None:
    # Pathways should come in as a column set named 'BioCyc' but containing Pathway objects
    if 'BioCyc' in suggested_pathways.columns.names:
Exemple #4
0
        
    elif overall_min < 0:
        colormap = cm.Blues_r

    elif overall_min >= 0:
        colormap = cm.Reds

    norm = mpl.colors.SymLogNorm(linthresh=0.001, vmin=overall_min, vmax=overall_max, clip=True)
    mapper = cm.ScalarMappable(norm=norm, cmap=colormap)
    
    for data in datasets:
        # We can only use a single row at the moment, so process through fold change etc. first
        values = data.iloc[0]
        for n, v in enumerate(values):
            color = rgb2hex( mapper.to_rgba(v) )
            if luminahex(color) < 0.5:
                contrast = "#FFFFFF"
            else:
                contrast = "#000000"
                
            node_colors[('PATHOMX%d' % id(data) , n)] = (color, contrast)
            
        xref_syns = dict( xref_syns.items() + build_xref_list(data).items() )
                
else:
    node_colors = None
                        
    #for n, m in enumerate(dso.entities[1]):
    #    xref = self.get_xref(m)
    #    ecol = utils.calculate_rdbu9_color(scale, dso.data[0, n])
    #    #print xref, ecol