Skip to content
Snippets Groups Projects
Commit 8d29facd authored by Kenan Oggad's avatar Kenan Oggad
Browse files

fIxed / translated comments (#1)

parent df25dd91
No related branches found
No related tags found
No related merge requests found
......@@ -29,24 +29,24 @@ def docking(
receptor_name = os.path.splitext(receptor_file)[-1].split('.')[0]
ligand_name = os.path.splitext(ligand_file)[-1].split('.')[0]
#On initialise vina
# initialises vina
v = Vina(sf_name='vina', verbosity=1)
v.set_receptor(receptor_file)
v.set_ligand_from_file(ligand_file)
#On pose la box de docking
# set the docking frame
v.compute_vina_maps(center=center,box_size=box_size)
# Score the current pose
# scores the current pose
energy = v.score()
print('Score before minimization: %.3f (kcal/mol)' % energy[0])
# Minimized locally the current pose
# minimizes locally the current pose
energy_minimized = v.optimize()
print('Score after minimization : %.3f (kcal/mol)' % energy_minimized[0])
# v.write_pose(f'{ligand_name}_minimized.pdbqt', overwrite=True)
# Dock the ligand
# docks the ligand
v.dock(exhaustiveness=n_dockings, n_poses=20)
if write:
......
......@@ -8,14 +8,14 @@ def prepare(file_path:str) -> str:
@return: path to the output PDBQT file
"""
# Define the output file name
# defines the output file name
pdbqt_file = os.path.splitext(file_path)[0] + '.pdbqt'
pdbqt_file = pdbqt_file.replace('raw', 'preped')
# Convert PDB to PDBQT using Open Babel
# converts PDB to PDBQT using Open Babel
flags = "-xc -xr" if file_path.endswith("pdb") else ""
command = f'obabel {file_path} -opdbqt -O {pdbqt_file} -h {flags}'
command += "--partialcharge gasteiger" # include forces and charges
command += "--partialcharge gasteiger" # includes forces and charges
subprocess.run(command, shell=True)
return pdbqt_file
......@@ -33,7 +33,7 @@ def compute_box(
if site_atoms.size == 0:
site_atoms = ligand_coords
# Compute min/max coordinates for the docking box
# compute min/max coordinates for the docking box
x_min, y_min, z_min = np.min(site_atoms, axis=0)
x_max, y_max, z_max = np.max(site_atoms, axis=0)
......
......@@ -34,7 +34,7 @@ class Model:
if self.verbose == 2:
print('Now initializing pytorch and CUDA environment :')
# clean cache and setting the libs seeds
# cleans cache and sets the libs seeds
torch.cuda.empty_cache()
seed_all(2089)
......@@ -42,7 +42,7 @@ class Model:
print('\tpytorch and CUDA initialized correctly.')
print('Now retrieving alphabet from fair-ESM :')
# set ESM2 alphabet as the usual alphabet
# sets ESM2 alphabet as the usual alphabet
pretrained_model, self.alphabet = esm.pretrained.load_model_and_alphabet_hub('esm2_t33_650M_UR50D')
del pretrained_model # ESM2 pretrained_model that we don't need here is deleted from memory
......@@ -50,7 +50,7 @@ class Model:
print('\tESM alphabet successfully loaded.')
print('Now building PocketGen model :')
# set the model and load the checkpoint from .pt file
# sets the model and load the checkpoint from .pt file
self.checkpoint = torch.load(checkpoint_path, map_location=self.device)
if self.verbose == 2:
......
......@@ -10,8 +10,8 @@ def densify(data:dict) -> torch.Tensor:
"""
return Compose([
FeaturizeProteinAtom(), # issue : star import
FeaturizeLigandAtom(), # issue : star import
FeaturizeProteinAtom(),
FeaturizeLigandAtom(),
])(data)
......@@ -35,12 +35,12 @@ def featurize(
@return (dict): a feature dictionnary
"""
# concatenate the first 3 dicts (prot, lig and residue)
# concatenates the first 3 dicts (prot, lig and residue)
features = dict({f"p_{k}":v for k,v in protein_dict.items()},
**{f"l_{k}":v for k,v in ligand_dict.items()})
features.update(residue_dict)
# add keys for simple variables
# adds keys for simple variables
features.update({
'full_seq_index': full_seq_index,
'r10_index': r10_index,
......
......@@ -11,7 +11,7 @@ def interaction(ligand_path: str, receptor_path: str) -> torch.Tensor:
@return (torch.Tensor): a data-dense feature tensor representing the interaction.
"""
# Read and parse the mol (pdb / sdf) files
# read and parses the mol (pdb / sdf) files
pdb_block = open(receptor_path, 'r').read()
protein = PDBProtein(pdb_block)
ligand_dict = parse_sdf_file(ligand_path, feat=False)
......@@ -20,12 +20,12 @@ def interaction(ligand_path: str, receptor_path: str) -> torch.Tensor:
r10_index, r10_residues = protein.query_residues_ligand(ligand_dict, radius=10, selected_residue=None, return_mask=False)
full_seq_index, full_seq_residues = protein.query_residues_ligand(ligand_dict, radius=3.5, selected_residue=r10_residues, return_mask=False)
# define pocket from the (r < 10) residues
# defines pocket from the (r < 10) residues
pocket = PDBProtein(protein.residues_to_pdb_block(r10_residues))
pocket_dict = pocket.to_dict_atom()
residue_dict = pocket.to_dict_residue()
# define the scope of protein_edit_residue (sould be of type torch.Tensor[bool])
# defines the scope of protein_edit_residue (sould be of type torch.Tensor[bool])
_, residue_dict['protein_edit_residue'] = pocket.query_residues_ligand(ligand_dict)
full_seq_index.sort()
......@@ -45,7 +45,7 @@ def interaction(ligand_path: str, receptor_path: str) -> torch.Tensor:
r10_index=r10_index
)
# Add metadata
# add metadata
data.update({
'protein_filename': receptor_path,
'ligand_filename': ligand_path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment