Пример #1
0
    def __init__(self, id=None, parent=None, elementType=Residue, list=None,
                 childrenName='residues', setClass=ChainSet,
                 childrenSetClass=ResidueSet, top=None, childIndex=None,
                 assignUniqIndex=1):
        """Chain constructor.
        Arguments:
        id (string)
        optional parent (instance of a TreeNode)
        optional elementType (instance of class inheriting from TreeNode)"""

        Molecule.__init__(self, str(id), parent, elementType, list,
                          childrenName, setClass, childrenSetClass, top,
                          childIndex, assignUniqIndex)
        self.id = id
        self.hasBonds = 0 # 1 for bondsByDistance is supported
        self.gaps = []    # list to store tuple (Res, Res) define the edge of a gap
Пример #2
0
    def __init__(self, name='NoName', parent=None, elementType=Chain,
                 list=None, childrenName='chains', setClass=ProteinSet,
                 childrenSetClass=ChainSet, top=None, childIndex=None,
                 assignUniqIndex=1):
        """Protein constructor.
        Arguments:
        name (string)
        optional parent (instance of a TreeNode)
        optional elementType (instance of class inheriting from TreeNode,
        defaults to Chain)"""

        Molecule.__init__(self, name=name, parent=parent,
                          elementType=elementType, list=list,
                          childrenName=childrenName,
                          setClass=setClass,
                          childrenSetClass=childrenSetClass, top=top,
                          childIndex=childIndex, assignUniqIndex=assignUniqIndex)
        self.bondsflag = 0
        self.hasSS = []
        self.hasBonds = 0 # 1 for bondsByDistance is supported
Пример #3
0
 def __init__(self, type='UNK', number=-1, icode='', parent=None,
              elementType=Atom, list=None, childrenName='atoms',
              setClass=ResidueSet,
              childrenSetClass=AtomSet, top=None, childIndex=None,
              assignUniqIndex=1):
     """Residue constructor.
     Arguments:
     type (string)
     number (integer or string)
     icode (1character) insertion code
     optional parent (instance of a TreeNode)
     optional elementType (instance of class inheriting from TreeNode)"""
     name = type+str(number)+icode
     Molecule.__init__(self, name, parent, elementType,
                       list, childrenName, setClass, childrenSetClass, top,
                       childIndex, assignUniqIndex)
     self.type = type
     self.number = number
     self.icode = icode
     self.psi  = None # not calculated
     self.phi  = None # not calculated
Пример #4
0
    def build2LevelsTree(self, atomlines):
        """
        Function to build a two level tree. 
        """
        print 'try to build a 2 level tree'
        self.mol = Molecule()
        self.mol.allAtoms = AtomSet()
        self.mol.atmNum = {}
        self.mol.parser = self
        if self.mol.name == 'NoName':
            self.mol.name = os.path.basename(
                os.path.splitext(self.filename)[0])

        self.mol.children = AtomSet([])
        self.mol.childrenName = 'atoms'
        self.mol.childrenSetClass = AtomSet
        self.mol.elementType = Atom
        self.mol.levels = [Molecule, Atom]
        ##1/18:self.mol.levels = [Protein, Atom]
        for atmline in atomlines:
            atom = Atom(atmline[1],
                        self.mol,
                        chemicalElement=string.split(atmline[5], '.')[0],
                        top=self.mol)
            #atom.element = atmline[5][0]
            atom.element = atom.chemElem
            atom.number = int(atmline[0])
            self.mol.atmNum[atom.number] = atom
            atom._coords = [[
                float(atmline[2]),
                float(atmline[3]),
                float(atmline[4])
            ]]
            if len(atmline) >= 9:
                atom._charges['mol2'] = float(atmline[8])
                atom.chargeSet = 'mol2'
#            atom.conformation = 0
            atom.hetatm = 0
            #add altname so buildBondsByDist doesn't croak
            atom.altname = None
            self.mol.allAtoms.append(atom)
        self.mol.atoms = self.mol.children
Пример #5
0
 def isBelow(self, Klass):
     if Klass is Molecule: Klass=Protein
     return Molecule.isBelow(self, Klass)