From 991ce5a5ecd187a3dac793301dfca355417ca00b Mon Sep 17 00:00:00 2001 From: upreeti <61286706+upreeti@users.noreply.github.com> Date: Thu, 27 Feb 2020 08:16:44 -0500 Subject: [PATCH 1/4] Update run.py --- run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.py b/run.py index 935a46f..1d81b9f 100644 --- a/run.py +++ b/run.py @@ -10,7 +10,7 @@ def main(args): usage = ''' -PathLinker.py [options] NETWORK NODE_TYPES +run.py [options] NETWORK NODE_TYPES REQUIRED arguments: NETWORK - A tab-delimited file with one directed interaction per line. Each line should have at least 2 columns: tail, head. Edges From 7dcbc0158bc2a84f434233d3973a433bf3090551 Mon Sep 17 00:00:00 2001 From: upreeti <61286706+upreeti@users.noreply.github.com> Date: Thu, 19 Mar 2020 20:24:37 -0400 Subject: [PATCH 2/4] Update README.md --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 77d32f2..fbe9bfe 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,11 @@ See the publications referenced below for a formal description of the method. ### What's included - * **PathLinker.py** An end-to-end implementation of the PathLinker - algorithm. Given a network, a set or receptors, a set of - transcription factors, and a value of *k*, PathLinker outputs a ranked list of edges composing the *k* highest scoring paths connecting any receptor to any transcription factor. + * **run.py** An end-to-end implementation of the PathLinker algorithm. Given a + network, a set of receptors, and a set of transcription factors, run outputs a + ranked list of all the edges encountered in the *k* highest scoring paths + connecting any receptor to any transcription factor, as well as a list of all + the paths found by the ksp algorithm if requested. * **PageRank.py** An implementation of the PageRank algorithm. This algorithm can be used as a component of PathLinker, but it can also be run as a standalone tool. Given a weighted, directed network, PageRank uses the power method to compute the @@ -58,6 +60,10 @@ method. computes the *k* shortest simple paths betwen a source and target node. Here a path is *simple* if there are no repeated nodes in the path. + * **PathLinker.py** Given a network, a set of receptors, a set of transcription + factors, and a value of *k*, PathLinker modifies the structure of the graph to + calculate and output the *k* high-scoring paths from any receptor protein to any + transcriptional regulator. Run any of the programs with the --help option for full documentation. The /example directory contains a sample usage of these programs. From 48be7a5838a51bf8bcd738ae1902a83fb4f0bb27 Mon Sep 17 00:00:00 2001 From: upreeti <61286706+upreeti@users.noreply.github.com> Date: Mon, 18 May 2020 17:12:27 -0400 Subject: [PATCH 3/4] Update run.py --- run.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/run.py b/run.py index 1d81b9f..e8ef7f2 100644 --- a/run.py +++ b/run.py @@ -43,7 +43,7 @@ def main(args): help='Run PathLinker on only the largest weakly connected component of the graph. May provide performance speedup.') parser.add_option('', '--edge-penalty', type='float', default=1.0,\ - help='Factor by which to divide every edge weight. The effect of this option is to penalize the score of every path by a factor equal to (the number of edges in the path)^(this factor). (default=1.0)') + help='Factor by which to divide every edge weight. The effect of this option is to penalize the score of every path by a factor equal to (the number of edges in the path)^(weight). (default=1.0)') # Random Walk Group group = OptionGroup(parser, 'Random Walk Options') @@ -184,12 +184,10 @@ def main(args): ## Prepare the network to run KSP - # Remove improper edges from the sources and targets. This portion - # must be performed before the log transformation, so that the - # renormalization within accounts for the probability lost to the - # removed edges. These transformations are executed by default; - # to prevent them, use the opts.allow_mult_sources or opts.allow_mult_targets - # arguments. + # Remove improper edges from the sources and targets. If the user runs PageRank + # first, then this step will cause the total edge flux in the graph to be less than one. + # These transformations are executed by default to prevent them, use the + # opts.allow_mult_sources or opts.allow_mult_target arguments. if not opts.allow_mult_sources: pl.modifyGraphForKSP_removeEdgesToSources(net, sources) if not opts.allow_mult_targets: From 3e1c13d4b86aef7da23276b501ee226ffc10f123 Mon Sep 17 00:00:00 2001 From: upreeti <61286706+upreeti@users.noreply.github.com> Date: Mon, 18 May 2020 17:15:00 -0400 Subject: [PATCH 4/4] Update PathLinker.py --- PathLinker.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/PathLinker.py b/PathLinker.py index c4a74b8..087f151 100644 --- a/PathLinker.py +++ b/PathLinker.py @@ -105,14 +105,7 @@ def applyEdgePenalty(net, weight): """ Applies a user-specified edge penalty to each edge. This weight penalizes the score of every path by a factor equal to - (the number of edges in the path)^(this factor). - - This was previously done in the logTransformEdgeWeights method - with a parameter weight=(sum of all edge weights). In the - "standard" PathLinker case, this was necessary to account for the - probability that is lost when edges are removed in - modifyGraphForKSP_removeEdges(), along with the probability lost - to zero degree nodes in the edge flux calculation. + (the number of edges in the path)^(weight). :param net: NetworkX graph :param weight: user-specified edge penalty @@ -133,9 +126,6 @@ def logTransformEdgeWeights(net): converting multiplicative values (where higher is better) to additive costs (where lower is better). - Before the transformation, weights are normalized to sum to one, - supporting an interpretation as probabilities. - If the weights in the input graph correspond to probabilities, shortest paths in the output graph are maximum-probability paths in the input graph.