frag_pele/Growing/add_fragment_from_pdbs.py
def lignames_replacer(pdb_file, original_ligname, new_ligname):
    """
    Given a PDB file it replace the name of a ligand for a new one.
    :param pdb_file: file in PDB format
    :param original_ligname: original name of the ligand
    :param new_ligname: new name of the ligand that will replace the original name
    :return:
    """
    with open(pdb_file) as pdb:
        content = pdb.readlines()
    for index, line in enumerate(content):
        if line.startswith("HETATM"):
            line = line.replace(original_ligname, new_ligname)
            content[index] = line
    pdb_modified = "".join(content)
    with open(pdb_file, "w") as overwrite_pdb:
        overwrite_pdb.write(pdb_modified)

    Given a PDB file it replace the name of a ligand for a new one.
    :param pdb_file: file in PDB format
    :param original_ligname: original name of the ligand
    :param new_ligname: new name of the ligand that will replace the original name
    :return:
    
Given a PDB file it replace the name of a ligand for a new one.
Given a PDB file it replace the name of a ligand for a new one .
def lignames_replacer(pdb_file, original_ligname, new_ligname):
    with open(pdb_file) as pdb:
        content = pdb.readlines()
    for index, line in enumerate(content):
        if line.startswith("HETATM"):
            line = line.replace(original_ligname, new_ligname)
            content[index] = line
    pdb_modified = "".join(content)
    with open(pdb_file, "w") as overwrite_pdb:
        overwrite_pdb.write(pdb_modified)
def lignames_replacer ( pdb_file , original_ligname , new_ligname ) : with open ( pdb_file ) as pdb : content = pdb . readlines ( ) for index , line in enumerate ( content ) : if line . startswith ( "HETATM" ) : line = line . replace ( original_ligname , new_ligname ) content [ index ] = line pdb_modified = "" . join ( content ) with open ( pdb_file , "w" ) as overwrite_pdb : overwrite_pdb . write ( pdb_modified )
Given a PDB file it replace the name of a ligand for a new one.
Given a PDB file it replace the name of a ligand for a new one .
"""
    Given a PDB file it replace the name of a ligand for a new one.
    :param pdb_file: file in PDB format
    :param original_ligname: original name of the ligand
    :param new_ligname: new name of the ligand that will replace the original name
    :return:
    """
None
pdb_file
file in PDB format
file in PDB format
original_ligname
original name of the ligand
original name of the ligand
new_ligname
new name of the ligand that will replace the original name
new name of the ligand that will replace the original name