def __call__(self, track, slice=None): edir = EXPORTDIR method = "utr_extension" blocks = ResultBlocks() filepath = "%(edir)s/%(method)s/%(track)s.readextension_%(region)s_%(direction)s.%(slice)s.png" block = \ ''' .. figure:: %(filename)s :height: 300 ''' # append spaces for file extension block = "\n".join([x + " " * 200 for x in block.split("\n")]) for region, direction in itertools.product( ("downstream", "upstream"), ("sense", "antisense", "anysense")): filename = filepath % locals() if os.path.exists(filename): blocks.append( ResultBlock(text=block % locals(), title="%(track)s %(region)s %(direction)s" % locals())) # else: # blocks.append( ResultBlock( "", # title = "%(track)s %(region)s %(direction)s" % locals() ) ) return odict( (("rst", "\n".join(Utils.layoutBlocks(blocks, layout="columns-3"))), ))
def __call__(self, track, slice=None): # note there are spaces behind the %(image)s directive to accomodate # for path substitution block = ''' .. figure:: %(image)s :height: 300 ''' blocks = ResultBlocks() tracks = sorted([x.asFile() for x in TRACKS]) for track in tracks: files = glob.glob( os.path.join(EXPORTDIR, "fastqc", "%s*_fastqc" % track)) for x, fn in enumerate(sorted(files)): y = x + 1 image = os.path.abspath( os.path.join(fn, "Images", "%s.png" % slice)) if not os.path.exists(image): continue blocks.append( ResultBlock(text=block % locals(), title=os.path.basename(fn))) return odict( (("rst", "\n".join(Utils.layoutBlocks(blocks, layout="columns-2"))), ))
def __call__(self, data, path): colorbar, factors, unique, xkcd = self.getColorBar(data) n_samples = data.shape[0] data = data.iloc[:, :n_samples] col_dict = dict(list(zip(unique, xkcd))) print(data.head()) seaborn.set(font_scale=.5) ax = seaborn.clustermap(data, row_colors=colorbar, col_colors=colorbar) plt.setp(ax.ax_heatmap.yaxis.set_visible(False)) for label in unique: ax.ax_col_dendrogram.bar( 0, 0, color=seaborn.xkcd_rgb[col_dict[label]], label=label, linewidth=0) ax.ax_col_dendrogram.legend(loc="center", ncol=len(unique)) return ResultBlocks(ResultBlock( '''#$mpl %i$#\n''' % ax.cax.figure.number, title='ClusterMapPlot'))