# HG changeset patch # User rnateam # Date 1490475189 14400 # Node ID adf18db4c14ab8f606d7718c6b00bb9ccbe96014 # Parent edcf58ab7552528e54160f7b5266166797890d05 planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/master/tools/GraphClust/Plotting commit 4dd7269185f6fb9bdc007028007d6540f4cf057d diff -r edcf58ab7552 -r adf18db4c14a MotifFinderPlot.py --- a/MotifFinderPlot.py Wed Feb 22 16:53:29 2017 -0500 +++ b/MotifFinderPlot.py Sat Mar 25 16:53:09 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)