changeset 22:5e650e66e058 draft

planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
author mheinzl
date Tue, 21 May 2019 08:17:02 -0400
parents 89ddbe5ae2aa
children 5ae4fd1d4a12
files fsd.py
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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))