gnina docking

Setup

Setup gnina

Below are the commands to setup

# !sudo apt install -yq openbabel
# !wget https://github.com/gnina/gnina/releases/download/v1.0.3/gnina #check the latest version please
# !chmod +x gnina
# !./gnina

Alternatively, use python script to setup:


source

setup_gnina_local


def setup_gnina_local(
    version:str='v1.3'
):

Download and install gnina in the current directory

# setup_gnina_local('v1.1')
def delete_gnina(gnina_path="gnina"):
    "Remove gnina after finish"
    path=Path(gnina_path)
    if path.exists() and path.is_file():
        path.unlink()
        print('Deleted!')
    else: print('Not exist!')
# delete_gnina()
Deleted!

If local is not successful, use docker


source

setup_gnina_docker


def setup_gnina_docker(
    
):

Pull gnina docker image

# setup_gnina_docker()
Pulling GNINA Docker image: gnina/gnina
GNINA Docker image is ready.

Get protein and ligand

# #nature medicine paper, mrtx
# !wget http://files.rcsb.org/download/7T47.pdb

# # get ligand
# !grep 6IC 7T47.pdb > lig.pdb

# # get protein
# # !grep ATOM 7T47.pdb > rec.pdb #not as good as the one below

# !grep -v 6IC 7T47.pdb > rec.pdb

Gnina affinity


source

extract_gnina_dock


def extract_gnina_dock(
    gnina_output
):

Extract values from gnina output


source

gnina_dock


def gnina_dock(
    receptor, # receptor file
    ligand, # ligand file
    autobox_ligand, # ligand file isolated from the complex
    output:str='docked.sdf', # output file (sdf or sdf.gz) to be saved
    seed:int=0, # set seeds
    exhaustiveness:NoneType=None, # number of MC chains, default is 8 if None, the higher the better (16,32); for whole protein, use 64
):
# df = Data.get_g12d_dedup()[:10]

source

gnina_dock


def gnina_dock(
    df, ID_col:str='ID', smi_col:str='SMILES', output_dir:str='gnina_docked'
):
# out = gnina_dock_df(df)

TODO: make it parallel

End