PathMe-Viewer

PathMe Viewer.

A plugin for PathMe that allows to explore pathway knowledge.

Installation

  1. pathme_viewer can be installed with the following commands:

$ python3 -m pip install git+https://github.com/ComPath/PathMe-Viewer.git@master
  1. or in editable mode with:

$ git clone https://github.com/ComPath/PathMe-Viewer.git
$ cd PathMe-Viewer
$ python3 -m pip install -e .

Database

The web application requires to load the pathways from the databases in the BEL. Thus, it is required to the following command to load the database (note that the first time it runs might take a couple of hours).

python3 -m pathme_viewer manage load_database

In order to check the status of the database, you can run:

python3 -m pathme_viewer manage summarize

The content of the database can be erased by running:

python3 -m pathme_viewer manage drop

Deployment

Once the desired pathway databases are loaded, you can deploy the web application by running:

python3 -m pip install pathme_viewer web

Note that the database runs by default in the following port: http://0.0.0.0:5000/. The Flask host and port can be modified by changing the default parameters (run: “python3 -m pathme_viewer web –help” for more info).

Command Line Interface

PathMe-Viewer commands.

pathme_viewer

PathMe

pathme_viewer [OPTIONS] COMMAND [ARGS]...

manage

Manage the database.

pathme_viewer manage [OPTIONS] COMMAND [ARGS]...

Options

-c, --connection <connection>

Cache connection. Defaults to sqlite:////home/docs/.bio2bel/bio2bel.db

drop

Delete all database entries

pathme_viewer manage drop [OPTIONS]

Options

-v, --debug

Turn on debugging.

-y, --yes
-c, --connection <connection>

Cache connection. Defaults to sqlite:////home/docs/.bio2bel/bio2bel.db

export-to-tsv

Export pathways to tsv

pathme_viewer manage export-to-tsv [OPTIONS]

Options

-c, --connection <connection>

Defaults to sqlite:////home/docs/.bio2bel/bio2bel.db

-a, --all
load

Load Pathways

pathme_viewer manage load [OPTIONS]

Options

-c, --connection <connection>

Cache connection. Defaults to sqlite:////home/docs/.bio2bel/bio2bel.db

-kp, --kegg_path <kegg_path>

KEGG data folder. Defaults to /home/docs/.pathme/kegg

-rp, --reactome_path <reactome_path>

Reactome data folder. Defaults to /home/docs/.pathme/reactome

-wp, --wikipathways_path <wikipathways_path>

WikiPathways data folder. Defaults to /home/docs/.pathme/wikipathways

-f, --flatten <flatten>

Flat complexes/composites. Defaults to False

-y, --yes

Skip confirmation

summarize

Summarizes Entries in Database

pathme_viewer manage summarize [OPTIONS]

Options

-c, --connection <connection>

Defaults to sqlite:////home/docs/.bio2bel/bio2bel.db

web

Run web service.

pathme_viewer web [OPTIONS]

Options

--host <host>

Flask host. Defaults to 0.0.0.0

--port <port>

Flask port. Defaults to 5000

--template <template>

Defaults to “../templates”

--static <static>

Defaults to “../static”

-v, --verbose

Database Models

PathMe-Viewer database models.

PathMe models.

class pathme_viewer.models.Pathway(**kwargs)[source]

Represents a pathway network in BEL format harmonized by ComPath

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

name

Pathway name

resource_name

Database of origin

pathway_id

Pathway identifier in database of origin

number_of_nodes

Number of nodes

number_of_edges

Number of edges

version

Version of the BEL file

authors

Authors of the underlying BEL file

contact

Contact email from the underlying pathway

description

Descriptive text from the pathway

pybel_version

Version of PyBEL

blob

A pickled version of this pathway

property display_name

Return pathway name.

property pathway_tuple

Return pathway name.

as_bel()[source]

Get this network and loads it into a BELGraph.

Return type

pybel.BELGraph

Database Manager

PathMe-Viewer database manager.

This module contains the PathMe database manager.

class pathme_viewer.manager.Manager(engine, session)[source]

Database manager.

Init PathMe manager.

create_all(check_first=True)[source]

Create tables for PathMe.

drop_all(check_first=True)[source]

Drop all tables for PathMe.

count_pathways()[source]

Count the pathways in the database.

Return type

int

count_pathways_by_resource()[source]

Count the pathways in the database grouping by resource.

Return type

int

get_all_pathways()[source]

Get all pathways in the database.

Return type

list[Pathway]

get_all_pathway_graphs()[source]

Get all pathway graphs.

Return type

list[pybel.BELGraph]

get_pathway_by_id(pathway_id, resource_name)[source]

Get pathway by canonical identifier.

Parameters
  • pathway_id (str) – pathway identifier

  • resource_name (str) – name of the database

Return type

Optional[Pathway]

get_pathway_by_name(pathway_name, resource_name)[source]

Get pathway by name.

Parameters
  • pathway_name (str) – pathway identifier

  • resource_name (str) – name of the database

Return type

Optional[Pathway]

get_pathways_from_resource(resource_name)[source]

Get pathways from a given database.

Parameters

resource_name (str) – name of the database

Return type

Optional[list[Pathway]]

create_pathway(pathway_dict)[source]

Create pathway.

Parameters

pathway_dict (dict) – pathway identifier

Return type

Pathway

delete_pathway(pathway_id, resource_name)[source]

Delete a pathway.

Parameters
  • pathway_id (str) – pathway identifier

  • resource_name (str) – name of the database

Return type

bool

delete_all_pathways()[source]

Delete all the pathways.

delete_pathways_from_resource(resource_name)[source]

Delete pathways from a given database.

Parameters

resource_name (str) – name of the database

Return type

bool

get_or_create_pathway(pathway_dict)[source]

Get or create pathway.

Parameters

pathway_dict (dict) – pathway info

Return type

Pathway

query_pathway_by_name(query, limit=None)[source]

Return all pathways having the query in their names.

Parameters
  • query (str) – query string

  • limit (Optional[int]) – limit result query

Return type

list[Pathway]

query_pathway_by_name_and_resource(query, resource_name, limit=None)[source]

Return all pathways having the query in their names.

Parameters
  • query (str) – query string

  • resource_name (str) – database name

  • limit (Optional[int]) – limit result query

Return type

list[Pathway]

Index