scripts/last-dotplot
changeset 852 f3b6c666afad
parent 851 5b2acb7fdb3e
child 855 09a9d7ef13ae
     1.1 --- a/scripts/last-dotplot	Tue May 02 13:35:07 2017 +0900
     1.2 +++ b/scripts/last-dotplot	Tue May 02 14:04:09 2017 +0900
     1.3 @@ -379,7 +379,7 @@
     1.4      labels.sort()
     1.5      labels = get_nonoverlapping_labels(labels, opts.label_space)
     1.6      image_size = max_pos, height
     1.7 -    im = Image.new(image_mode, image_size, opts.border_shade)
     1.8 +    im = Image.new(image_mode, image_size, opts.border_color)
     1.9      draw = ImageDraw.Draw(im)
    1.10      for i in labels:
    1.11          position = i[1], 0
    1.12 @@ -417,15 +417,15 @@
    1.13      warn("choosing bp per pixel...")
    1.14      pix_limit1 = opts.width  - margin1
    1.15      pix_limit2 = opts.height - margin2
    1.16 -    bp_per_pix1 = get_bp_per_pix(seqSizes1, opts.pix_tween_seqs, pix_limit1)
    1.17 -    bp_per_pix2 = get_bp_per_pix(seqSizes2, opts.pix_tween_seqs, pix_limit2)
    1.18 +    bp_per_pix1 = get_bp_per_pix(seqSizes1, opts.border_pixels, pix_limit1)
    1.19 +    bp_per_pix2 = get_bp_per_pix(seqSizes2, opts.border_pixels, pix_limit2)
    1.20      bp_per_pix = max(bp_per_pix1, bp_per_pix2)
    1.21      warn("bp per pixel = " + str(bp_per_pix))
    1.22  
    1.23      seq_pix1, seq_starts1, width  = get_pix_info(seqSizes1, bp_per_pix,
    1.24 -                                                 opts.pix_tween_seqs, margin1)
    1.25 +                                                 opts.border_pixels, margin1)
    1.26      seq_pix2, seq_starts2, height = get_pix_info(seqSizes2, bp_per_pix,
    1.27 -                                                 opts.pix_tween_seqs, margin2)
    1.28 +                                                 opts.border_pixels, margin2)
    1.29      warn("width:  " + str(width))
    1.30      warn("height: " + str(height))
    1.31  
    1.32 @@ -480,12 +480,12 @@
    1.33          im.paste(axis2, (0, 0))
    1.34  
    1.35      for i in seq_starts1[1:]:
    1.36 -        box = i - opts.pix_tween_seqs, margin2, i, height
    1.37 -        im.paste(opts.border_shade, box)
    1.38 +        box = i - opts.border_pixels, margin2, i, height
    1.39 +        im.paste(opts.border_color, box)
    1.40  
    1.41      for i in seq_starts2[1:]:
    1.42 -        box = margin1, i - opts.pix_tween_seqs, width, i
    1.43 -        im.paste(opts.border_shade, box)
    1.44 +        box = margin1, i - opts.border_pixels, width, i
    1.45 +        im.paste(opts.border_color, box)
    1.46  
    1.47      im.save(args[1])
    1.48  
    1.49 @@ -521,6 +521,11 @@
    1.50                    help="trim unaligned sequence flanks from the 1st genome")
    1.51      op.add_option("--trim2", action="store_true",
    1.52                    help="trim unaligned sequence flanks from the 2nd genome")
    1.53 +    op.add_option("--border-pixels", metavar="INT", type="int", default=1,
    1.54 +                  help="number of pixels between sequences (default=%default)")
    1.55 +    op.add_option("--border-color", metavar="COLOR", default="#dcdcdc",
    1.56 +                  help="color for pixels between sequences (default=%default)")
    1.57 +    # xxx --margin-color?
    1.58      op.add_option("--bed1", metavar="FILE",
    1.59                    help="read genome1 annotations from bed file")
    1.60      op.add_option("--bed2", metavar="FILE",
    1.61 @@ -552,8 +557,6 @@
    1.62  
    1.63      opts.text_color = "black"
    1.64      opts.background_color = "white"
    1.65 -    opts.pix_tween_seqs = 2  # number of border pixels between sequences
    1.66 -    opts.border_shade = 239, 239, 239  # the shade of grey for border pixels
    1.67      opts.label_space = 5     # minimum number of pixels between axis labels
    1.68  
    1.69      try: lastDotplot(opts, args)