Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::SCOP::Scop::__init__ (   self,
  cla_handle = None,
  des_handle = None,
  hie_handle = None 
)

Build the SCOP hierarchy from the SCOP parsable files.

If no file handles are given, then a Scop object with a single
empty root node is returned.

Definition at line 100 of file __init__.py.

00100                                                                          :
        """Build the SCOP hierarchy from the SCOP parsable files.

        If no file handles are given, then a Scop object with a single
        empty root node is returned.
        """
        self.root = Node()
        self._sidDict = {}
        self._sunidDict = {}

        if cla_handle==des_handle==hie_handle==None: return 

        if cla_handle == None or des_handle==None or hie_handle==None:
             raise RuntimeError,"Need CLA, DES and HIE files to build SCOP" 

        sunidDict = {}

        #Build the root node
        root = Node()
        domains = []
        root.sunid='0'
        sunidDict[root.sunid] = root
        self.root = root
        self.description = 'SCOP'

        # Build the rest of the nodes using the DES file
        i = Des.Iterator(des_handle, Des.Parser())
        while 1 :
            rec = i.next() 
            if rec is None : break
            if rec.nodetype =='px' :
                n = Domain()
                n.sid = rec.name
                domains.append(n)
            else : 
                n = Node()
            n.sunid = rec.sunid
            n.type = rec.nodetype
            n.sccs = rec.sccs
            n.description = rec.description
            
            sunidDict[n.sunid] = n
 
        # Glue all of the Nodes together using the HIE file
        i = Hie.Iterator(hie_handle, Hie.Parser())
        while 1 :
            rec = i.next()
            if rec is None : break
            if not sunidDict.has_key(rec.sunid) :
                print rec.sunid
    
            n = sunidDict[rec.sunid]

            if rec.parent : # Not root node
                if not sunidDict.has_key(rec.parent):
                    raise SyntaxError, "Incomplete data?"
                                       
                n.parent = sunidDict[rec.parent]
                
            for c in rec.children:
                if not sunidDict.has_key(c) :
                    raise SyntaxError, "Incomplete data?"
                n.children.append(sunidDict[c])


        # Fill in the gaps with information from the CLA file
        sidDict = {}
        i = Cla.Iterator(cla_handle, Cla.Parser())
        while 1 :
            rec = i.next()
            if rec is None : break
            n = sunidDict[rec.sunid]
            assert n.sccs == rec.sccs
            assert n.sid == rec.sid
            n.residues = rec.residues
            sidDict[n.sid] = n

        # Clean up
        self._sunidDict = sunidDict
        self._sidDict = sidDict
        self._domains = tuple(domains)




    def getDomainBySid(self, sid) :


Generated by  Doxygen 1.6.0   Back to index