frag_pele/Helpers/checker.py
def check_and_fix_pdbatomnames(pdb_file):
    """
    It checks if atoms of the ligand of a PDB file contains the character 'G' (usually added by FrAG to identify atoms
    that have been grown) and modify the name of these atoms adding it element symbol to the PDB atom name.
    :param pdb_file: PDB file. str
    :return: it rewrites the PDB file applying the modifications.
    """
    with open(pdb_file) as pdb:
        content = pdb.readlines()
        check_duplicated_pdbatomnames(content)
        for i, line in enumerate(content):
            if line.startswith("HETATM") and line[21:22] == "L":
                atom_name = line[12:16]
                if atom_name.strip().startswith("G"):
                    new_atom_name = line[77:78] + atom_name.strip()
                    line_to_list = list(line)
                    line_to_list[12:16] = new_atom_name + " " * (4-len(new_atom_name))
                    line_to_list = "".join(line_to_list)
                    content[i] = line_to_list
        check_duplicated_pdbatomnames(content)
        new_pdb = "".join(content)
    with open(pdb_file, "w") as writepdb:
        writepdb.write("{}".format(new_pdb))

    It checks if atoms of the ligand of a PDB file contains the character 'G' (usually added by FrAG to identify atoms
    that have been grown) and modify the name of these atoms adding it element symbol to the PDB atom name.
    :param pdb_file: PDB file. str
    :return: it rewrites the PDB file applying the modifications.
    
It checks if atoms of the ligand of a PDB file contains the character 'G' (usually added by FrAG to identify atoms
that have been grown) and modify the name of these atoms adding it element symbol to the PDB atom name.
It checks if atoms of the ligand of a PDB file contains the character ' G ' ( usually added by FrAG to identify atoms that have been grown ) and modify the name of these atoms adding it element symbol to the PDB atom name .
def check_and_fix_pdbatomnames(pdb_file):
    with open(pdb_file) as pdb:
        content = pdb.readlines()
        check_duplicated_pdbatomnames(content)
        for i, line in enumerate(content):
            if line.startswith("HETATM") and line[21:22] == "L":
                atom_name = line[12:16]
                if atom_name.strip().startswith("G"):
                    new_atom_name = line[77:78] + atom_name.strip()
                    line_to_list = list(line)
                    line_to_list[12:16] = new_atom_name + " " * (4-len(new_atom_name))
                    line_to_list = "".join(line_to_list)
                    content[i] = line_to_list
        check_duplicated_pdbatomnames(content)
        new_pdb = "".join(content)
    with open(pdb_file, "w") as writepdb:
        writepdb.write("{}".format(new_pdb))
def check_and_fix_pdbatomnames ( pdb_file ) : with open ( pdb_file ) as pdb : content = pdb . readlines ( ) check_duplicated_pdbatomnames ( content ) for i , line in enumerate ( content ) : if line . startswith ( "HETATM" ) and line [ 21 : 22 ] == "L" : atom_name = line [ 12 : 16 ] if atom_name . strip ( ) . startswith ( "G" ) : new_atom_name = line [ 77 : 78 ] + atom_name . strip ( ) line_to_list = list ( line ) line_to_list [ 12 : 16 ] = new_atom_name + " " * ( 4 - len ( new_atom_name ) ) line_to_list = "" . join ( line_to_list ) content [ i ] = line_to_list check_duplicated_pdbatomnames ( content ) new_pdb = "" . join ( content ) with open ( pdb_file , "w" ) as writepdb : writepdb . write ( "{}" . format ( new_pdb ) )
It checks if atoms of the ligand of a PDB file contains the character 'G' (usually added by FrAG to identify atoms
that have been grown) and modify the name of these atoms adding it element symbol to the PDB atom name.
It checks if atoms of the ligand of a PDB file contains the character ' G ' ( usually added by FrAG to identify atoms that have been grown ) and modify the name of these atoms adding it element symbol to the PDB atom name .
"""
    It checks if atoms of the ligand of a PDB file contains the character 'G' (usually added by FrAG to identify atoms
    that have been grown) and modify the name of these atoms adding it element symbol to the PDB atom name.
    :param pdb_file: PDB file. str
    :return: it rewrites the PDB file applying the modifications.
    """
it rewrites the PDB file applying the modifications.
it rewrites the PDB file applying the modifications .
pdb_file
PDB file. str
PDB file . str