Пример #1
0
    def __init__(self,params):
        '''
        Constructor uses dictionary to accept arguments
        '''
        if params.has_key("coords"):
            coords = params["coords"]
        else:
            coords=[0.0,0.0,0.0]
            
        if params.has_key("name"):
            name = params["name"]
        else:
            name = "atom"      
              
        if params.has_key("resname"):
            self.resname = params["resname"]
        else:
            self.resname = "UNK"                    
            
        Atom.__init__(self,name,coords)               
        
        if params.has_key("resid"):
            self.resid = params["resid"]
        else:
            self.resid = 1              

        if params.has_key("element"):
            self.element = params["element"]
        else:
            if name != "atom":
                self.element = AtomDictionary.elementName(name)
            else:
                self.element = "atom"    
Пример #2
0
    print "creating first atom"
    aline1="ATOM    588 1HG  GLU    18     -13.363  -4.163  -2.372  1.00  0.00           H"
    print aline1
    a = ResAtom.fromPDBrecord(aline1)   
    print "it should come out as this"
    print a
    aline2="ATOM    589 2HG  GLU    18     -12.634  -3.023  -3.475  1.00  0.00           H"

    print "creating second atom"
    aline2="ATOM    589 2HG  GLU    18     -12.634  -3.023  -3.475  1.00  0.00           H"
    print aline2
    b = ResAtom.fromPDBrecord(aline2)   
    print "it should come out as this"
    print b

    print "The distance between these two atoms is", Atom.bondlength(a, b)
    
    print "PDB record for second atom with starting index 5 and resid 23" 
    print b.toPDBrecord(id_atom=5,id_res=23)

    
#    PDB ATOM RECORD FORMAT
#    COLUMNS      DATA TYPE        FIELD      DEFINITION
#    ------------------------------------------------------
#     1 -  6      Record name      "ATOM    "
#     7 - 11      Integer          serial     Atom serial number.
#    13 - 16      Atom             name       Atom name.
#    17           Character        altLoc     Alternate location indicator.
#    18 - 20      Residue name     resName    Residue name.
#    22           Character        chainID    Chain identifier.
#    23 - 26      Integer          resSeq     Residue sequence number.