Commit 93dfc085 authored by María Morales Martínez's avatar María Morales Martínez
Browse files

small fixes

parent 3aef3522
......@@ -14,10 +14,6 @@ target_category = sys.argv[2]
target_bed = sys.argv[3]
marks_dataset = sys.argv[4]
# cell_type = "H1-hESC"
# target_category = "nre"
# target_bed = "hg38_NRE_filt5"
# marks_dataset = "Encode"
# Statistical test
Test = 'mannwhitneyu'
......@@ -174,6 +170,13 @@ for m in marks:
dfMarks = pd.DataFrame.from_dict(dicMarks, orient = 'index')
dfMarks.columns = columns
# Order Marks
orderMarks = []
for num, what in enumerate(['Acethylation', 'Methylation'], 1):
orderMarks.extend(sorted([m for m in dicMarks.keys() if what[:2].lower() in m]))
dfMarks = dfMarks.reindex(orderMarks)
# Save statistic tab
tab_result = os.path.join(target_dir, marks_dataset + "_results", 'statistics', 'test')
......@@ -200,7 +203,7 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
y = np.mean(NormData[m][order[-1]])
if target_category == 'genes':
y2 = 0.05 + 0.8 * n / len(these_marks)
plt.ylim(0, 0.8)
plt.ylim(0, 0.9)
else:
y2 = 0.05 + 7 * n / len(these_marks)
#plt.ylim(0, 6)
......@@ -215,9 +218,11 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
#plt.title(what)
#plt.xlabel(what,fontsize=12)
if target_category == "genes":
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=12)
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=12, labelpad=10)
else:
plt.ylabel('Normalized histone marks per length of RIs',fontsize=12)
plt.ylabel('Normalized histone marks per length of RIs',fontsize=12, labelpad=10)
plt.xlabel('Division of compartments in the nucleus',fontsize=12, labelpad=10)
axe.xaxis.set_label_coords(0.32,-0.2)
#fig.suptitle('test title', fontsize=20)
axe.spines['right'].set_visible(False)
axe.spines['top'].set_visible(False)
......@@ -229,7 +234,7 @@ if not os.path.exists(plot_path):
os.makedirs(plot_path)
print("Generating general plot")
plt.savefig(os.path.join(plot_path, 'normalized_marks.png'))
plt.savefig(os.path.join(plot_path, 'normalized_marks.png'), dpi=300)
plt.close()
......@@ -259,9 +264,10 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
plt.plot([0, len(order) - 1], [0] * 2, 'k-')
plt.title(str(what + "("+ m +")"))
if target_category == "genes":
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=12)
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=14, labelpad=10)
else:
plt.ylabel('Normalized histone marks per length of RIs',fontsize=12)
plt.ylabel('Normalized histone marks per length of RIs',fontsize=14 , labelpad=10)
plt.xlabel('Division of compartments in the nucleus',fontsize=14, labelpad=10)
axe.spines['right'].set_visible(False)
axe.spines['top'].set_visible(False)
axe.spines['bottom'].set_visible(False)
......@@ -269,6 +275,6 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
plt.tight_layout()
print("Generating plot: " + m)
plt.savefig(os.path.join(plot_path, m + '.png'))
plt.savefig(os.path.join(plot_path, m + '.png'), dpi=300)
plt.close()
print("Process finished")
......@@ -200,7 +200,7 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
y = np.mean(NormData[m][order[-1]])
if target_category == 'genes':
y2 = 0.05 + 0.8 * n / len(these_marks)
plt.ylim(0, 0.8)
plt.ylim(0, 0.9)
else:
y2 = 0.05 + 7 * n / len(these_marks)
#plt.ylim(0, 6)
......@@ -218,6 +218,8 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=12)
else:
plt.ylabel('Normalized histone marks per length of RIs',fontsize=12)
plt.xlabel('Division of compartments in the nucleus',fontsize=12, labelpad=10)
axe.xaxis.set_label_coords(0.32,-0.2)
#fig.suptitle('test title', fontsize=20)
axe.spines['right'].set_visible(False)
axe.spines['top'].set_visible(False)
......@@ -262,6 +264,7 @@ for num, what in enumerate(['Acethylation', 'Methylation'], 1):
plt.ylabel('Normalized histone marks per CAGE-seq read',fontsize=12)
else:
plt.ylabel('Normalized histone marks per length of RIs',fontsize=12)
plt.xlabel('Division of compartments in the nucleus',fontsize=12, labelpad=10)
axe.spines['right'].set_visible(False)
axe.spines['top'].set_visible(False)
axe.spines['bottom'].set_visible(False)
......
......@@ -13,11 +13,6 @@ marks_list = config["marks_list"]
LAD_bed = config["LAD_bed"]
# If it is the first analysis for a dataset
sel_marks = os.path.join(selpath, marks_dataset)
if not os.path.exists(sel_marks):
os.makedirs(sel_marks)
# Paths
listpath = os.path.join(marklistspath, marks_list)
sourcemarkspath = os.path.join(allpath, cell_type, marks_dataset)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment