[Biopython-dev] interaction networks in biopython
Michiel de Hoon
mdehoon at c2b2.columbia.edu
Sun Jun 3 03:14:36 UTC 2007
Jake Feala wrote:
> Here is an example that worked fine for me:
> from Network import *
> f = open(<GRID flat file from http://theBioGRID.org>)
> parser = GRIDIterator(f):
> net = create_network()
> net.load(parser)
>
To be more consistent with recent parsers in Biopython, this would be
more appropriate:
>>> import Network
>>> f = open(<GRID flat file from http://theBioGRID.org>)
>>> net = Network.parse(f, format="GRID")
Also, assuming that
>>> net = create_network()
creates a NetworkObject representing an empty network, you could instead
use the initialization function of Network objects. As in
>>> import Network
>>> net = Network.NetworkObject()
For the example above, you might then also consider
>>> import Network
>>> f = open(<GRID flat file from http://theBioGRID.org>)
>>> net = Network.NetworkObject(f, format="GRID")
instead of using "parse".
I'm using "NetworkObject" here only as a placeholder to distinguish it
from the Network module; there are probably better names.
--Michiel.
More information about the Biopython-dev
mailing list