Exemplo n.º 1
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        label = self.item.name
        x0 = coordinate.x0
        x1 = coordinate.x1
        y = coordinate.y0
        hs = self.half_size

        self.drawing = \
            self.survive * (
            eps.comment('Triangle', indent=indent) +
            eps.newpath(indent=indent) +
            eps.mt(x0, y - hs, indent=indent) +
            eps.lt(x0, y + hs, indent=indent) +
            eps.lt(x1, y, indent=indent) +
            eps.lt(x0, y - hs, indent=indent) +
            eps.closepath(indent=indent, colour='0 0 0') +
            eps.stroke(indent=indent)
            )

        self.typography = \
            self.survive * (
            eps.comment('Triangle', indent=indent) +
            eps.newpath(indent=indent) +
            eps.center_txt((x0+x1)/2, y+hs+config.font_small_size, label, font,  config.font_small_size, indent=indent) +
            eps.stroke(indent=indent)
            )
Exemplo n.º 2
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        tag = self.item.name
        x0 = coordinate.x0
        x1 = coordinate.x1
        y = coordinate.y0
        s = self.size

        self.drawing = \
        self.survive * (
            eps.comment('Box', indent=indent) +
            eps.newpath(indent=indent) +
            eps.mt(x0, y - s, indent=indent) +
            eps.lt(x0, y + s, indent=indent) +
            eps.lt(x1, y + s, indent=indent) +
            eps.lt(x1, y - s, indent=indent) +
            eps.lt(x0, y - s, indent=indent) +
            eps.closepath(indent=indent) +
            eps.stroke(indent=indent)
            )

        self.typography = \
        self.survive * (
            eps.comment('Box', indent=indent) +
            eps.newpath(indent=indent) +
            eps.center_txt((x0+x1)/2, y, tag, font, font_normal_size, indent=indent) +
            eps.stroke(indent=indent)
            )
Exemplo n.º 3
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        tag = self.item.name
        x0 = coordinate.x0
        x1 = coordinate.x1
        y = coordinate.y0
        coordinate_factor = config.rack_interval * 1 / 3

        self.drawing = \
            self.survive * (
            eps.comment('Probe', indent=indent) +
            eps.newpath(indent=indent, line_width=config.ultra_bold_line, colour='1 0.4 0') +
            eps.mt(x0, y, indent=indent) +
            eps.lt(x1, y, indent=indent) +
            #eps.closepath(indent=indent) +
            eps.stroke(indent=indent)
            )

        self.typography = \
            self.survive * (
            eps.comment('Probe', indent=indent) +
            eps.newpath(indent=indent, colour='0 0 0.9') +
            eps.center_txt((x0+x1)/2, y-coordinate_factor, tag, font, config.font_small_size, indent=indent) +
            eps.stroke(indent=indent)
            )
Exemplo n.º 4
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        x = coordinate.x_spot
        three_quarters_size = config.font_small_size * 3 / 4
        minimum_interval = three_quarters_size * (config.probe_name_length - 3)

        txt_x = list()
        for i in range(0, self.num_hit):
            if i < 3 or x[i] >= (x[i - 3] + minimum_interval):
                txt_x.append(x[i])
            else:
                txt_x.append(x[i - 3] + minimum_interval)

        y = coordinate.y0
        height_coordinate = [
            y + (3 * config.font_small_size - 2) - (i * config.font_small_size)
            for i in range(1, 4)
        ] * (self.num_hit)

        self.drawing = \
            eps.comment('SNP', indent=indent) + \
            eps.newpath(indent=indent, colour='1 0.4 0', line_width=config.bold_line) + \
            (''.join([eps.mt(i+config.cross_size, y + config.cross_size+config.rack_interval, indent=indent+4) + eps.lt(i-config.cross_size, y - config.cross_size+config.rack_interval, indent=indent+4) +
            eps.mt(i-config.cross_size, y + config.cross_size + config.rack_interval, indent=indent+4) + eps.lt(i+config.cross_size, y - config.cross_size+config.rack_interval, indent=indent+4) for i in coordinate.x_spot]) +
            eps.stroke(indent=indent)
         )

        self.typography = \
            eps.comment('SNP', indent=indent) + \
            eps.newpath(indent=indent, colour='0 0 0.9') + \
            ''.join([eps.center_txt(txt_x[i], height_coordinate[i], self.found_names[i], font, config.font_small_size, indent+4)  for i in  range(0, self.num_hit)]) + \
            eps.stroke(indent=indent)
Exemplo n.º 5
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        tag = self.item.name
        x0 = coordinate.x0
        x1 = coordinate.x1
        y = coordinate.y0
        ss = self.shaft_size
        hs = self.head_size
        d = 0.5 * (x1 - x0) / math.fabs(x1 - x0)  # direction

        self.drawing = \
            self.survive * (
            eps.comment('Arrow', indent=indent) +
            eps.newpath(indent=indent) +
            eps.mt(x0, y - ss, indent=indent) +
            eps.lt(x0, y + ss, indent=indent) +
            eps.lt(x1 - hs * d, y + ss, indent=indent) +
            eps.lt(x1 - hs * d, y + hs, indent=indent) +
            eps.lt(x1, y, indent) +
            eps.lt(x1 - hs * d, y - hs, indent=indent) +
            eps.lt(x1 - hs * d, y - ss, indent=indent) +
            eps.lt(x0,y - ss, indent=indent) +
            eps.closepath(indent=indent) +
            eps.stroke(indent=indent)
            )

        self.typography = \
            self.survive * (
            eps.comment('Arrow', indent=indent) +
            eps.newpath(indent=indent) +
            eps.center_txt((x0+x1)/2, y, tag, font, font_normal_size, indent=indent) +
            eps.stroke(indent=indent)
            )
Exemplo n.º 6
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        if self.item.option == 'left':
            x0 = coordinate.x0
            x1 = coordinate.x1
        elif self.item.option == 'center':
            x0 = coordinate.x_spot[1]
            x1 = coordinate.x_spot[1] + (coordinate.x1 - coordinate.x0)
        else:
            x0 = coordinate.x_spot[2]
            x1 = coordinate.x_spot[2] + (coordinate.x1 - coordinate.x0)

        y = coordinate.y0
        tag = format(self.item.end, ',d') + self.item.name if config.scale_bar_comma \
            else format(self.item.end, 'g') + self.item.name
        coordinate_factor = config.rack_interval * 1 / 2

        self.drawing = \
            eps.newpath(indent=indent, line_width=config.ultra_bold_line) + \
            eps.mt(x0, y-coordinate_factor, indent=indent) + \
            eps.lt(x1, y-coordinate_factor, indent=indent) + \
            eps.stroke(indent=indent)

        self.typography = \
            eps.newpath(indent=indent) + \
            eps.center_txt((x0+x1)/2, y-2*coordinate_factor, tag, font, font_normal_size, indent=indent) + \
            eps.stroke(indent=indent)
Exemplo n.º 7
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):

        x = coordinate.x_spot
        x0 = coordinate.x0

        xdiv = (coordinate.x1 - config.probe_name_length *
                config.font_small_size) / (self.num_hit + 1)
        txt_x = [
            x0 + xdiv * (i + 1) - config.probe_name_length *
            config.font_small_size / 2  #half of probe name length
            for i in range(0, self.num_hit)
        ]
        line_terminal_x = [
            x0 + xdiv * (i + 1) +
            config.probe_name_length * config.font_small_size *
            (i / self.num_hit - 1) / 2  #half of probe name length
            for i in range(0, self.num_hit)
        ]

        y = coordinate.y0
        ydiv = config.num_probes_in_one_line
        unit = math.floor(self.num_hit / ydiv) + 1

        height_coordinate = [
            (y + config.rack_interval * self.height_probe_name) +
            (i * config.font_small_size) for i in list(range(unit, 0, -1))
        ] * 9  #nine is repeat.
        txt_y = [height_coordinate[i] for i in range(0, self.num_hit)]
        line_terminal_y = [
            height_coordinate[i] for i in range(0, self.num_hit)
        ]

        self.drawing = \
            eps.comment('InfMet', indent=indent) + \
            eps.newpath(indent=indent, colour='1 0.4 0', line_width=config.bold_line) + \
            ''.join([
                eps.mt(line_terminal_x[i], line_terminal_y[i], indent=indent+4) +
                eps.lt(x[i], y  + config.box_size, indent=indent+4) +
                eps.lt(x[i], y - config.half_site_width, indent=indent+4)
                for i in range(0, self.num_hit)]) + \
            eps.stroke(indent=indent)
        self.typography = \
            eps.comment('InfMet', indent=indent) + \
            eps.newpath(indent=indent, colour='0 0 0.9') + \
            ''.join([
                eps.show_txt(txt_x[i], txt_y[i], self.hit_id[i], font, config.font_small_size, indent+4)
                for i in range(0, self.num_hit)]) + \
            eps.stroke(indent=indent)
Exemplo n.º 8
0
 def paragraph(self, coordinate, font, font_normal_size, indent=0):
     super().paragraph(coordinate, font, font_normal_size, indent=0)
     self.drawing =  eps.newpath(indent=indent)\
                     + eps.mt(coordinate.x0, coordinate.y0, indent=indent)\
                     + eps.lt(coordinate.x1, coordinate.y0 + self.item.option * config.rack_interval, indent=indent)\
                     + '[1 2 3 2] 0 setdash\n'\
                     + eps.stroke(indent=indent)\
                     + '[] 0 setdash\n'
Exemplo n.º 9
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        half_size = font_normal_size / 2

        tag = self.item.name
        x0 = coordinate.x0
        y = coordinate.y0

        self.drawing = \
            eps.comment('Site', indent=indent) + \
            eps.newpath(indent=indent) + \
            ''.join([eps.mt(i, y + config.half_site_width, indent=indent+4) + eps.lt(i, y - config.half_site_width, indent=indent+4) for i in coordinate.x_spot]) + \
            eps.stroke(indent=indent)

        self.typography = \
            eps.comment('Site', indent=indent) + \
            eps.newpath(indent=indent) + \
            eps.right_txt(x0-half_size, y, tag, font, font_normal_size, indent=indent) + \
            eps.stroke(indent=indent)
Exemplo n.º 10
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        tag = self.item.name
        x = coordinate.x_spot
        y = coordinate.y0
        coordinate_factor = config.rack_interval * 1 / 3

        for i in range(0, len(coordinate.x_spot), 2):
            self.drawing = self.drawing + \
                      eps.comment('MatchingProbe', indent=indent) + \
                      eps.newpath(indent=indent, line_width=config.ultra_bold_line, colour='1 0.4 0') +\
                      eps.mt(x[i], y, indent=indent) + \
                      eps.lt(x[i+1], y, indent=indent) + \
                      eps.stroke(indent=indent)

            self.typography = self.typography + \
                         eps.comment('MatchingProbe', indent=indent) + \
                         eps.newpath(indent=indent, colour='0 0 0.9') + \
                         eps.center_txt((x[i]+x[i+1])/2, y-coordinate_factor, tag, font, config.font_small_size, indent=indent) + \
                         eps.stroke(indent=indent)
Exemplo n.º 11
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        x0 = coordinate.x0
        x1 = coordinate.x1
        y = coordinate.y0

        self.drawing = \
            eps.comment('Shaft', indent=indent) + \
            eps.newpath(indent=indent) + \
            eps.mt(x0, y, indent=indent) + \
            eps.lt(x1, y, indent=indent) + \
            eps.stroke(indent=indent)
Exemplo n.º 12
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        three_quarters_size = font_normal_size * 3 / 4

        num_group = self.item.name
        self.num_boxes = len(coordinate.x_spot)

        box_x = coordinate.x_spot

        y = coordinate.y0

        self.drawing = ''

        self.typography =  \
            eps.comment('OuterBoxNum', indent=indent) + \
            eps.newpath(indent=indent)

        current_x = 0
        for i in range(0, self.num_boxes):
            min_interval = three_quarters_size * len(num_group[i])
            x_interval = box_x[i] - current_x

            if x_interval < min_interval and box_x[i - 1] == current_x and (
                    box_x[min(i + 1,
                              len(box_x) - 1)] - box_x[i] > min_interval * 2
                    or i == (len(box_x) - 1)):

                new_x = current_x + min_interval

            elif x_interval < min_interval:
                new_x = current_x
                num_group[i] = ''

            else:
                new_x = box_x[i]

            current_x = new_x

            self.typography = self.typography + \
                eps.center_txt(current_x, y  - config.box_size - config.font_normal_size + config.font_normal_size/3,
                               num_group[i], font, config.font_normal_size, indent+4) +\
                eps.stroke(indent=indent+4)
Exemplo n.º 13
0
    def paragraph(self, coordinate, font, font_normal_size, indent=0):
        super().paragraph(coordinate, font, font_normal_size, indent=0)

        font_size = config.font_title_size
        tag = self.item.name
        if self.item.option == 'left':
            x0 = coordinate.x0
            x1 = coordinate.x1 + len(tag) * font_size / 2
        elif self.item.option == 'center':
            x0 = coordinate.x_spot[1]
            x1 = coordinate.x_spot[1] + (coordinate.x1 - coordinate.x0)
        else:
            x0 = coordinate.x_spot[2]
            x1 = coordinate.x_spot[2] + (
                coordinate.x1 - coordinate.x0) - len(tag) * font_size / 2
        y = coordinate.y0
        coordinate_factor = config.title_height

        self.typography = \
            eps.comment('Title', indent=indent) + \
            eps.newpath(indent=indent) + \
            eps.center_txt((x0+x1)/2, y+coordinate_factor, tag, font, font_size, indent=indent) + \
            eps.stroke(indent=indent)