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]