Skip to content

Commit d6c7fc4

Browse files
author
Dominik R Laetsch
committed
Preparation for submission
1 parent 65d2e37 commit d6c7fc4

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

scripts/plot_cluster_size_distribution.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def yield_counts_by_proteome_count(self, count_type):
108108
self.proteome_counts_by_colour[colour].append(proteome_count)
109109
if count_type == "absolute":
110110
y = [self.counts_by_cluster_size_by_proteome_counts[proteome_count][cluster_size] + y_b for cluster_size, y_b in zip(sorted(self.counts_by_cluster_size_by_proteome_counts[proteome_count]), y_bottom)]
111+
#filled = self.interpolate_gaps(y, 1)
111112
yield proteome_count, x, y, y_bottom, colour
113+
#y_bottom = [_y if _y >= 1 else 0.01 for _y in y]
112114
y_bottom = y
113115
elif count_type == "relative":
114116
y = [self.counts_by_cluster_size_by_proteome_counts[proteome_count][cluster_size] for cluster_size in sorted(self.counts_by_cluster_size_by_proteome_counts[proteome_count])]
@@ -131,10 +133,10 @@ def plot_cluster_sizes(self, plot_type):
131133
print "[+] Plotting \"%s\" ..." % (plot_type)
132134
if plot_type in PLOTS:
133135
if plot_type == "loglog" or plot_type == "loglin" or plot_type == "loglogpowerlaw":
134-
ax.set_yscale('log')
135136
for proteome_count, x, y, y_bottom, colour in self.yield_counts_by_proteome_count('absolute'):
136137
ax.plot(x, y, c='None')
137-
ax.fill_between(x, y, y_bottom, facecolor=colour)
138+
mask = np.where(y >= 1, y, "nan")
139+
ax.fill_between(x, y, y_bottom, facecolor=colour, interpolate = True, where = mask)
138140
progress(proteome_count, 1, self.proteome_count_max)
139141
ax.plot
140142
elif plot_type == "logbar":
@@ -185,9 +187,9 @@ def plot_cluster_sizes(self, plot_type):
185187
else:
186188
out_f = "%s.loglogpowerlaw.%s" % (self.out_prefix, self.plot_fmt)
187189
#ax.legend()
188-
plt.gca().set_ylim(bottom=0.8, top=self.cluster_count_max * 2)
190+
plt.gca().set_ylim(bottom=0.9, top=self.cluster_count_max * 2)
189191
plt.gca().set_xlim(left=0.8, right=self.cluster_size_max * 2)
190-
ax.set_yscale('log')
192+
ax.set_yscale('symlog', linthreshy=1.0)
191193
ax.set_xscale('log')
192194
legend_handles = []
193195
for colour, proteomes in self.proteome_counts_by_colour.items():
@@ -197,7 +199,7 @@ def plot_cluster_sizes(self, plot_type):
197199
legend_handles.append(mpatches.Patch(label="%s" % (proteomes[0]), color=colour))
198200
legend = ax.legend(handles=legend_handles, ncol=2, loc='best', numpoints=1, frameon=True, title="Number of proteomes in cluster")
199201
legend.get_frame().set_facecolor('white')
200-
plt.margins(0.8)
202+
plt.margins(1)
201203
ax.xaxis.set_major_formatter(FormatStrFormatter('%.0f'))
202204
ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
203205
ax.grid(True, linewidth=0.5, which="minor", color="lightgrey")
@@ -227,9 +229,9 @@ def plot_cluster_sizes(self, plot_type):
227229
print "[+] Start ..."
228230
dataObj = DataObj(out_prefix, plot_fmt, cmap, xlim)
229231
dataObj.parse_data(input_f)
230-
dataObj.plot_cluster_sizes('loglog')
231-
dataObj.plot_cluster_sizes('loglin')
232-
dataObj.plot_cluster_sizes('logbar')
233-
dataObj.plot_cluster_sizes('barperc')
234-
dataObj.plot_cluster_sizes('powerlaw')
232+
#dataObj.plot_cluster_sizes('loglog')
233+
#dataObj.plot_cluster_sizes('loglin')
234+
#dataObj.plot_cluster_sizes('logbar')
235+
#dataObj.plot_cluster_sizes('barperc')
236+
#dataObj.plot_cluster_sizes('powerlaw')
235237
dataObj.plot_cluster_sizes('loglogpowerlaw')

src/kinfin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def get_header_line(self, filetype, attribute):
802802
cluster_1to1s_ALO_header = []
803803
cluster_1to1s_ALO_header.append("#cluster_id")
804804
cluster_1to1s_ALO_header.append("cluster_type")
805-
cluster_1to1s_ALO_header.append("cardinality")
805+
cluster_1to1s_ALO_header.append("1to1_type")
806806
cluster_1to1s_ALO_header.append("proteome_count")
807807
cluster_1to1s_ALO_header.append("percentage_at_target_count")
808808
return "\t".join(cluster_1to1s_ALO_header)
@@ -1555,10 +1555,10 @@ def write_tree(self):
15551555
node_stats_f = join(dataFactory.dirs['tree'], "tree.node_metrics.txt")
15561556
node_stats_header = []
15571557
node_stats_header.append('#nodeID')
1558-
node_stats_header.append('taxon_specific_apomorphies_[singletons]')
1559-
node_stats_header.append('taxon_specific_apomorphies (non-singletons)')
1558+
node_stats_header.append('taxon_specific_apomorphies_singletons')
1559+
node_stats_header.append('taxon_specific_apomorphies_non_singletons')
15601560
node_stats_header.append('node_specific_synapomorphies_total')
1561-
node_stats_header.append('node_specific_synapomorphies_all')
1561+
node_stats_header.append('node_specific_synapomorphies_complete_presence')
15621562
node_stats_header.append('node_specific_synapomorphies_partial_absence')
15631563
node_stats_header.append('proteome_count')
15641564
node_stats = []
@@ -2282,7 +2282,7 @@ def welcome_screen():
22822282

22832283

22842284
if __name__ == "__main__":
2285-
__version__ = "0.9"
2285+
__version__ = "1.0"
22862286
welcome_screen()
22872287
args = docopt(__doc__)
22882288
inputObj = InputObj(args)

0 commit comments

Comments
 (0)