Esempio n. 1
0
def venn2_unweighted(subsets,
                     set_labels=('A', 'B'),
                     set_colors=('r', 'g'),
                     alpha=0.4,
                     normalize_to=1.0,
                     subset_areas=(1, 1, 1),
                     ax=None):
    '''
    The version of venn2 without area-weighting.
    It is implemented as a wrapper around venn2. Namely, venn2 is invoked as usual, but with all subset areas
    set to 1. The subset labels are then replaced in the resulting diagram with the provided subset sizes.
    
    The parameters are all the same as that of venn2.
    In addition there is a subset_areas parameter, which specifies the actual subset areas.
    (it is (1, 1, 1) by default. You are free to change it, within reason).
    '''
    v = venn2(subset_areas, set_labels, set_colors, alpha, normalize_to, ax)
    # Now rename the labels
    subset_ids = ['10', '01', '11']
    if isinstance(subsets, dict):
        subsets = [subsets.get(t, 0) for t in subset_ids]
    elif len(subsets) == 2:
        subsets = compute_venn2_subsets(*subsets)
    for n, id in enumerate(subset_ids):
        lbl = v.get_label_by_id(id)
        if lbl is not None:
            lbl.set_text(str(subsets[n]))
    return v
Esempio n. 2
0
def venn2_unweighted(subsets, set_labels=('A', 'B'), set_colors=('r', 'g'), alpha=0.4, normalize_to=1.0, subset_areas=(1, 1, 1), ax=None):
    '''
    The version of venn2 without area-weighting.
    It is implemented as a wrapper around venn2. Namely, venn2 is invoked as usual, but with all subset areas
    set to 1. The subset labels are then replaced in the resulting diagram with the provided subset sizes.
    
    The parameters are all the same as that of venn2.
    In addition there is a subset_areas parameter, which specifies the actual subset areas.
    (it is (1, 1, 1) by default. You are free to change it, within reason).
    '''
    v = venn2(subset_areas, set_labels, set_colors, alpha, normalize_to, ax)
    # Now rename the labels
    subset_ids = ['10', '01', '11']
    if isinstance(subsets, dict):
        subsets = [subsets.get(t, 0) for t in subset_ids]
    elif len(subsets) == 2:
        subsets = compute_venn2_subsets(*subsets)
    for n, id in enumerate(subset_ids):
        lbl = v.get_label_by_id(id)
        if lbl is not None:
            lbl.set_text(str(subsets[n]))
    return v
Esempio n. 3
0
from matplotlib_venn._venn2 import venn2

with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/411ActiveSIDList') as f:
    set411 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/1006ActiveSIDList') as f:
    set1006 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/588342ActiveSIDList') as f:
    set588342 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/411SIDList') as f:
    setAll411 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/1006SIDList') as f:
    setAll1006 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/588342SIDList') as f:
    setAll588342 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/588342_inconclusive') as f:
    setinconc588342 = set(f.read().splitlines())
with open('/Users/dghosh/Desktop/FreqHitterProject/Luciferase/DataMining/PubChem/SIDLists/588342_activeAt11_5um_SID') as f:
    set588342Activeat11um = set(f.read().splitlines())
    
inactive1006 = setAll1006 - set1006
inactive588342 = setAll588342 - (set588342Activeat11um|setinconc588342)
set588342Activeat11um = set588342Activeat11um - setinconc588342
#newin588342 = inactive1006 & set588342
#print len(newin588342)
venn3([inactive588342, inactive1006, set588342Activeat11um], ('Inactive in 588342', 'Inactive in 1006', 'Active in 588342'))
plt.show()
venn2([set1006, set588342Activeat11um], ('active in 1006', 'Active in 588342'))
plt.show()
plt.savefig('/Users/dghosh/Desktop/gained.png')