Skip to content

Commit

Permalink
adding additional documentation to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Dec 1, 2017
1 parent 0d29350 commit 46af928
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
6 changes: 3 additions & 3 deletions conekt/controllers/graph_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@


# TODO placeholder for the search function
@graph_comparison.route('/')
def graph_comparison_overview():
return "TEST"
# @graph_comparison.route('/')
# def graph_comparison_overview():
# return "TEST"


@graph_comparison.route('/cluster/<int:one>/<int:two>')
Expand Down
12 changes: 11 additions & 1 deletion conekt/helpers/cytoscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ def add_depth_data_nodes(network):

@staticmethod
def connect_homologs(network):
"""
Connects homologous (or orthologous) genes using a dashed edge. Requires a cytoscape.js compatible network as
input and will return a network with homologs connected. Note that gene families need to be present in the
network *before* applying this function. (e.g. using add_family_data_nodes in this class)
:param network:
:return:
"""
connected_network = deepcopy(network)
"""
Add edges between homologous genes from different targets, family_id needs to be specified !
Expand Down Expand Up @@ -411,7 +419,9 @@ def add_depth_data_edges(network):
@staticmethod
def prune_unique_lc(network):
"""
Remove genes from network that have an lc that occurs only once
Remove genes from network that have a unique label (label co-occ.). Requires a Cytoscape.js compatible network
and will return a purned copy in the same format. Note that label co-occ. need to be present in the
network *before* applying this function. (e.g. using add_lc_data_nodes in this class)
:param network: dict containing the network
:return: Cytoscape.js compatible network with the pruned network
Expand Down
22 changes: 20 additions & 2 deletions conekt/models/relationships/sequence_sequence_ecc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ class SequenceSequenceECCAssociation(db.Model):

@staticmethod
def get_ecc_network(sequence, network, family):
"""
Get network connecting a specific sequence to all genes with significant Expression Context Conservation.
:param sequence: internal ID of sequence
:param network: network method ID to consider
:param family: kind of gene families used to detect ECC
:return: network dict (can be made compatible using CytoscapeHelper)
"""
data = SequenceSequenceECCAssociation.query.filter(and_(
SequenceSequenceECCAssociation.query_id == sequence,
SequenceSequenceECCAssociation.query_network_method_id == network,
Expand Down Expand Up @@ -112,8 +121,8 @@ def get_ecc_network(sequence, network, family):
@staticmethod
def get_ecc_pair_network(ecc_id):
"""
Get all data for an SequenceSequenceECCAssociation to make a ECC graph
Get all data for an SequenceSequenceECCAssociation to make a ECC graph, similar to the pairwise comparisons in
Movahedi et al.
:param ecc_id: interal id of the SequenceSequenceECCAssociation
:return: ecc pair with neighborhood as graph dict
Expand Down Expand Up @@ -203,6 +212,15 @@ def get_ecc_pair_network(ecc_id):

@staticmethod
def get_ecc_multi_network(gf_method_id, sequence_ids):
"""
Creates an ECC network for multiple genes, the resulting network will contain all ECC partners of the input
genes. Pruning this network keeping only genes with non-unique label co-occurances is recommended !
:param gf_method_id: gene family method used to detect ECC
:param sequence_ids: sequences to include as the core of the network
:return: network dict
"""
associations = SequenceSequenceECCAssociation.query.\
filter(SequenceSequenceECCAssociation.gene_family_method_id == gf_method_id).\
filter(and_(SequenceSequenceECCAssociation.query_id.in_(sequence_ids),
Expand Down

0 comments on commit 46af928

Please sign in to comment.