Пример #1
0
    def write_svg(self, fh):
        """
        Write this termimus to the SVG file.
        
        Parameters:
             fh - open filehandle to write SVG XML text to

        Return value:
             None
        """
        if self.domain_id:
            domainid = self.domain_id
        else:
            domainid = ''
        #shape='flowEndOfProc'
        shape = 'rect'  # FIXME errors with flowEndOfProc, even without ports
        clr = rgb_tuple_to_hex_str(self.get_color(), SHAPE_ALPHA)
        style = 'fill:#' + rgb_tuple_to_hex_str(self.get_color()) + ';'
        fh.write('  <dunnart:node id="' + str(self.xmlid) + '" ' +
                 'dunnart:label="' + self.label + '" ' + 'dunnart:width="' +
                 str(self.width) + '" ' + 'dunnart:height="' +
                 str(self.height) + '" ' + 'dunnart:xPos="' + str(self.xpos) +
                 '" ' + 'dunnart:yPos="' + str(self.ypos) + '" ' +
                 'dunnart:fillColour="' + clr + '" ' +  # color 
                 'style="' + style + '" ' +  # color
                 'dunnart:type="' + shape + '" ' + PTGRAPH_NS + ':' +
                 'chainId="' + self.get_chainid() + '" ' + PTGRAPH_NS + ':' +
                 'domainId="' + domainid + '" ' + PTGRAPH_NS + ':' +
                 'hovertext="chain ' + self.chainid + '" ' +
                 'onclick="handleClickEvent(evt)"' + '/>\n')
Пример #2
0
    def write_svg(self, fh):
        """
        Write this termimus to the SVG file.
        
        Parameters:
             fh - open filehandle to write SVG XML text to

        Return value:
             None
        """
        if self.domain_id:
            domainid = self.domain_id
        else:
            domainid = ''
        #shape='flowEndOfProc'
        shape='rect' # FIXME errors with flowEndOfProc, even without ports
        clr = rgb_tuple_to_hex_str(self.get_color(), SHAPE_ALPHA)
        style = 'fill:#' + rgb_tuple_to_hex_str(self.get_color()) + ';'
        fh.write('  <dunnart:node id="'+str(self.xmlid)+'" ' +
                 'dunnart:label="' + self.label + '" ' +
                 'dunnart:width="' + str(self.width) + '" ' +
                 'dunnart:height="' + str(self.height) +'" ' +
                 'dunnart:xPos="' + str(self.xpos) + '" ' +
                 'dunnart:yPos="' + str(self.ypos) + '" ' +
                 'dunnart:fillColour="' + clr + '" ' + # color 
                 'style="' + style + '" ' +    # color
                 'dunnart:type="' + shape + '" ' +
                 PTGRAPH_NS + ':' + 'chainId="' +
                 self.get_chainid() + '" ' +
                 PTGRAPH_NS + ':' + 'domainId="' +
                 domainid + '" ' +
                 PTGRAPH_NS + ':' + 'hovertext="chain ' + self.chainid + '" ' +
                 'onclick="handleClickEvent(evt)"' +
                 '/>\n')
Пример #3
0
    def write_svg(self, fh):
        """
        Write this strand to the SVG file.

        Mostly there are Dunnart namespace attributes for Dunnart to use
        in layout out diagram, but also some proorigami namespace attributes
        that are ignored by Dunnart but retained in its finished diagram
        SVG output to be used by interactive SVG for hover text showing
        residues and so on.
        
        Parameters:
             fh - open filehandle to write SVG XML text to

        Return value:
             None
        """
        shape = 'bioStrand'

        if self.get_reversed():
            reversed_str = "1"
        else:
            reversed_str = "0"
        clr = rgb_tuple_to_hex_str(self.get_color(), SHAPE_ALPHA)
        style = 'fill:#' + rgb_tuple_to_hex_str(self.get_color()) + ';'
        (residue_names,
         residue_ids) = get_residue_strings(self.resname_list, self.resid_list)
        if self.get_sheet_id():
            sheetid = self.get_sheet_id()
        else:
            sheetid = ''
        if self.domain_id:
            domainid = self.domain_id
        else:
            domainid = ''
        fh.write('  <dunnart:node id="' + str(self.xmlid) + '" ' +
                 'dunnart:label="' + self.label + '" ' + 'dunnart:width="' +
                 str(self.width) + '" ' + 'dunnart:height="' +
                 str(self.height) + '" ' + 'dunnart:xPos="' + str(self.xpos) +
                 '" ' + 'dunnart:yPos="' + str(self.ypos) + '" ' +
                 'dunnart:reversed="' + reversed_str + '" ' +
                 'dunnart:fillColour="' + clr + '" ' +  # color 
                 'style="' + style + '" ' +  # color
                 'dunnart:type="' + shape + '" ' + PTGRAPH_NS + ':' +
                 'residueNames="' + residue_names + '" ' + PTGRAPH_NS + ':' +
                 'residueSeqNums="' + residue_ids + '" ' + PTGRAPH_NS + ':' +
                 'sseseqnum="' + self.sseseqnum + '" ' + PTGRAPH_NS + ':' +
                 'chainId="' + self.get_chainid() + '" ' + PTGRAPH_NS + ':' +
                 'sheetId="' + sheetid + '" ' + PTGRAPH_NS + ':' +
                 'domainId="' + domainid + '" ' +
                 # hovertext is updated by Javascript in interactive SVG
                 PTGRAPH_NS + ':' + 'hovertext="' + self.nodeid + '" ' +
                 PTGRAPH_NS + ':' + 'selected="0" ' + 'dunnart:headLabel="' +
                 self.headLabel + '" ' + 'dunnart:tailLabel="' +
                 self.tailLabel + '" '
                 'onmousemove="updateHoverText(evt)" ' +
                 'onclick="handleClickEvent(evt)"' + ' />\n')
Пример #4
0
    def set_color(self, color):
        """
        Label this node with color (r,g,b) tuple. See comments in __init__

        Parameters: color - (r,g,b) color tuple
        Return value: None
        Uses data members (write): color, color_hex
        """
        self.color = color
        self.color_hex = rgb_tuple_to_hex_str(color)
Пример #5
0
    def set_color(self, color):
        """
        Label this node with color (r,g,b) tuple. See comments in __init__

        Parameters: color - (r,g,b) color tuple
        Return value: None
        Uses data members (write): color, color_hex
        """
        self.color = color
        self.color_hex = rgb_tuple_to_hex_str(color)
Пример #6
0
    def write_svg(self, fh):
        """
        Write this strand to the SVG file.

        Mostly there are Dunnart namespace attributes for Dunnart to use
        in layout out diagram, but also some proorigami namespace attributes
        that are ignored by Dunnart but retained in its finished diagram
        SVG output to be used by interactive SVG for hover text showing
        residues and so on.
        
        Parameters:
             fh - open filehandle to write SVG XML text to

        Return value:
             None
        """
        shape = 'bioStrand'

        if self.get_reversed():
            reversed_str = "1"
        else:
            reversed_str = "0"
        clr = rgb_tuple_to_hex_str(self.get_color(), SHAPE_ALPHA)
        style = 'fill:#' + rgb_tuple_to_hex_str(self.get_color()) + ';'
        (residue_names, residue_ids) = get_residue_strings(self.resname_list,
                                                           self.resid_list)
        if self.get_sheet_id():
            sheetid = self.get_sheet_id()
        else:
            sheetid = ''
        if self.domain_id:
            domainid = self.domain_id
        else:
            domainid = ''
        fh.write('  <dunnart:node id="'+str(self.xmlid)+'" ' +
                 'dunnart:label="' + self.label + '" ' +
                 'dunnart:width="' + str(self.width) + '" ' +
                 'dunnart:height="' + str(self.height) +'" ' +
                 'dunnart:xPos="' + str(self.xpos) + '" ' +
                 'dunnart:yPos="' + str(self.ypos) + '" ' +
                 'dunnart:reversed="' + reversed_str + '" ' +
                 'dunnart:fillColour="' + clr + '" ' + # color 
                 'style="' + style + '" ' +    # color
                 'dunnart:type="' + shape + '" ' + 
                 PTGRAPH_NS + ':' + 'residueNames="' +
                 residue_names + '" ' +
                 PTGRAPH_NS + ':' + 'residueSeqNums="' +
                 residue_ids +
                 '" ' +
                 PTGRAPH_NS + ':' + 'sseseqnum="' +
                 self.sseseqnum + '" ' +
                 PTGRAPH_NS + ':' + 'chainId="' +
                 self.get_chainid() + '" ' +
                 PTGRAPH_NS + ':' + 'sheetId="' +
                 sheetid + '" ' +
                 PTGRAPH_NS + ':' + 'domainId="' +
                 domainid + '" ' + 
                 # hovertext is updated by Javascript in interactive SVG
                 PTGRAPH_NS + ':' + 'hovertext="' + self.nodeid + '" ' +
                 PTGRAPH_NS + ':' + 'selected="0" ' +
                 'dunnart:headLabel="' + self.headLabel + '" ' +
                 'dunnart:tailLabel="' + self.tailLabel + '" ' 
                 'onmousemove="updateHoverText(evt)" ' +
                 'onclick="handleClickEvent(evt)"' +
                 ' />\n')