# HG changeset patch # User rnateam # Date 1490474195 14400 # Node ID a85e3675e50da60aecf90ccdf1ea499cd1ec06c5 # Parent bfae792ea7f1d8b4e7fa399476ab117cf3e7db27 planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/master/tools/GraphClust/Plotting commit 4dd7269185f6fb9bdc007028007d6540f4cf057d diff -r bfae792ea7f1 -r a85e3675e50d MotifFinderPlot.py --- a/MotifFinderPlot.py Mon Mar 13 17:57:19 2017 -0400 +++ b/MotifFinderPlot.py Sat Mar 25 16:36:35 2017 -0400 @@ -9,7 +9,7 @@ import pandas as pd import itertools import seaborn as sns - +import numpy as np def plot_bar(ranges, colors, orig_names, cluster_nums): fig, ax = plt.subplots() @@ -18,12 +18,13 @@ ax.set_xlim(0) ax.set_xlabel('position in sequence') + ax.set_yticks(np.arange(-1, len(ranges))) ax.set_yticklabels(['']+[k+'-'+orig_names[k] for k in sorted(ranges.keys())]) ax.grid(True) fig.suptitle('Structure motif prediction\nRegions with same color are prediticted to have similar structures') # Add the legend patches = [mpatches.Patch(color=cluster_nums[lab], label=lab) for lab in sorted(cluster_nums)] - ax.legend(handles=patches, loc='best') # , bbox_to_anchor=(1, 0.5), loc='center left') + ax.legend(handles=patches, loc='best', bbox_to_anchor=(1.2, 1.05))#, loc='center left') plt.savefig("motif_plot.png", bbox_inches='tight') @@ -31,13 +32,12 @@ currentdir_files = sorted(list(glob.glob('*'))) print ("currentdir_files are: ", currentdir_files) print ("RESULTS_files are: ", sorted(list(glob.glob('RESULTS/*')))) - + cluster_files = sorted(list(glob.glob('RESULTS/*.cluster.all'))) if len(cluster_files) == 0: raise RuntimeError('Expected cluster.all search path is empty:{}'.format(cluster_files)) palette = itertools.cycle(sns.color_palette("Set2", len(cluster_files))) - ranges = defaultdict(list) colors = defaultdict(list) orig_names = defaultdict(list)