Models

ComPath database model.

class compath.models.User(**kwargs)[source]

User table.

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.

property is_admin

Is this user an administrator?.

class compath.models.Role(**kwargs)[source]

Role table.

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.

class compath.models.PathwayMapping(**kwargs)[source]

Mapping table.

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.

service_1_name

service name (e.g., KEGG or Reactome

service_1_pathway_id

pathway 1 id

service_1_pathway_name

pathway 1 name

service_2_name

service name (e.g., KEGG or Reactome

service_2_pathway_id

pathway 2 id

service_2_pathway_name

pathway 2 name

type

Type of Mapping (isPartOf or equivalentTo)

accepted

accepted mapping by the admin/curator consensus

get_complement_mapping_info(service_name, pathway_id, pathway_name)[source]

Return the info corresponding to the other pathway in a mapping.

Parameters
  • mapping (PathwayMapping) –

  • service_name (str) – reference service name

  • pathway_id (str) – reference pathway id

  • pathway_name (str) – reference pathway name

Return type

tuple[str,str,str]

static has_pathway_tuple(type, service_name, pathway_id, pathway_name)[source]

Return a filter to get all mappings matching type, service and pathway name and id.

static has_descendant_pathway_tuple(type, service_name, pathway_id, pathway_name)[source]

Return a filter to get all the descendants mappings matching a isPartOf relationship (the predicates), service and pathway name and id.

static has_ancestry_pathway_tuple(type, service_name, pathway_id, pathway_name)[source]

Return a filter to get all the ancestries mappings matching a isPartOf relationship (the subjects), service and pathway name and id.

static has_pathway(service_name, pathway_id, pathway_name)[source]

Return a filter to get all mappings matching service and pathway name and id.

static has_database_pathway(service_name)[source]

Return a filter to get all mappings matching service a name.

property count_votes

Return the number of votes for this mapping.

Return type

int

property count_creators

Return the number of creator that claimed this mapping.

Return type

int

property count_up_votes

Return the number of up votes for this mapping.

Return type

int

property count_down_votes

Return the number of down votes for this mapping.

Return type

int

property is_acceptable

Return true if the mapping has enough votes to be accepted.

Return type

bool

get_user_vote(user)[source]

Return votes given by the user.

class compath.models.Vote(**kwargs)[source]

Vote table.

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.

type

Type of vote, by default is up-vote