Tweak last-dotplot's documentation
authorMartin C. Frith
Tue May 02 13:18:23 2017 +0900 (2017-05-02)
changeset 850db0ddc92f2ec
parent 849 cb934e010567
child 851 5b2acb7fdb3e
Tweak last-dotplot's documentation
doc/last-dotplot.txt
scripts/last-dotplot
     1.1 --- a/doc/last-dotplot.txt	Tue Apr 18 17:24:44 2017 +0900
     1.2 +++ b/doc/last-dotplot.txt	Tue May 02 13:18:23 2017 +0900
     1.3 @@ -27,10 +27,10 @@
     1.4  
     1.5    last-dotplot -1 'chr[!U]*' -2 'chr[!U]*' alns alns.png
     1.6  
     1.7 -Option "-1" selects sequences from the 1st genome, and "-2" selects
     1.8 -sequences from the 2nd genome.  'chr[!U]*' is a *pattern* that
     1.9 -specifies names starting with "chr", followed by any character except
    1.10 -U, followed by anything.
    1.11 +Option "-1" selects sequences from the 1st (horizontal) genome, and
    1.12 +"-2" selects sequences from the 2nd (vertical) genome.  'chr[!U]*' is
    1.13 +a *pattern* that specifies names starting with "chr", followed by any
    1.14 +character except U, followed by anything.
    1.15  
    1.16  ==========  =============================
    1.17  Pattern     Meaning
    1.18 @@ -60,29 +60,21 @@
    1.19    -h, --help
    1.20        Show a help message, with default option values, and exit.
    1.21    -1 PATTERN, --seq1=PATTERN
    1.22 -      Which sequences to show from the 1st genome.
    1.23 +      Which sequences to show from the 1st (horizontal) genome.
    1.24    -2 PATTERN, --seq2=PATTERN
    1.25 -      Which sequences to show from the 2nd genome.
    1.26 +      Which sequences to show from the 2nd (vertical) genome.
    1.27    -x WIDTH, --width=WIDTH
    1.28        Maximum width in pixels.
    1.29    -y HEIGHT, --height=HEIGHT
    1.30        Maximum height in pixels.
    1.31 -  -f FILE, --fontfile=FILE
    1.32 -      TrueType or OpenType font file.
    1.33 -  -s SIZE, --fontsize=SIZE
    1.34 -      TrueType or OpenType font size.
    1.35    -c COLOR, --forwardcolor=COLOR
    1.36        Color for forward alignments.
    1.37    -r COLOR, --reversecolor=COLOR
    1.38        Color for reverse alignments.
    1.39    --trim1
    1.40 -      Trim unaligned sequence flanks from the 1st genome.
    1.41 +      Trim unaligned sequence flanks from the 1st (horizontal) genome.
    1.42    --trim2
    1.43 -      Trim unaligned sequence flanks from the 2nd genome.
    1.44 -  --lengths1
    1.45 -      Show sequence lengths for the 1st genome.
    1.46 -  --lengths2
    1.47 -      Show sequence lengths for the 2nd genome.
    1.48 +      Trim unaligned sequence flanks from the 2nd (vertical) genome.
    1.49    --bed1=FILE
    1.50        Read `BED-format
    1.51        <https://genome.ucsc.edu/FAQ/FAQformat.html#format1>`_
    1.52 @@ -93,6 +85,18 @@
    1.53    --bed2=FILE
    1.54        Read BED-format annotations for the 2nd genome.
    1.55  
    1.56 +Text options
    1.57 +~~~~~~~~~~~~
    1.58 +
    1.59 +  -f FILE, --fontfile=FILE
    1.60 +      TrueType or OpenType font file.
    1.61 +  -s SIZE, --fontsize=SIZE
    1.62 +      TrueType or OpenType font size.
    1.63 +  --lengths1
    1.64 +      Show sequence lengths for the 1st (horizontal) genome.
    1.65 +  --lengths2
    1.66 +      Show sequence lengths for the 2nd (vertical) genome.
    1.67 +
    1.68  Unsequenced gap options
    1.69  ~~~~~~~~~~~~~~~~~~~~~~~
    1.70  
     2.1 --- a/scripts/last-dotplot	Tue Apr 18 17:24:44 2017 +0900
     2.2 +++ b/scripts/last-dotplot	Tue May 02 13:18:23 2017 +0900
     2.3 @@ -179,12 +179,14 @@
     2.4      '''Return miscellaneous information about the sequences.'''
     2.5      seqNames = seqLimits.keys()
     2.6      seqNames.sort(key=natural_sort_key)
     2.7 -    seq_sizes = [seqLimits[i][1] - seqLimits[i][0] for i in seqNames]
     2.8 -    if isShowSize: seqLabels = map(seqNameAndSizeText, seqNames, seq_sizes)
     2.9 -    else:          seqLabels = seqNames
    2.10 +    seqSizes = [seqLimits[i][1] - seqLimits[i][0] for i in seqNames]
    2.11 +    if isShowSize:
    2.12 +        seqLabels = map(seqNameAndSizeText, seqNames, seqSizes)
    2.13 +    else:
    2.14 +        seqLabels = seqNames
    2.15      labelSizes = get_text_sizes(seqLabels, font, fontsize, image_mode)
    2.16      margin = max(zip(*labelSizes)[1])  # maximum text height
    2.17 -    return seqNames, seq_sizes, seqLabels, labelSizes, margin
    2.18 +    return seqNames, seqSizes, seqLabels, labelSizes, margin
    2.19  
    2.20  def div_ceil(x, y):
    2.21      '''Return x / y rounded up.'''
    2.22 @@ -396,22 +398,22 @@
    2.23      if not alignments: raise Exception("there are no alignments")
    2.24  
    2.25      i1 = getSeqInfo(seqLimits1, font, opts.fontsize, image_mode, opts.lengths1)
    2.26 -    seqNames1, seq_sizes1, seqLabels1, labelSizes1, margin1 = i1
    2.27 +    seqNames1, seqSizes1, seqLabels1, labelSizes1, margin1 = i1
    2.28  
    2.29      i2 = getSeqInfo(seqLimits2, font, opts.fontsize, image_mode, opts.lengths2)
    2.30 -    seqNames2, seq_sizes2, seqLabels2, labelSizes2, margin2 = i2
    2.31 +    seqNames2, seqSizes2, seqLabels2, labelSizes2, margin2 = i2
    2.32  
    2.33      warn("choosing bp per pixel...")
    2.34      pix_limit1 = opts.width  - margin1
    2.35      pix_limit2 = opts.height - margin2
    2.36 -    bp_per_pix1 = get_bp_per_pix(seq_sizes1, opts.pix_tween_seqs, pix_limit1)
    2.37 -    bp_per_pix2 = get_bp_per_pix(seq_sizes2, opts.pix_tween_seqs, pix_limit2)
    2.38 +    bp_per_pix1 = get_bp_per_pix(seqSizes1, opts.pix_tween_seqs, pix_limit1)
    2.39 +    bp_per_pix2 = get_bp_per_pix(seqSizes2, opts.pix_tween_seqs, pix_limit2)
    2.40      bp_per_pix = max(bp_per_pix1, bp_per_pix2)
    2.41      warn("bp per pixel = " + str(bp_per_pix))
    2.42  
    2.43 -    seq_pix1, seq_starts1, width  = get_pix_info(seq_sizes1, bp_per_pix,
    2.44 +    seq_pix1, seq_starts1, width  = get_pix_info(seqSizes1, bp_per_pix,
    2.45                                                   opts.pix_tween_seqs, margin1)
    2.46 -    seq_pix2, seq_starts2, height = get_pix_info(seq_sizes2, bp_per_pix,
    2.47 +    seq_pix2, seq_starts2, height = get_pix_info(seqSizes2, bp_per_pix,
    2.48                                                   opts.pix_tween_seqs, margin2)
    2.49      warn("width:  " + str(width))
    2.50      warn("height: " + str(height))
    2.51 @@ -494,10 +496,6 @@
    2.52                    help="maximum width in pixels (default: %default)")
    2.53      op.add_option("-y", "--height", type="int", default=1000,
    2.54                    help="maximum height in pixels (default: %default)")
    2.55 -    op.add_option("-f", "--fontfile", metavar="FILE",
    2.56 -                  help="TrueType or OpenType font file")
    2.57 -    op.add_option("-s", "--fontsize", metavar="SIZE", type="int", default=11,
    2.58 -                  help="TrueType or OpenType font size (default: %default)")
    2.59      op.add_option("-c", "--forwardcolor", metavar="COLOR", default="red",
    2.60                    help="color for forward alignments (default: %default)")
    2.61      op.add_option("-r", "--reversecolor", metavar="COLOR", default="blue",
    2.62 @@ -506,15 +504,22 @@
    2.63                    help="trim unaligned sequence flanks from the 1st genome")
    2.64      op.add_option("--trim2", action="store_true",
    2.65                    help="trim unaligned sequence flanks from the 2nd genome")
    2.66 -    op.add_option("--lengths1", action="store_true",
    2.67 -                  help="show sequence lengths for the 1st genome")
    2.68 -    op.add_option("--lengths2", action="store_true",
    2.69 -                  help="show sequence lengths for the 2nd genome")
    2.70      op.add_option("--bed1", metavar="FILE",
    2.71                    help="read genome1 annotations from bed file")
    2.72      op.add_option("--bed2", metavar="FILE",
    2.73                    help="read genome2 annotations from bed file")
    2.74  
    2.75 +    og = optparse.OptionGroup(op, "Text options")
    2.76 +    og.add_option("-f", "--fontfile", metavar="FILE",
    2.77 +                  help="TrueType or OpenType font file")
    2.78 +    og.add_option("-s", "--fontsize", metavar="SIZE", type="int", default=11,
    2.79 +                  help="TrueType or OpenType font size (default: %default)")
    2.80 +    og.add_option("--lengths1", action="store_true",
    2.81 +                  help="show sequence lengths for the 1st (horizontal) genome")
    2.82 +    og.add_option("--lengths2", action="store_true",
    2.83 +                  help="show sequence lengths for the 2nd (vertical) genome")
    2.84 +    op.add_option_group(og)
    2.85 +
    2.86      og = optparse.OptionGroup(op, "Unsequenced gap options")
    2.87      og.add_option("--gap1", metavar="FILE",
    2.88                    help="read genome1 unsequenced gaps from agp or gap file")