So I guess I understand that. However, what I mean is what is your method for looking up the correct edge to put in the graph? Defining the contents of the edgeDB means that you already know the nodes and the relationships between them. So, in the code leading up to the assignment of an edge between two nodes, how do you get the right edge? It seems that there is some other data structure (a dictionary that takes a pair of exons, for example) to look up the right edge in the edgeDB that is assigned to G[exon1][exon2]:
some_edge = some_edge_dict[(exon1, exon2)] # where this returns an object from edgeDB G[exon1][exon2] = some_edge Am I missing something here? :P On Jul 24, 3:39 pm, Christopher Lee <[email protected]> wrote: > On Jul 24, 2009, at 10:42 AM, Kenny Daily wrote: > > > > > I guess what I mean then is how are the edges assigned in the graph? > > When you do something like: > > >>>> G[exon1][exon2] = some_edge > > > what is 'some_edge'? Is it an index? Is it an object created from the > > database? > > Ordinarily, just like exon1 and exon2, it is an object from a > database, in this case from edgeDB. Alternatively, in the > modification that you and I were discussing, it became simply an int, > that would be stored directly. > > > > > How does the Graph object know that there is an edge between exon1 and > > exon2, just by creating Graph(sourceDB=exonDB, targetDB=exonDB, > > edgeDB=spliceDB)? > > Instantiating a Graph object creates an *empty* graph, to which you > then add nodes via > > graph += node > > and add edges via > > graph[node1][node2] = edge > > When you instantiate the Graph object, you are just telling it your > *schema* ("I want to create a graph that maps source nodes from > sourceDB to target nodes from targetDB, with edge information from > edgeDB"). > > -- Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---
