Пример #1
0
    def generate(self, gpml=None, node_colors=None):

        # Add our urls to the defaults
        xref_urls = {
            'MetaCyc compound': 'pathomx://db/compound/%s/view',
            'MetaCyc gene': 'pathomx://db/gene/%s/view',
            'MetaCyc protein': 'pathomx://db/protein/%s/view',
            'WikiPathways': 'pathomx://wikipathway/%s/import',
        }
        if gpml:
            svg, metadata = gpml2svg.gpml2svg(gpml, xref_urls=xref_urls, xref_synonyms_fn=self.w.get_extended_xref_via_unification_list, node_colors=node_colors)  # Add Pathomx required customisations here
            self.setHtml(svg, QUrl("~"))
Пример #2
0
    def generate(self, gpml=None, node_colors=None):

        # Add our urls to the defaults
        xref_urls = {
            'MetaCyc compound': 'pathomx://db/compound/%s/view',
            'MetaCyc gene': 'pathomx://db/gene/%s/view',
            'MetaCyc protein': 'pathomx://db/protein/%s/view',
            'WikiPathways': 'pathomx://wikipathway/%s/import',
        }
        if gpml:
            svg, metadata = gpml2svg.gpml2svg(
                gpml,
                xref_urls=xref_urls,
                xref_synonyms_fn=self.w.get_extended_xref_via_unification_list,
                node_colors=node_colors
            )  # Add Pathomx required customisations here
            self.setHtml(svg, QUrl("~"))
Пример #3
0
elif config['gpml_wikipathways_id']:
    r = requests.get('http://www.wikipathways.org//wpi/wpi.php',
                     params={
                         'action': 'downloadFile',
                         'type': 'gpml',
                         'pwTitle':
                         'Pathway:%s' % config['gpml_wikipathways_id'],
                         'revision': 0,
                     })
    if r.status_code == 200:
        print("Loaded GPML from WikiPathways")
        gpml = r.text
    else:
        raise Exception("Error loading GPML from WikiPathways (%d)" %
                        r.status_code)
else:
    raise Exception("Select a source for GPML")

if gpml:

    # xref_synonyms_fn=get_extended_xref_via_unification_list,
    svg, metadata = gpml2svg.gpml2svg(gpml,
                                      xref_urls=xref_urls,
                                      xref_synonyms=xref_syns,
                                      node_colors=node_colors)

    View = SVG(svg)

    View
Пример #4
0
}

gpml = None
if config['gpml_file']:
    print("Loaded GPML from WikiPathways")
    with open(config['gpml_file'], 'rU') as f:
        gpml = f.read()

elif config['gpml_wikipathways_id']:
    r = requests.get('http://www.wikipathways.org//wpi/wpi.php', params={
                        'action': 'downloadFile',
                        'type': 'gpml',
                        'pwTitle': 'Pathway:%s' % config['gpml_wikipathways_id'],
                        'revision': 0,
                    })
    if r.status_code == 200:
        print("Loaded GPML from WikiPathways")
        gpml = r.text
    else:
        raise Exception("Error loading GPML from WikiPathways (%d)" % r.status_code)
else:
    raise Exception("Select a source for GPML")
        
if gpml:
    
    # xref_synonyms_fn=get_extended_xref_via_unification_list,
    svg, metadata = gpml2svg.gpml2svg(gpml, xref_urls=xref_urls, xref_synonyms=xref_syns, node_colors=node_colors) 

    View = SVG(svg)

    View