frag_pele/Growing/add_fragment_from_pdbs.py
def extract_atoms_pdbs(pdb, create_file=True, chain="L", resnum=None, get_atoms=False, output_folder="."):
    """
    From a pdb file, it extracts the chain L and checks if the structure has hydrogens. After that, the chain L is
    written in a new PDB file which will have the following format: "{residue name}.pdb".
    :param pdb: pdb file (with a ligand in the chain L).
    :return: Writes a new pdb file "{residue name}.pdb" with the chain L isolated an returns the residue name (string).
    """
    # Parse the complex file and isolate the ligand core and the fragment
    if not resnum:
        selection = complex_to_prody.pdb_parser_ligand(pdb, chain)
    else:
        selection = complex_to_prody.pdb_parser_residue(pdb, chain, resnum)
    if selection is None:
        raise TypeError("The selection can not be found. Selection for {}: chain {} and resnum {}".format(pdb, chain, resnum))
    # Check if the ligand has H
    complex_to_prody.check_protonation(selection)
    # Save the ligand in a PDB (the name of the file is the name of the residue)
    name = selection.getResnames()[0]
    if create_file:
        prody.writePDB(os.path.join(output_folder, name), selection)
        print("The selection of {} has been extracted and saved in '{}.pdb'".format(pdb, os.path.join(output_folder, name)))
    if get_atoms is True:
        return selection
    else:
        return name

    From a pdb file, it extracts the chain L and checks if the structure has hydrogens. After that, the chain L is
    written in a new PDB file which will have the following format: "{residue name}.pdb".
    :param pdb: pdb file (with a ligand in the chain L).
    :return: Writes a new pdb file "{residue name}.pdb" with the chain L isolated an returns the residue name (string).
    
From a pdb file, it extracts the chain L and checks if the structure has hydrogens. After that, the chain L is
written in a new PDB file which will have the following format: "{residue name}.pdb".
From a pdb file it extracts the chain L and checks if the structure has hydrogens . After that the chain L is written in a new PDB file which will have the following format : " { residue name } . pdb " .
def extract_atoms_pdbs(pdb, create_file=True, chain="L", resnum=None, get_atoms=False, output_folder="."):
    if not resnum:
        selection = complex_to_prody.pdb_parser_ligand(pdb, chain)
    else:
        selection = complex_to_prody.pdb_parser_residue(pdb, chain, resnum)
    if selection is None:
        raise TypeError("The selection can not be found. Selection for {}: chain {} and resnum {}".format(pdb, chain, resnum))
    complex_to_prody.check_protonation(selection)
    name = selection.getResnames()[0]
    if create_file:
        prody.writePDB(os.path.join(output_folder, name), selection)
        print("The selection of {} has been extracted and saved in '{}.pdb'".format(pdb, os.path.join(output_folder, name)))
    if get_atoms is True:
        return selection
    else:
        return name
def extract_atoms_pdbs ( pdb , create_file = True , chain = "L" , resnum = None , get_atoms = False , output_folder = "." ) : if not resnum : selection = complex_to_prody . pdb_parser_ligand ( pdb , chain ) else : selection = complex_to_prody . pdb_parser_residue ( pdb , chain , resnum ) if selection is None : raise TypeError ( "The selection can not be found. Selection for {}: chain {} and resnum {}" . format ( pdb , chain , resnum ) ) complex_to_prody . check_protonation ( selection ) name = selection . getResnames ( ) [ 0 ] if create_file : prody . writePDB ( os . path . join ( output_folder , name ) , selection ) print ( "The selection of {} has been extracted and saved in '{}.pdb'" . format ( pdb , os . path . join ( output_folder , name ) ) ) if get_atoms is True : return selection else : return name
From a pdb file, it extracts the chain L and checks if the structure has hydrogens.
From a pdb file it extracts the chain L and checks if the structure has hydrogens .
"""
    From a pdb file, it extracts the chain L and checks if the structure has hydrogens. After that, the chain L is
    written in a new PDB file which will have the following format: "{residue name}.pdb".
    :param pdb: pdb file (with a ligand in the chain L).
    :return: Writes a new pdb file "{residue name}.pdb" with the chain L isolated an returns the residue name (string).
    """ # Parse the complex file and isolate the ligand core and the fragment # Check if the ligand has H # Save the ligand in a PDB (the name of the file is the name of the residue)
Writes a new pdb file "{residue name}.pdb" with the chain L isolated an returns the residue name (string).
Writes a new pdb file " { residue name } . pdb " with the chain L isolated an returns the residue name ( string ) .
pdb
pdb file (with a ligand in the chain L).
pdb file ( with a ligand in the chain L ) .
create_file
chain
resnum
get_atoms
output_folder