Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.SCOP.Node Class Reference
Inheritance diagram for Bio.SCOP.Node:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__
def toHieRecord
def toDesRecord
def getChildren
def getParent
def getDescendents
def getAscendent

Public Attributes

 sunid
 parent
 children
 sccs
 type
 description
 scop

Detailed Description

A node in the Scop hierarchy

sunid  -- SCOP unique identifiers. e.g. '14986'

parent -- The parent node

children -- A list of child nodes

sccs     -- SCOP concise classification string. e.g. 'a.1.1.2'

type     -- A 2 letter node type code. e.g. 'px' for domains

description -- 

Definition at line 519 of file __init__.py.


Constructor & Destructor Documentation

def Bio.SCOP.Node.__init__ (   self,
  scop = None 
)
Create a Node in the scop hierarchy.  If a Scop instance is provided to the
constructor, this will be used to lookup related references using the SQL
methods.  If no instance is provided, it is assumed the whole tree exists
and is connected.

Reimplemented in Bio.SCOP.Domain.

Definition at line 535 of file __init__.py.

00535 
00536     def __init__(self, scop=None):
00537         """Create a Node in the scop hierarchy.  If a Scop instance is provided to the
00538         constructor, this will be used to lookup related references using the SQL
00539         methods.  If no instance is provided, it is assumed the whole tree exists
00540         and is connected."""
00541         self.sunid=''    
00542         self.parent = None
00543         self.children=[]
00544         self.sccs = ''   
00545         self.type =''    
00546         self.description =''
00547         self.scop=scop


Member Function Documentation

def Bio.SCOP.Node.__str__ (   self)

Reimplemented in Bio.SCOP.Domain.

Definition at line 548 of file __init__.py.

00548 
00549     def __str__(self):
00550         s = []
00551         s.append(str(self.sunid))
00552         s.append(self.sccs)
00553         s.append(self.type)
00554         s.append(self.description)
00555 
00556         return " ".join(s)

def Bio.SCOP.Node.getAscendent (   self,
  node_type 
)
Return the ancenstor node of the given type, or None.Node type can a
two letter code or longer description. e.g. 'fa' or 'family'

Definition at line 613 of file __init__.py.

00613 
00614     def getAscendent( self, node_type):
00615         """ Return the ancenstor node of the given type, or None.Node type can a
00616         two letter code or longer description. e.g. 'fa' or 'family'"""
00617         if node_type in _nodetype_to_code:
00618             node_type = _nodetype_to_code[node_type]
00619 
00620         if self.scop:
00621             return self.scop.getAscendentFromSQL(self,node_type)
00622         else:
00623             n = self
00624             if n.type == node_type: return None
00625             while n.type != node_type:
00626                 if n.type == 'ro': return None # Fell of the top of the hierarchy
00627                 n = n.getParent()            
00628                 
00629             return n
00630                                                             
00631     

def Bio.SCOP.Node.getChildren (   self)
Return a list of children of this Node

Definition at line 578 of file __init__.py.

00578 
00579     def getChildren(self):
00580         """Return a list of children of this Node"""
00581         if self.scop is None:
00582             return self.children
00583         else:
00584             return map ( self.scop.getNodeBySunid, self.children )

Here is the caller graph for this function:

def Bio.SCOP.Node.getDescendents (   self,
  node_type 
)
Return a list of all decendent nodes of the given type. Node type can a
two letter code or longer description. e.g. 'fa' or 'family'

Definition at line 592 of file __init__.py.

00592 
00593     def getDescendents( self, node_type):
00594         """ Return a list of all decendent nodes of the given type. Node type can a
00595         two letter code or longer description. e.g. 'fa' or 'family'
00596         """
00597         if node_type in _nodetype_to_code:
00598             node_type = _nodetype_to_code[node_type]
00599             
00600         nodes = [self]
00601         if self.scop:
00602             return self.scop.getDescendentsFromSQL(self,node_type)
00603         while nodes[0].type != node_type:
00604             if nodes[0].type == 'px' : return [] # Fell of the bottom of the hierarchy
00605             child_list = []
00606             for n in nodes:
00607                 for child in n.getChildren():
00608                     child_list.append( child )
00609                 nodes = child_list
00610                 
00611         return nodes
00612                     

def Bio.SCOP.Node.getParent (   self)
Return the parent of this Node

Definition at line 585 of file __init__.py.

00585 
00586     def getParent(self):
00587         """Return the parent of this Node"""
00588         if self.scop is None:
00589             return self.parent
00590         else:
00591             return self.scop.getNodeBySunid( self.parent )

Here is the caller graph for this function:

def Bio.SCOP.Node.toDesRecord (   self)
Return a Des.Record

Reimplemented in Bio.SCOP.Domain.

Definition at line 569 of file __init__.py.

00569 
00570     def toDesRecord(self):
00571         """Return a Des.Record"""        
00572         rec = Des.Record()
00573         rec.sunid = str(self.sunid)
00574         rec.nodetype = self.type
00575         rec.sccs = self.sccs
00576         rec.description = self.description
00577         return rec

def Bio.SCOP.Node.toHieRecord (   self)
Return an Hie.Record

Definition at line 557 of file __init__.py.

00557 
00558     def toHieRecord(self):
00559         """Return an Hie.Record"""
00560         rec = Hie.Record()
00561         rec.sunid = str(self.sunid)
00562         if self.getParent() : #Not root node
00563             rec.parent = str(self.getParent().sunid)
00564         else:
00565             rec.parent = '-'
00566         for c in self.getChildren():
00567             rec.children.append(str(c.sunid))
00568         return rec
    

Here is the call graph for this function:


Member Data Documentation

Definition at line 542 of file __init__.py.

Definition at line 545 of file __init__.py.

Definition at line 541 of file __init__.py.

Definition at line 543 of file __init__.py.

Definition at line 546 of file __init__.py.

Definition at line 540 of file __init__.py.

Definition at line 544 of file __init__.py.


The documentation for this class was generated from the following file: