def get_svg_groups(self, h_offset: int = 0, v_offset: int = 0, scaling: float = 1., screenwidth: int = 1024, colours: Dict[str, str] = None, overview: bool = False, prefix: str = "dummy") -> List[Group]: """ Returns all SVG elements required to draw the Cluster """ if not colours: colours = {} groups = [] group = Group() self._add_label(group, v_offset) line_y = 35 + v_offset group.addElement(ShapeBuilder().createLine(10, line_y, 10 + (screenwidth * 0.75), line_y, strokewidth=1, stroke="grey")) groups.append(group) # Add gene arrows arrow_y = line_y + 5 offset = h_offset - self.start if self.reversed: offset = h_offset + self.end for i, gene in enumerate(self.genes): group = Group() arrow = gene.get_arrow_polygon(scaling=scaling, offset=offset, base=arrow_y, colour=colours.get(gene.name, "white")) if overview: label = "all_" else: label = "h" arrow.set_id("%s-%d_%s%d_%s_%s" % (prefix, self.query_cluster_number, label, self.query_cluster_number, self.rank, i)) group.addElement(arrow) # Can be used for domains group.set_id("a%s_00%s" % (self.query_cluster_number, i)) groups.append(group) return groups
def get_svg_groups(self, h_offset: int = 0, v_offset: int = 0, scaling: float = 1., screenwidth: int = 1024, colours: Dict[str, str] = None, overview: bool = False, prefix: str = "dummy") -> List[Group]: """ Returns all SVG elements required to draw the Cluster """ if not colours: colours = {} groups = [] group = Group() acc = Text(self.description, 5, 20) acc.set_class("clusterblast-acc") group.addElement(acc) line_y = 35 + v_offset group.addElement(ShapeBuilder().createLine(10, line_y, 10 + (screenwidth * 0.75), line_y, strokewidth=1, stroke="grey")) group.setAttribute('label', self.description) group.set_class('clusterblast-cluster') groups.append(group) base = line_y + 5 offset = h_offset + 10 - self.start # 10 for margin for index, gene in enumerate(self.genes): arrow = gene.get_arrow_polygon(scaling=scaling, offset=offset, base=base, colour=colours.get(gene.name, "white")) arrow.set_id("%s-%s_q%s_%s_%s" % (prefix, self.query_cluster_number, index, self.rank, "all")) group.addElement(arrow) return groups