# HG changeset patch # User mheinzl # Date 1558441022 14400 # Node ID 5e650e66e058fca2b4f80ba263710251f12b1ef0 # Parent 89ddbe5ae2aa292456fe04c700330de09654914a planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty diff -r 89ddbe5ae2aa -r 5e650e66e058 fsd.py --- a/fsd.py Wed May 08 07:21:18 2019 -0400 +++ b/fsd.py Tue May 21 08:17:02 2019 -0400 @@ -330,13 +330,18 @@ reads_rel.append(list(numpy.float_(y)) / sum(y)) x = list(numpy.arange(numpy.amin(unique), numpy.amax(unique) + 1).astype(float)) - x = [xi + barWidth for xi in x] + if len(list_to_plot2) == 1: + x = [xi * 0.5 for xi in x] + w = 0.4 + else: + x = [xi + barWidth for xi in x] + w = 1./(len(list_to_plot) + 1) if to_plot[l] == "Relative frequencies": - counts2_rel = ax.bar(x, list(numpy.float_(y)) / sum(y), align="edge", width=1./(len(list_to_plot) + 1), + counts2_rel = ax.bar(x, list(numpy.float_(y)) / sum(y), align="edge", width=w, edgecolor="black", label=label[i], alpha=0.8, linewidth=1, color=colors[i]) else: - counts2 = ax.bar(x, y, align="edge", width=1./(len(list_to_plot) + 1), edgecolor="black", label=label[i], + counts2 = ax.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], alpha=0.8, linewidth=1, color=colors[i]) if i == len(list_to_plot2): barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1) @@ -348,7 +353,10 @@ else: ax.set_xlabel("Family size", fontsize=14) - ax.set_xticks(numpy.array(ticks)) + if len(list_to_plot2) == 1: + ax.set_xticks(numpy.array([xi + 0.2 for xi in x])) + else: + ax.set_xticks(numpy.array(ticks)) ax.set_xticklabels(ticks1) ax.set_ylabel(to_plot[l], fontsize=14) if log_axis: @@ -410,7 +418,7 @@ j += 1 output_file.write("sum{}".format(sep)) if len(label) == 1: - output_file.write("{}{}".format(int(sum(reads)), sep)) + output_file.write("{}{}".format(int(sum(numpy.concatenate(reads))), sep)) else: for i in reads: output_file.write("{}{}".format(int(sum(i)), sep))