compute_surface/extract_xyzrn.py
def extract_xyzrn(pdb_id, chain):
    """
        pdbfilename: input pdb filename
        xyzrnfilename: output in xyzrn format.
    """
    pdbfilename = os.path.join(dir_opts['protonated_pdb_dir'],pdb_id+'_'+chain+'.pdb')
    # pdbfilename = os.path.join(dir_opts['chain_pdb_dir'],pdb_id+'_'+chain+'.pdb')

    xyzrnfilename = os.path.join(dir_opts['xyzrn_dir'],pdb_id+'_'+ chain+'.xyzrn')
    if not os.path.exists(dir_opts['xyzrn_dir']):
        os.makedirs(dir_opts['xyzrn_dir'])

    parser = PDBParser()
    struct = parser.get_structure(pdbfilename, pdbfilename)

    out_list=[]
    for atom in struct.get_atoms():
        name = atom.get_name()
        residue = atom.get_parent()
        # Ignore hetatms.
        if residue.get_id()[0] != " ":
            continue
        resname = residue.get_resname().strip()
        chain = residue.get_parent().get_id()
        atomtype = name[0]

        coords=None
        if atomtype in radii:

            coords = "{:.06f} {:.06f} {:.06f}".format(
                atom.get_coord()[0], atom.get_coord()[1], atom.get_coord()[2]
            )
            insertion="x"
            if residue.get_id()[2] != " ":
                insertion=residue.get_id()[2]
            full_id = "{}_{:d}_{}_{}_{}".format(
                chain, residue.get_id()[1], insertion, resname, name
            )
        if coords is not None:
            out_list.append(coords + " " + radii[atomtype] + " 1 " + full_id + "\n")
    outfile = open(xyzrnfilename, "w")
    outfile.writelines(out_list)
    outfile.close()
    #return xyzrnfilename

        pdbfilename: input pdb filename
        xyzrnfilename: output in xyzrn format.
    
input pdb filename
xyzrnfilename: output in xyzrn format.
input pdb filename xyzrnfilename : output in xyzrn format .
def extract_xyzrn(pdb_id, chain):
    pdbfilename = os.path.join(dir_opts['protonated_pdb_dir'],pdb_id+'_'+chain+'.pdb')
    xyzrnfilename = os.path.join(dir_opts['xyzrn_dir'],pdb_id+'_'+ chain+'.xyzrn')
    if not os.path.exists(dir_opts['xyzrn_dir']):
        os.makedirs(dir_opts['xyzrn_dir'])
    parser = PDBParser()
    struct = parser.get_structure(pdbfilename, pdbfilename)
    out_list=[]
    for atom in struct.get_atoms():
        name = atom.get_name()
        residue = atom.get_parent()
        if residue.get_id()[0] != " ":
            continue
        resname = residue.get_resname().strip()
        chain = residue.get_parent().get_id()
        atomtype = name[0]
        coords=None
        if atomtype in radii:
            coords = "{:.06f} {:.06f} {:.06f}".format(
                atom.get_coord()[0], atom.get_coord()[1], atom.get_coord()[2]
            )
            insertion="x"
            if residue.get_id()[2] != " ":
                insertion=residue.get_id()[2]
            full_id = "{}_{:d}_{}_{}_{}".format(
                chain, residue.get_id()[1], insertion, resname, name
            )
        if coords is not None:
            out_list.append(coords + " " + radii[atomtype] + " 1 " + full_id + "\n")
    outfile = open(xyzrnfilename, "w")
    outfile.writelines(out_list)
    outfile.close()
def extract_xyzrn ( pdb_id , chain ) : pdbfilename = os . path . join ( dir_opts [ 'protonated_pdb_dir' ] , pdb_id + '_' + chain + '.pdb' ) xyzrnfilename = os . path . join ( dir_opts [ 'xyzrn_dir' ] , pdb_id + '_' + chain + '.xyzrn' ) if not os . path . exists ( dir_opts [ 'xyzrn_dir' ] ) : os . makedirs ( dir_opts [ 'xyzrn_dir' ] ) parser = PDBParser ( ) struct = parser . get_structure ( pdbfilename , pdbfilename ) out_list = [ ] for atom in struct . get_atoms ( ) : name = atom . get_name ( ) residue = atom . get_parent ( ) if residue . get_id ( ) [ 0 ] != " " : continue resname = residue . get_resname ( ) . strip ( ) chain = residue . get_parent ( ) . get_id ( ) atomtype = name [ 0 ] coords = None if atomtype in radii : coords = "{:.06f} {:.06f} {:.06f}" . format ( atom . get_coord ( ) [ 0 ] , atom . get_coord ( ) [ 1 ] , atom . get_coord ( ) [ 2 ] ) insertion = "x" if residue . get_id ( ) [ 2 ] != " " : insertion = residue . get_id ( ) [ 2 ] full_id = "{}_{:d}_{}_{}_{}" . format ( chain , residue . get_id ( ) [ 1 ] , insertion , resname , name ) if coords is not None : out_list . append ( coords + " " + radii [ atomtype ] + " 1 " + full_id + "\n" ) outfile = open ( xyzrnfilename , "w" ) outfile . writelines ( out_list ) outfile . close ( )
pdbfilename: input pdb filename
xyzrnfilename: output in xyzrn format.
pdbfilename : input pdb filename xyzrnfilename : output in xyzrn format .
"""
        pdbfilename: input pdb filename
        xyzrnfilename: output in xyzrn format.
    """ # pdbfilename = os.path.join(dir_opts['chain_pdb_dir'],pdb_id+'_'+chain+'.pdb') # Ignore hetatms. #return xyzrnfilename
pdb_id
chain