Skip to content

Commit

Permalink
Fix plotting bug related to the usage of a contact cutoff above the m…
Browse files Browse the repository at this point in the history
…aximum contact value of the heatmap
  • Loading branch information
rcalandrelli committed Feb 4, 2020
1 parent 4c2c8ce commit a2343c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
27 changes: 21 additions & 6 deletions scripts/HiCtool_global_map_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,24 +696,39 @@ def format_e(n):

if cutoff_type == 'percentile':
perc = np.percentile(output_vect[non_zero[0]],cutoff)
cutoff_flag = False
elif cutoff_type == 'contact':
perc = cutoff
if perc > np.max(matrix_data_full):
print "WARNING! The contact cutoff you have inserted is above the maximum value of the heatmap --> the colorbar will span the values 0-cutoff but the actual contacts on the heatmap will be below the cutoff. Please insert a cutoff below the maximum value " + str(np.max(matrix_data_full)) + " if you wish to put an upper contact cutoff."
cutoff_flag = True
else:
cutoff_flag = False

if cutoff_type != None:
if topological_domains != None:
if topological_domains_list[m_index] == '':
plt.imshow(matrix_data_full, cmap=my_cmap, interpolation='nearest', vmax=perc)
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
if cutoff_flag == False:
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
else:
cbar = plt.colorbar()
else:
plt.imshow(matrix_data_full, cmap=my_cmap, interpolation='nearest', vmax=perc, vmin=0)
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
if cutoff_flag == False:
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
else:
cbar = plt.colorbar()
cbar.cmap.set_under(domain_color)
else:
plt.imshow(matrix_data_full, cmap=my_cmap, interpolation='nearest', vmax=perc)
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
if cutoff_flag == False:
cbar = plt.colorbar(extend='max')
cbar.cmap.set_over(max_color)
else:
cbar = plt.colorbar()
else:
if topological_domains != None:
if topological_domains_list[m_index] == '':
Expand Down

0 comments on commit a2343c7

Please sign in to comment.