Neo4j Models

class NetExplorer.models.neo4j_models.Document(*args, **kwargs)

Class for Documents uploaded to the server.

exception DoesNotExist
exception MultipleObjectsReturned
docfile

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world', 'r') as f:
...     instance.file = File(f)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class NetExplorer.models.neo4j_models.Domain(accession, description=None, identifier=None, mlength=None)

Class for PFAM domains.

accession

String with accession for pfam domain (PFXXXXX).

Type

str

description

String with description for pfam domain.

Type

str

identifier

String with identifier for pfam domain.

Type

str

mlength

Integer with domain length.

Type

int

pfam_regexp

Class attribute. Regex for PFAM domain accessions.

Type

str

Parameters
  • accession (str) – String with accession for pfam domain (PFXXXXX).

  • description (str, optional) – String with description for pfam domain.

  • identifier (str, optional) – String with identifier for pfam domain.

  • mlength (int, optional) – Integer with domain length.

  • pfam_regexp (str, optional) – Class attribute. Regex for PFAM domain accessions.

get_planarian_contigs(database)

Returns a list of PlanarianContigs of ‘database’.

Parameters

database – str, database from which to retrieve the planarian contigs.

Returns

PlanarianContigs with this domain annotated.

Return type

list of PlanarianContigs

Raises

NodeNotFound – raised if there are no planarian contigs with this Domain.

classmethod is_symbol_valid(symbol)

Classmethod for checking if accession is a valid PFAM accession.

Parameters

symbol (str) – Symbol to check if it’s a valid PFAM accession.

Returns

True if it is valid, False otherwise.

Return type

bool

pfam_regexp = 'PF\\d{5}'
class NetExplorer.models.neo4j_models.ExperimentList(user)

Maps a list of experiment objects with all its available samples in the DB.

experiments

Set of oldExperiment instances.

Type

set of oldExperiment

samples

Experiments to sample names mapping. Key is experiment identifier, value is set of sample names (str).

Type

dict

datasets

Dictionary with list of datasets for which experiment has data for.

Type

dict

Parameters

user (models.user) – User that requests the ExperimentList.

get_datasets(experiment)

Returns a set for the given experiment

Parameters

experiment (str) – Experiment name.

Returns

Dataset names for which experiment has data for.

Return type

list

Raises

ExperimentNotFound – If experiment is not in ExperimentList.

get_samples(experiment)

Returns a set for the given experiment.

Parameters

experiment (str) – Experiment name.

Returns

Samples for which experiment has expression data for.

Return type

set

Raises

ExperimentNotFound – If experiment is not in ExperimentList.

class NetExplorer.models.neo4j_models.GeneOntology(accession, domain=None, name=None, human=False, query=True)

Class for GeneOntology nodes.

accession

GO accession, of the form “GO:…”.

Type

str

domain

GO domain (“molecular function”, “cellular component”, “biological process”).

Type

str

name

GO name.

Type

str

human_nodes

List of HumanNode instances that have this GO annotated.

Type

list of HumanNode

Parameters
  • accession (str) – GO accession, of the form “GO:…”.

  • domain (str, optional) – GO domain (“molecular function”, “cellular component”, “biological process”). Defaults to None

  • name (str, optional) – GO name. Defaults to None

  • human (list of HumanNode, optional) – List of HumanNode instances that have this GO annotated. Defaults to False

  • query (bool, optional) – Flag to query database on creation to retrieve all attributes.

_GeneOntology__query_go()

Query DB and get domain.

Raises

NodeNotFound – If GO does not exist in database.

get_human_genes()

Gets Human nodes symbols with annotated GO. Fills human_nodes attribute.

Raises

NodeNotFound – If GO does not exist in database.

get_planarian_contigs(database)

Gets planarian contigs whose homolog has the GO annotated. (GO)<-(Human)<-(Contig)

Parameters

database (str) – Database string from which to retrieve the PlanarianContigs.

Returns

List of PlanarianContig objects.

Return type

list

go_regexp = 'GO:\\d{7}'
classmethod is_symbol_valid(symbol)

Checks if provided symbol is a valid GO accession.

Parameters

symbol (str) – Symbol to check if it’s a valid GO accession.

Returns

True if valid, false otherwise.

Return type

bool

class NetExplorer.models.neo4j_models.GeneSearch(sterm, database)

Class for node/gene searches

sterm

Term to search.

Type

str

database

Database to search for sterm.

Type

str

sterm_database

Database to which sterm belongs to.

Type

str

Parameters
  • sterm (str) – Term to search.

  • database (str) – Database to search for sterm.

get_human_genes()

Returns HumanNode objects independently of the search term used.

Returns

List of HumanNode instances.

HumanNode retrieved from sterm. It is able to work with sterm of the type: ‘Human’, ‘GO’.

Return type

list of HumanNode

get_planarian_contigs()

Returns PlanarianContig objects that match sterm independently of the search term used.

Returns

List of PlanarianContig instances.

PlanarianContigs retrieved from sterm. It is able to work with sterm of the type: ‘Smesgene’, ‘PFAM’, ‘GO’, ‘Human’, ‘PlanarianContig’.

Return type

list of PlanarianContig

get_planarian_genes()

Returns PlanarianGene objects that match sterm independently of the search term used.

Returns

List of PlanarianGene instances.

PlanarianGene retrieved from sterm. It is able to work with sterm of the type: ‘Smesgene’, ‘PFAM’, ‘GO’, ‘Human’, ‘PlanarianContig’.

Return type

list of PlanarianGene

infer_symbol_database()

Guesses to which database sterm belongs to. Compares the symbol in sterm to the valid patterns for each NodeType. Saves result in sterm_database.

Retrieves given search term in all databases: PlanarianGene + PlanarianContigs

Returns

List of Node of the type PlanarianGene or PlanarianContig.

Return type

list of Node

class NetExplorer.models.neo4j_models.GraphCytoscape

Class for a graph object. Holds nodes and edges of any type as long as they have a common interface (symbol attribute and to_jsondict() method).

nodes

Set of Node objects.

Type

set

edges

Set of PredInteraction objects.

Type

set

add_elements(elements)

Method that takes a list of node or PredInteraction objects and adds them to the graph.

Parameters

elements (list of PredInteraction or Node) – List of PredInteraction objects or Node objects to add to the graph.

Raises

ValueError – If any element in elements is not a Node or a PredInteraction.

add_graph(graph)

Adds elements of graph to this graph instance.

Parameters

graph (GraphCytoscape) – Graph to be merged.

add_interaction(interaction)

Adds a single interaction to the graph.

Parameters

node (PredInteraction) – PredInteraction instance to add to the graph.

add_node(node)

Adds a single node to the graph.

Parameters

node (Node) – Node instance to add to the graph.

define_important(vip_nodes)

Gets a list/set of nodes and defines them as important.

Parameters

vip_nodes (list) – List of Node instances.

filter(including)

Filters nodes and edges from the graph.

Parameters

including (set) – Set of Node instances that has to be kept. Only interactions where both nodes are in including will be kept.

get_connections()

Function that looks for the edges between the nodes in the graph and adds them to the attribute edges.

get_expression(experiment, samples)

Gets the expression for all the node objects in the graph. Returns a dictionary: expression_data[node.symbol][sample]

Parameters
  • experiment (str) – :obj:`oldExperiment instance.

  • samples (list) – List of samples for which to get expression.

Returns

Dictionary with expression data.

Primary key is node symbol, secondary key is sample name and value is expression value (float).

Return type

dict of dict

classmethod get_genes_bulk(symbols, database)

Returns a dictionary of planarian genes to the specified list of planarian contig symbols from database.

Parameters
  • symbols (list of str) – List of node symbols.

  • database (str) – Database string.

Returns

Dictionary with contig-gene mapping.

Primary key is planarian contig symbol, secondary key is either ‘gene’ or ‘name’, value is gene symbol or gene name respectively.

Return type

dict of dict

classmethod get_homologs_bulk(symbols, database)

Returns a dictionary of homologous genes to the specified list of planarian contig symbols from database.

Parameters
  • symbols (list of str) – List of node symbols.

  • database (str) – Database string.

Returns

Dictionary with homology information.

Key is planarian contig symbol, value is human gene symbol.

Return type

dict

is_empty()

Checks if the graph is empty or not.

Returns

True if empty (no nodes or edges), False otherwise.

Return type

bool

new_nodes(symbols, database)

Takes a list of symbols and returns the necessary GraphCytoscape with Human or PlanarianContig objects

Parameters
  • symbols (list of str) – List of strings with gene/contig/pfam/go/kegg symbols.

  • database (str) – String with database.

to_json()

Converts the graph to a json string to add it to cytoscape.js.

Returns

JSON string with data for this graph for cytoscape.js.

Follows the structure (example):

{
    "nodes":
        [
            {
                "data":
                    {
                        "id": "dd_Smed_v6_11363_0_1",
                        "name": "dd_Smed_v6_11363_0_1",
                        "database": "Dresden",
                        "homolog": "LIG4",
                        "degree": 27,
                        "colorNODE": "#404040"
                    }
                },
            {
                "data":
                    {
                        "id": "dd_Smed_v6_9219_0_1",
                        "name": "dd_Smed_v6_9219_0_1",
                        "database": "Dresden",
                        "homolog": "FAM214A",
                        "colorNODE": "#404040"
                    },
                    "classes": "important"
                },
            }
        ],
    "edges":
        [
            {
                "data": {
                    "id": "dd_Smed_v6_11363_0_1-dd_Smed_v6_9219_0_1",
                    "source": "dd_Smed_v6_9219_0_1",
                    "target": "dd_Smed_v6_11363_0_1",
                    "pathlength": 1,
                    "probability": 0.67,
                    "colorEDGE": "#72a555"
                }
            },
        ]
}

Return type

str

class NetExplorer.models.neo4j_models.HasDomain(domain, node, p_start, p_end, s_start, s_end, perc)

Class for relationships between a node and a Pfam domain annotated on the sequence.

domain

Domain object.

Type

Domain

node

Node object.

Type

Node

p_start

Integer describing the start coordinate (1-indexed) on the PFAM domain.

Type

int

p_end

Integer describing the end coordinate (1-indexed) on the PFAM domain.

Type

int

s_start

Integer describing the start coordinate (1-indexed) on the sequence.

Type

int

s_end

Integer describing the end coordinate (1-indexed) on the sequence.

Type

int

perc

Float with % of domain in sequence.

Type

float

to_jsondict()

Transforms data for Sequence-Domain relationship to a JSON string.

Returns

Dictionary with JSON structure. Has the following keys:

{
    'accession': 'Domain accession',
    'description': 'Domain description',
    'identifier': 'Domain identifier',
    'mlength': 'Length (in aa) of PFAM domain',
    'p_start': 'PFAM domain start coordinate',
    'p_end': 'PFAM domain end coordinate',
    's_start': 'PFAM domain sequence start coordinate',
    's_end': 'PFAM domain sequence start coordinate',
    'perc': 'Percentage of Domain in sequence'
}

Return type

dict

class NetExplorer.models.neo4j_models.Homology(human, blast_cov=None, blast_eval=None, nog_brh=None, pfam_sc=None, nog_eval=None, blast_brh=None, pfam_brh=None, prednode=None)

Class for homology relationships between a PlanarianContig and a HumanNode.

human

Human object.

Type

Human

blast_cov

Float with BLAST coverage value in %.

Type

float

blast_eval

Float with BLAST e-value.

Type

float

blast_brh

Bool flag indicating if homology is best reciprocal hit in BLAST alignment.

Type

bool

nog_brh

Bool flag indicating if homology is best reciprocal hit in EggNOG alignment.

Type

bool

nog_eval

Float with EggNOG alignment e-value.

Type

float

pfam_sc

Float with pfam meta-alignment score.

Type

float

pfam_brh

Bool flag indicating if homology is best reciprocal hit in pfam alignment.

Type

bool

prednode

PlanarianContig object.

Type

PlanarianContig

Parameters
  • human (Human) – Human object.

  • blast_cov (float, optional) – Float with BLAST coverage value in %.

  • blast_eval (float, optional) – Float with BLAST e-value.

  • blast_brh (bool, optional) – Bool flag indicating if homology is best reciprocal hit in BLAST alignment.

  • nog_brh (bool, optional) – Bool flag indicating if homology is best reciprocal hit in EggNOG alignment.

  • nog_eval (float, optional) – Float with EggNOG alignment e-value.

  • pfam_sc (float, optional) – Float with pfam meta-alignment score.

  • pfam_brh (bool, optional) – Bool flag indicating if homology is best reciprocal hit in pfam alignment.

  • prednode (PlanarianContig, optional) – PlanarianContig object.

class NetExplorer.models.neo4j_models.HumanNode(symbol, database, query=True)

Human node class definition. Inherits from ‘Node’.

summary

String with gene summary.

summary_source

String with the source of the summary.

allowed_databases = {'Human'}
get_homologs(database='ALL')

Gets all homologs of the specified database.

Parameters

database (str) – Database of desired homologous planarian contigs. Defaults to “ALL”.

Returns

Dictionary with homologous contigs to HumanNode.

{
    'database1': [Homology, Homology, ...],
    ...
}

Return type

dict

get_neighbours()

Gets HumanNodes that interact with this HumanNode. Not implemented yet.

get_planarian_contigs(database)

Gets all PlanarianContigs homologous to HumanNode.

Parameters

database (str) – Database from which to retrieve planarian contigs.

Returns

PlanarianContig objects.

Return type

list

get_planarian_genes(database)

Gets planarian gene objects (PlanarianGene) connected to HumanNode through contigs of dataset ‘database’, i.e.: (:Human)->(:Database)->(:Smesgene)

Parameters

database (str) – Database of contigs to get PlanarianGene

Returns

List of PlanarianGene instances.

Return type

list

get_summary()

Retrieves gene summary when available and saves it into attribute.

to_jsondict()

Serializes HumanNode to a dictionary for converting it to JSON.

Returns

Serialized HumanNode.

{
    'data':
        {
            'id': 'node identifier',
            'name': 'node name',
            'database': 'Human'
        }
}

Return type

dict

class NetExplorer.models.neo4j_models.KeggPathway(symbol, database)

Class for KeggPathways. Encapsulates a GraphCytoscape object in graphelements. Will query Kegg on creation.

symbol

Symbol for Kegg Pathway.

Type

str

database

Planarian database to which this KeggPathway will be mapped to.

Type

str

kegg_url

Url to the pathway in Kegg.

Type

str

graphelements

GraphCytoscape object that results from looking at the genes and interactions in the Pathway that appear in the neo4j database.

Type

GraphCytoscape

Parameters
  • symbol (str) – Symbol for Kegg Pathway.

  • database (str) – Planarian database to which this KeggPathway will be mapped to.

get_graph_from_kegg()

Connects to KEGG and extracts the elements of the pathway.

Returns

GraphCytoscape object that results from

looking at the genes and interactions in the Pathway that appear in the neo4j database. If Kegg can’t be reached or the pathway does not have any equivalent in PlanNET, the GraphCytoscape will be empty.

Return type

GraphCytoscape

class NetExplorer.models.neo4j_models.Node(symbol, database)

Base class for all the nodes in the database.

symbol

String containing the symbol attribute in Neo4j of a given node.

Type

str

database

The Label for the symbol in Neo4j.

Type

str

neighbours

List of Interaction objects connecting nodes adjacent to the Node.

Type

list of PredInteraction

domains

HasDomain objects describing domains in the sequence/node.

Type

list of HasDomain

allowed_databases

Class attribute. Set of allowed Labels for Node.

Type

set of str

_Node__query_node()

This method will be overriden by HumanNode or PlanarianContig. It will query the Neo4j database and it will get the required node.

domains_to_json()

This function will return a json string with the information about the domains of the node. You have to call “get_domains()” before!

Returns

JSON string with Domains data, see Domain.to_jsondict().

Return type

str

get_domains()

Gets domains annotated for a particular Node. It updates the Node attribute and it also returns the domain.

Returns

List of domains annotated for this Node. None if there are no domain annotations.

Return type

Union([list of Domain, None])

class NetExplorer.models.neo4j_models.Pathway(graph)

Class for pathways. They are basically GraphCytoscape objects with score property.

graph (

obj:`GraphCytoscape): Graphcytoscape object of the pathway.

Parameters

( (graph) – obj:`GraphCytoscape): Graphcytoscape object of the pathway.

score

Mean score of interactions in pathway.

Type

float

class NetExplorer.models.neo4j_models.PlanarianContig(symbol, database, sequence=None, name=None, gene=None, orf=None, homolog=None, important=False, degree=None, query=True)

Class for planarian nodes.

Parameters
  • symbol (str) – Node symbol.

  • database (str) – Label for Neo4j.

  • sequence (str) – Contig nucleotide sequence.

  • orf (str) – Open Reading Frame aa sequence.

  • name (str) – Name of the contig according to its gene annotation.

  • gene (PlanarianGene) – Gene predicted to have this transcript as a product.

  • homolog (Homology) – Homology object with human homolog gene.

  • important (bool) – Bool indicating if Node should be marked on graph visualization. Defaults to False.

  • degree (int) – Integer with the degree (number of connections) of the node.

  • query (bool) – Flat to indicate if database should be queried. Defaults to False.

symbol

Node symbol.

Type

str

database

Label for Neo4j.

Type

str

sequence

Contig nucleotide sequence.

Type

str

orf

Open Reading Frame aa sequence.

Type

str

orflength

Length of Open Reading Frame.

Type

int

gccount

% of GC in contig sequence.

Type

float

gene_ontologies

List of GeneOntology objects that its HumanNode has annotated.

Type

list

name

Name of the contig according to its gene annotation.

Type

str

gene

Gene predicted to have this transcript as a product.

Type

PlanarianGene

homolog

Homology object with human homolog gene.

Type

Homology

important

Bool indicating if Node should be marked on graph visualization. Defaults to False.

Type

bool

degree

Integer with the degree (number of connections) of the node.

Type

int

allowed_databases

Class attribute, dictionary with names of neo4j labels for planarian genes.

Type

dict

_PlanarianContig__query_node()

Gets node from neo4j and fills sequence, orf, length and homology attributes.

Raises

NodeNotFound – If node is not in database.

allowed_databases = {'Adamidi', 'Blythe', 'Consolidated', 'Cthulhu', 'Dresden', 'Gbrna', 'Graveley', 'Illuminaplus', 'Pearson', 'Smed454', 'Smedgd', 'Smest'}
get_all_information()

Fills all attributes of PlanarianContig by querying the database

get_expression(experiment, sample)

Gets expression data for a particular node, a particular experiment and a particular sample

get_gene_name()

Gets gene name if possible and loads gene and name attributes.

get_geneontology()

Gets Gene Ontologies of the homologous human protein.

get_genes()

Gets Genes to which this contig maps.

Returns

List of PlanarianGene objects that this contig is

associated with.

Return type

list

get_graphelements(including=None)

Returns a list of nodes and edges adjacent to the node.

get_homolog()

Tries to get the homologous human gene of this planarian transcript

get_neighbours()

Method to get the adjacent nodes in the graph and all the information about those connections (including the homology information, etc.). Fills attribute neighbours, which will be a list of PredInteraction objects.

get_neighbours_shallow()

Method to get adjacent nodes (and their degree) in the graph without homology information and only with path_length and probability for the interaction information. It also retrieves the degree of the neighbour nodes. Fills attribute neighbours, which will be a list of PredInteraction objects. Used by NetExplorer add_connection/expand

get_summary()

Fills attribute values that are not mandatory, with a summary of several features of the node. Fills attributes “length” and “orflength”.

path_to_node(target, plen)

Given a target node object, this method finds all the shortest paths to that node of length plen. If there aren’t any, it returns None.

Parameters
  • target (PlanarianContig) – Target gene in the graph.

  • plen (int) – Path length to consider. All paths from self to target will be of length = `plen.

Returns

Pathway between self and target or None if no pathway exists.

Return type

Union([Pathway, None])

to_jsondict()

This function takes a node object and returns a dictionary with the necessary structure to convert it to json and be read by cytoscape.js

Returns

Dictionary with serialized PlanarianContig.

{
    'data':
        {
            'id': 'contig id',
            'name': 'contig name',
            'database': 'contig database',
            'homolog': 'human homolog symbol',
            'degree': int,
            'colorNode': '#404040',
        },
    'classes': 'null or important'

}

Return type

dict

class NetExplorer.models.neo4j_models.PlanarianGene(symbol, database, name=None, start=None, end=None, strand=None, sequence=None, homolog=None, chromosome=None, query=True)

Class for PlanarianGenes (genes from Planmine 3.0 gene annotation)

symbol

Gene symbol (SMESG…).

Type

str

database

‘Smesgene’.

Type

str

name

Gene name (if any).

Type

str

start

Start coordinate in chromosome.

Type

int

end

End coordinate in chromosome.

Type

int

strand

Strand in chromosome (+1: Forward , -1: Reverse)

Type

int

sequence

Nucleotide sequence of gene.

Type

str

homolog

Homologous gene.

Type

HumanNode

chromosome

Chromosome name where gene is located.

Type

str

Parameters
  • symbol (str) – Gene symbol (SMESG…).

  • database (str) – ‘Smesgene’.

  • name (str, optional) – Gene name (if any). Defaults to None.

  • start (int) – Start coordinate in chromosome. Defaults to None.

  • end (int, optional) – End coordinate in chromosome. Defaults to None.

  • strand (int, optional) – Strand in chromosome (+1: Forward , -1: Reverse). Defaults to None.

  • sequence (str, optional) – Nucleotide sequence of gene. Defaults to None.

  • homolog (HumanNode, optional) – Homologous gene. Defaults to None.

  • chromosome (str, optional) – Chromosome name where gene is located. Defaults to None.

  • query (bool, optional) – Flag to decide if gene should be queried on creation. Defaults to False.

_PlanarianGene__query_node()

Queries PlanarianGene to get and fill the attributes from the database.

Raises

NodeNotFound – If gene is not in database.

allowed_databases = {'Smesgene'}
get_best_transcript()

Retrieves the longest transcript of preferred_database.

Returns

PlanarianContig from preferred database annotated

as being transcribed from this gene.

Return type

PlanarianContig

get_homolog()

Gets homologous gene of longest transcript associated with this PlanarianGene. Fills attribute ‘homolog’. Returns the HumanNode object.

Returns

Homologous HumanNode if there is any, otherwise None.

Return type

HumanNode or None

get_planarian_contigs(database=None)

Returns list PlanarianContig objects of database or all databases that map to the PlanarianGene genomic location.

Parameters

database (str, optional) – Database from which to retrieve planarian contigs. if not defined will get planarian contigs from all databases.

Returns

PlanarianContig objects associated with this

gene.

Return type

list of PlanarianContig

classmethod is_symbol_valid(symbol)

Checks if symbol is valid

Parameters

symbol (str) – Symbol to check if follows PlanarianGene naming convention.

Returns

True if symbol is a valid gene identifier. False otherwise.

Return type

bool

preferred_database = 'Smest'
smesgene_regexp = 'SMESG\\d+'
class NetExplorer.models.neo4j_models.PredInteraction(source_symbol, target, database, parameters=None, query=True)

Class for predicted interactions. Source and target are PlanarianContig attributes.

source_symbol

Symbol of parent node of interaction.

Type

str

target

Node object of the child node of the interaction.

Type

Node

database

Neo4j label of parent and child nodes.

Type

str

parameters

Dictionary containing the interaction properties. Has following structure:

{
    'int_prob': float,
    'path_length': int,
    'cellcom_nto': float,
    'molfun_nto': float,
    'bioproc_nto': float,
    'dom_int_sc': float
}
Type

dict

Parameters
  • source_symbol (str) – Symbol of parent node of interaction.

  • target (Node) – Node object of the child node of the interaction.

  • database (str) – Neo4j label of parent and child nodes.

  • parameters (dict, optional) –

    Dictionary containing the interaction properties. Defaults to None:

    {
        'int_prob': float,
        'path_length': int,
        'cellcom_nto': float,
        'molfun_nto': float,
        'bioproc_nto': float,
        'dom_int_sc': float
    }
    

  • query (bool) – Bool flag indicating if interaction should be queried to database on creation. Defaults to True. Query will only be performed if query = True and parameters = None.

_PredInteraction__query_interaction()

This private method will fetch the interaction from the DB. It will fill the attributes [‘int_prob’, ‘path_length’, ‘cellcom_nto’, ‘molfun_nto’, ‘bioproc_nto’, ‘dom_int_sc’] of the PredInteraction instance. If interaction is not found, they all will be None.

to_jsondict()

This function takes a PredInteraction object and returns a dictionary with the necessary structure to convert it to json and be read by cytoscape.js.

Returns

Serialized PredInteraction.

{
    'data':
        {
            'id': 'edge identifier',
            'source': 'node identifier',
            'target': 'node identifier',
            'pathlength': int,
            'probability': float,
            'colorEdge': 'HEX color code',
        }
}

Return type

dict

class NetExplorer.models.neo4j_models.WildCard(search, database)

Class for wildcard searches. Returns a list of symbols.

Parameters
  • search (str) – String to search.

  • database (str) – Database (label in neo4j) for the search.

search

String to search.

Type

str

database

Database (label in neo4j) for the search.

Type

str

get_human_genes()

Gets list of HumanNode objects matching the wildcard query.

Returns

HumanNode objects.

Return type

list

get_planarian_genes()

Gets list of PlanarianGene objects matching the wildcard query.

Returns

PlanarianGene objects.

Return type

list

class NetExplorer.models.neo4j_models.oldExperiment(identifier, url=None, reference=None)

Legacy class for gene expresssion experiments. Mantained until PlanExp is published.

id

Experiment identifier.

Type

str

url

Experiment publication URL.

Type

str

reference

Formatted publication reference.

Type

str

minexp

Minimum expression value in whole experiment.

Type

float

maxexp

Maximum expression value in whole experiment.

Type

float

percentiles

List of floats indicating the expression value at each percentile (15 in total).

Type

list of int

Parameters
  • id (str) – Experiment identifier.

  • url (str, optional) – Experiment publication URL. If not passed on creation, will query the database to get the data for this experiment.

  • reference (str, optional) – Formatted publication reference.

_oldExperiment__get_minmax()

Checks if the specified experiment exists in the database and gets the max, min expression ranges and the reference defined.

color_gradient(from_color, to_color, comp_type)

This method returns a color gradient of length bins from “from_color” to “to_color”.

Parameters
  • from_color (str) – Hex value of initial color for gradient.

  • to_color (str) – Hex value of final color for gradient.

  • comp_time (str) – “one-sample” or “two-sample”, indicating if gradient should be linear (“one-sample”) or divergent “two-sample”.

to_json()

Returns a json string with the info about the experiment.

Returns

JSON string with the following structure.

{
    'data':
        {
            'id': 'experiment identifier',
            'url': 'url of experiment' ,
            'reference': 'formatted reference',
            'minexp': float,
            'maxexp': float,
            'percentiles': [ float, float, float, ...]

        }
}

Return type

str