diff --git a/intervene_test/Enhancer_percentages.png b/intervene_test/Enhancer_percentages.png new file mode 100644 index 0000000000000000000000000000000000000000..a90fdab321f3941a01141c6c713e2377a307f3a0 Binary files /dev/null and b/intervene_test/Enhancer_percentages.png differ diff --git a/intervene_test/enhancer_percentages.py b/intervene_test/enhancer_percentages.py new file mode 100644 index 0000000000000000000000000000000000000000..c4b1048d6938e2bd5b0fcc5735b7b04eda33c965 --- /dev/null +++ b/intervene_test/enhancer_percentages.py @@ -0,0 +1,62 @@ +import pandas as pd +import matplotlib.pyplot as plt +import numpy as np + + +raw_data = {'Cell': ['H3K4me1', 'H3K27ac', 'GRO-seq'], + '1 method': [float((153327)),float((12510)),float((3754))], + '2 method': [float((55923)),float((55820)),float((611))], + '3 method': [float((609)),float((609)),float((609))]} + +df = pd.DataFrame(raw_data, columns = ['Cell', '1 method', '2 method', '3 method']) + +# Create a figure with a single subplot +f, ax = plt.subplots(1, figsize=(10,5)) + +# Set bar width at 1 +bar_width = 0.5 + +# positions of the left bar-boundaries +bar_l = [i for i in range(len(df['1 method']))] + +# positions of the x-axis ticks (center of the bars as bar labels) +tick_pos = [i+(bar_width/2) for i in bar_l] + +# Create the total enhancers +totals = [i+j+k for i,j,k in zip(df['1 method'], df['2 method'], df['3 method'])] + +# Create the percentage of the total unmarked enhancers value for each cell was +meth_1 = [i / float(j) * 100 for i,j in zip(df['1 method'], totals)] + +# Create the percentage of the total H3K4me1 alone enhancers value for each cell +meth_2 = [i / float(j) * 100 for i,j in zip(df['2 method'], totals)] + +# Create the percentage of the total H3K4me1+, H3K27ac+ enhancers value for each cell +meth_3 = [i / float(j) * 100 for i,j in zip(df['3 method'], totals)] + + +N = 3 +ind = np.arange(N) # the x locations for the groups +width = 0.5 # the width of the bars: can also be len(x) sequence + +p1 = plt.bar(ind, meth_1, width, color='#6DA2DB') +p2 = plt.bar(ind, meth_2, width, + bottom=meth_1,color='#D2D5D4') +p3 = plt.bar(ind, meth_3, width, + bottom=[i+j for i,j in zip(meth_1, meth_2)],color='#D52114') + +plt.ylabel('% total enhancers') +plt.title('Stage') +plt.xticks(ind, ('H3K4me1', 'H3K27ac', 'GRo-seq')) +plt.yticks(np.arange(0, 110, 10)) + +plt.savefig('Enhancer_percentages.png') +plt.clf() + +H3K27ac_enhancers=12510, +H3K27ac_enhancers&H3K4me1_enhancers=55566, +H3K4me1_enhancers=153327, +GRO-seq_enhancers&H3K27ac_enhancers&H3K4me1_enhancers=609, +GRO-seq_enhancers&H3K27ac_enhancers=254, +GRO-seq_enhancers=3754, +GRO-seq_enhancers&H3K4me1_enhancers=357