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. diff --git a/README.md b/README.md index 7dfd3ef..ec54095 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ method. ### What's included * **run.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. + algorithm. Given a network, a set or receptors, and a set of + transcription factors, run outputs a ranked list of edges encountered in the *k* highest scoring paths connecting any receptor to any transcription factor. * **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 +58,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. diff --git a/run.py b/run.py index 935a46f..e8ef7f2 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 @@ -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: