diff --git a/doc/plotting-compare.ipynb b/doc/plotting-compare.ipynb index 40e6e520ad..b8a985ee91 100644 --- a/doc/plotting-compare.ipynb +++ b/doc/plotting-compare.ipynb @@ -51,70 +51,22 @@ "name": "stdout", "output_type": "stream", "text": [ - "\r", - "\u001b[K\r\n", - "== This is sourmash version 4.8.2. ==\r\n", - "\r", - "\u001b[K== Please cite Brown and Irber (2016), doi:10.21105/joss.00027. ==\r\n", - "\r\n", - "\r", - "\u001b[Kloading '../tests/test-data/demo/SRR2060939_1.sig'\r", - "\r", - "\u001b[KLoaded 1 sigs from '../tests/test-data/demo/SRR2060939_1.sig'\r", - "\r", - "\u001b[Kloading '../tests/test-data/demo/SRR2060939_2.sig'\r", - "\r", - "\u001b[K<<" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "_ = plot_composite_matrix(matrix, labels, show_labels=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAzsAAAICCAYAAADoLdP+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAkMklEQVR4nO3df2xW930v8M95DLYhiekaFAcal5I11VBRu8leVchQf6xzLu2ytGsVpFyFNoGpzF0iwtKtlGlQbjS2tUMsayCNEsqym1UsTVMlV75ZvDs1oSO9Ggx2pwVpP5Ibk8SUC6tmEgjG5tw/HNgMTuKHnIfj8/XrZZ0/fDjP93yMeOD58P5+vyfL8zwPAACAxNTKLgAAAKARNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAECSNDsAAEBDPf3003H99dfH3LlzI8uy+P73v/+Wr3nqqaeis7MzWltb4+qrr45777237vtqdgAAgIZ69dVX44Mf/GB885vfnND1zz//fHzyk5+MJU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QAASJxkBwAAICGaHQAASFyWZYUf9dq6dWvMnz8/Wltbo7OzM3bt2vWm1588eTLWrVsX8+bNi5aWlvjpn/7p2L59e133NI0NAABoqJ07d8bq1atj69atce2118a3vvWtWLp0aTz77LPx7ne/e9zX3HjjjfHjH/84HnjggXjve98bhw8fjuHh4bruq9kBAIDElb1mZ/PmzbFixYpYuXJlRERs2bIl/vIv/zK2bdsWmzZtOu/6J554Ip566ql47rnn4p3vfGdERLznPe+pu07T2AAAgAsyODg45jh58uR51wwNDcXevXuju7t7zPnu7u7YvXv3uOM+9thj0dXVFX/4h38Y73rXu+J973tf3HnnnXHixIm66pPsAABA4hqV7HR0dIw5v379+tiwYcOYc0eOHImRkZFob28fc769vT0OHTo07vjPPfdc/PCHP4zW1tZ49NFH48iRI9HT0xP/9m//Vte6Hc0OAABwQQ4ePBhtbW1nv29paXnDa8/d1CDP8zfc6OD06dORZVk89NBDMWvWrIgYnQr3uc99Lu65556YMWPGhOrT7AAAQOpqEVmRC1heH6utrW1MszOe2bNnR1NT03kpzuHDh89Le86YM2dOvOtd7zrb6ERELFiwIPI8jxdffDGuueaaesoEAAAoXnNzc3R2dkZfX9+Y8319fbF48eJxX3PttdfGyy+/HK+88srZc//0T/8UtVotrrrqqgnfW7MDAACJO7Nmp8ijHmvWrIn7778/tm/fHgcOHIg77rgj+vv7Y9WqVRERsXbt2li+fPnZ62+66aa4/PLL45Zbbolnn302nn766fjyl78ct95664SnsEWYxgYAAMmrZaNHUfI6x1q2bFkcPXo0Nm7cGAMDA7Fw4cLo7e2NefPmRUTEwMBA9Pf3n73+0ksvjb6+vrjtttuiq6srLr/88rjxxhvjrrvuquu+mh0AAKDhenp6oqenZ9xf27Fjx3nnfuZnfua8qW/10uwAAEDiyn6oaFms2QEAAJIk2QEAgMRJdgAAABIi2QEAgMRlWRZZgXFMkWM1UuWbneNDI2WX0BDHT41Efnp6ZLVTZZcCAACVVPlmp+uuvyq7hAb6b3HZgq+UXQQAABWX1UaPIsergko2Oz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uXJlLFiwILZs2RIdHR2xbdu2ca+/9957493vfnds2bIlFixYECtXroxbb701vvGNb9R1X80OAAAkLmvA10QNDQ3F3r17o7u7e8z57u7u2L1797iveeaZZ867/rrrros9e/bEqVOnJnzvCW1QkOd5REQMDg5OeGDgwpx5n5153zXamfv8y4+2RFtb20W5J6TMP5VAo13IZ4XBwVcKruGVMbWc0dLSEi0tLWPOHTlyJEZGRqK9vX3M+fb29jh06NC44x86dGjc64eHh+PIkSMxZ86cCdU5oWbn2LFjERHR0dExoUGBt+/YsWMxa9asi3KfCO9vAKiaiXxWaG5ujiuvvDI6Oj5S+P0vvfTS8z4/rF+/PjZs2DDu9efu4Jbn+Zvu6jbe9eOdfzMTanbmzp0bBw8ejMsuu6wy28xBVeV5HseOHYu5c+delPt5fwNAtdTzWaG1tTWef/75GBoaakgd5352ODfViYiYPXt2NDU1nZfiHD58+Lz05owrr7xy3OunTZsWl19++YRrnFCzU6vV4qqrrprwoMDbczESnTO8vwGgeur5rNDa2hqtra0NrObNNTc3R2dnZ/T19cVnPvOZs+f7+vrihhtuGPc1ixYtiscff3zMuSeffDK6urpi+vTpE763DQoAAICGWrNmTdx///2xffv2OHDgQNxxxx3R398fq1atioiItWvXxvLly89ev2rVqnjhhRdizZo1ceDAgdi+fXs88MADceedd9Z13wklOwAAABdq2bJlcfTo0di4cWMMDAzEwoULo7e3N+bNmxcREQMDA2OeuTN//vzo7e2NO+64I+65556YO3du3H333fHZz362rvtm+cXa8gkAAOAiMo0NAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABIkmYHAABI0v8H83+AeGM+r7YAAAAASUVORK5CYII=", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "_ = plot_composite_matrix(matrix, labels, show_labels=False, show_indices=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/src/sourmash/cli/plot.py b/src/sourmash/cli/plot.py index 11c0b45f04..0156d0f640 100644 --- a/src/sourmash/cli/plot.py +++ b/src/sourmash/cli/plot.py @@ -10,16 +10,24 @@ def subparser(subparsers): help='output PDF; default is PNG' ) subparser.add_argument( - '--labels', action='store_true', + '--labels', action='store_true', default=False, help='show sample labels on dendrogram/matrix' ) + subparser.add_argument( + '--no-labels', action='store_false', dest='labels', + help='do not show sample labels' + ) subparser.add_argument( '--labeltext', - help='filename containing list of labels (overrides signature names)' + help='filename containing list of labels (overrides signature names); implies --labels' + ) + subparser.add_argument( + '--indices', action='store_true', default=True, + help='show sample indices but not labels; overridden by --labels' ) subparser.add_argument( - '--indices', action='store_false', - help='show sample indices but not labels' + '--no-indices', action='store_false', dest='indices', + help='do not show sample indices' ) subparser.add_argument( '--vmin', default=0.0, type=float, diff --git a/src/sourmash/commands.py b/src/sourmash/commands.py index cc2b4e5f26..94d8508391 100644 --- a/src/sourmash/commands.py +++ b/src/sourmash/commands.py @@ -246,20 +246,33 @@ def plot(args): # load files D_filename = args.distances - labelfilename = D_filename + '.labels.txt' notify(f'loading comparison matrix from {D_filename}...') D = numpy.load(open(D_filename, 'rb')) # not sure how to change this to use f-strings notify('...got {} x {} matrix.', *D.shape) - if args.labeltext: - labelfilename = args.labeltext - notify(f'loading labels from {labelfilename}') - labeltext = [ x.strip() for x in open(labelfilename) ] - if len(labeltext) != D.shape[0]: - error('{} labels != matrix size, exiting', len(labeltext)) - sys.exit(-1) + if args.labels or args.labeltext: + args.labels = True + if args.labeltext: + labelfilename = args.labeltext + else: + labelfilename = D_filename + '.labels.txt' + + notify(f'loading labels from {labelfilename}') + labeltext = [ x.strip() for x in open(labelfilename) ] + + if len(labeltext) != D.shape[0]: + error('{} labels != matrix size, exiting', len(labeltext)) + sys.exit(-1) + elif args.indices: + # construct integer labels + labeltext = [str(i) for i in range(D.shape[0])] + args.labels = True + else: + assert not args.labels + assert not args.indices + assert not args.labeltext # build filenames, decide on PDF/PNG output dendrogram_out = os.path.basename(D_filename) + '.dendro' @@ -300,6 +313,8 @@ def plot(args): ax1.set_xticks([]) ax1.set_yticks([]) + + # subsample? if args.subsample: numpy.random.seed(args.subsample_seed) @@ -321,7 +336,6 @@ def plot(args): ### make the dendrogram+matrix: (fig, rlabels, rmat) = sourmash_fig.plot_composite_matrix(D, labeltext, show_labels=args.labels, - show_indices=args.indices, vmin=args.vmin, vmax=args.vmax, force=args.force) diff --git a/src/sourmash/fig.py b/src/sourmash/fig.py index 039c4ea07e..4454ef64d9 100644 --- a/src/sourmash/fig.py +++ b/src/sourmash/fig.py @@ -1,6 +1,6 @@ #! /usr/bin/env python """ -Make plots using the distance matrix+labels output by ``sourmash compare``. +Make plots using the distance matrix+labels output by `sourmash compare`. """ from .logging import error, notify try: @@ -20,11 +20,15 @@ def load_matrix_and_labels(basefile): return (D, labeltext) -def plot_composite_matrix(D, labeltext, show_labels=True, show_indices=True, +def plot_composite_matrix(D, labeltext, show_labels=True, vmax=1.0, vmin=0.0, force=False): """Build a composite plot showing dendrogram + distance matrix/heatmap. - Returns a matplotlib figure.""" + Returns a matplotlib figure. + + If show_labels is True, display labels. Otherwise, no labels are + shown on the plot. + """ if D.max() > 1.0 or D.min() < 0.0: error('This matrix doesn\'t look like a distance matrix - min value {}, max value {}', D.min(), D.max()) if not force: @@ -43,12 +47,8 @@ def plot_composite_matrix(D, labeltext, show_labels=True, show_indices=True, # plot dendrogram Y = sch.linkage(D, method='single') # centroid - dendrolabels = labeltext - if not show_labels: - dendrolabels = [str(i) for i in range(len(labeltext))] - - Z1 = sch.dendrogram(Y, orientation='left', labels=dendrolabels, - no_labels=not show_indices, get_leaves=True) + Z1 = sch.dendrogram(Y, orientation='left', labels=labeltext, + no_labels=not show_labels, get_leaves=True) ax1.set_xticks([]) xstart = 0.45