示例#1
0
文件: parsing.py 项目: ABorrel/ionic
def methodStructure (namePDB):
    l_lines = loadFile.openPdbFile(namePDB)
    
    for l in l_lines : 
        if search("^EXPDTA", l) and search("SOLUTION", l) :
            return "SOLUTION"
    return "XRAY" 
示例#2
0
文件: parsing.py 项目: ABorrel/ionic
def Quality(namePDB):
    """Retrieve by PDB file the Quality if X-ray header
    in : name of pdb file
    out : Quality -> format float, return 1000.00 if have not Quality in file"""

    l_lines = loadFile.openPdbFile(namePDB)
    nb_line = len (l_lines)

    i = 0
    while i < nb_line :
        if "rfactor" in locals ().keys () and "resolution" in locals ().keys () :
            return [resolution, rfactor]
        if search("^REMARK   2 RESOLUTION", l_lines[i]):
            line = sub('[ ]{2,}', ' ', l_lines[i])
            try:
                resolution = formatCharacter.formatFloat(line.split(" ")[3])
            except:
                resolution = 1000.0
        
        elif search ("REMARK   3   R VALUE", l_lines[i]) : 
            rfactor = l_lines[i].strip ().split (":")[-1].replace (" ", "")
            if rfactor == "NULL" : 
                rfactor = 0.0
            else : 
                rfactor =  float (rfactor)
        i = i + 1
    
    return [1000.0, 100.0]
示例#3
0
文件: parsing.py 项目: ABorrel/ionic
def header(namePDB):
    """Retrieve for one PDB file the header
    in : name PDB file
    out : header -> format string lower"""

    l_lines = loadFile.openPdbFile(namePDB)
    return l_lines[0][6:].lower().strip ()
示例#4
0
def neighbors(rayon, atom_central, pdb, subs = "global", l_atom_lig = [] ): # change the name because in the same time function and variable
    """Search neighbors for all ligand
    in : rayon where is atoms, central atom, pdb file
    out : list atoms found"""

    l_atom = []
    linesPDB = loadFile.openPdbFile(pdb)
    for line in linesPDB:
        if search("^ATOM", line) or search("^HETATM", line): 
            atom = parsing.lineCoords(line)
            if atom != {} and atom["element"] != "H":
                distance = calcul.distanceTwoatoms(atom_central, atom)
                if distance <= rayon and distance != 0.0:
                    if atom_central["resSeq"] != atom["resSeq"]: # check if variation
                        if tool.atomInList(l_atom, atom) == 0:
                            atom["distance"] = distance
                            atom["angleSubs"] = calcul.angleSubs(atom_central, atom, l_atom_lig, subs)
                            atom["classification"] = structure.classificationATOM(atom)
                            l_atom.append(atom)

    return l_atom