scripts/last-dotplot
changeset 1070 6cf9358f80da
parent 1069 da8b081ec496
child 1071 c5d3cf8c1058
     1.1 --- a/scripts/last-dotplot	Thu Jul 30 21:25:14 2020 +0900
     1.2 +++ b/scripts/last-dotplot	Thu Jul 30 21:47:07 2020 +0900
     1.3 @@ -809,6 +809,13 @@
     1.4      remainingSequences = set(i[seqIndex] for i in alignments)
     1.5      return [i for i in seqRanges if i[0] in remainingSequences]
     1.6  
     1.7 +def readAnnotations(opts, rangeDict, bedFile, repFile, geneFile, gapFile):
     1.8 +    annots = itertools.chain(readBed(bedFile, rangeDict),
     1.9 +                             readRmsk(repFile, rangeDict),
    1.10 +                             readGenePred(opts, geneFile, rangeDict),
    1.11 +                             readGaps(opts, gapFile, rangeDict))
    1.12 +    return annots
    1.13 +
    1.14  def lastDotplot(opts, args):
    1.15      logLevel = logging.INFO if opts.verbose else logging.WARNING
    1.16      logging.basicConfig(format="%(filename)s: %(message)s", level=logLevel)
    1.17 @@ -903,18 +910,14 @@
    1.18      logging.info("reading annotations...")
    1.19  
    1.20      rangeDict1 = expandedSeqDict(rangeDict1)
    1.21 -    beds1 = itertools.chain(readBed(opts.bed1, rangeDict1),
    1.22 -                            readRmsk(opts.rmsk1, rangeDict1),
    1.23 -                            readGenePred(opts, opts.genePred1, rangeDict1),
    1.24 -                            readGaps(opts, opts.gap1, rangeDict1))
    1.25 -    boxes1 = bedBoxes(beds1, rangeDict1, tMargin, height, True, bpPerPix)
    1.26 +    annots1 = readAnnotations(opts, rangeDict1,
    1.27 +                              opts.bed1, opts.rmsk1, opts.genePred1, opts.gap1)
    1.28 +    boxes1 = bedBoxes(annots1, rangeDict1, tMargin, height, True, bpPerPix)
    1.29  
    1.30      rangeDict2 = expandedSeqDict(rangeDict2)
    1.31 -    beds2 = itertools.chain(readBed(opts.bed2, rangeDict2),
    1.32 -                            readRmsk(opts.rmsk2, rangeDict2),
    1.33 -                            readGenePred(opts, opts.genePred2, rangeDict2),
    1.34 -                            readGaps(opts, opts.gap2, rangeDict2))
    1.35 -    boxes2 = bedBoxes(beds2, rangeDict2, lMargin, width, False, bpPerPix)
    1.36 +    annots2 = readAnnotations(opts, rangeDict2,
    1.37 +                              opts.bed2, opts.rmsk2, opts.genePred2, opts.gap2)
    1.38 +    boxes2 = bedBoxes(annots2, rangeDict2, lMargin, width, False, bpPerPix)
    1.39  
    1.40      boxes = sorted(itertools.chain(boxes1, boxes2))
    1.41