Skip to content

Commit

Permalink
style: fix imports and order of os.make_dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
jyaacoub committed Oct 27, 2024
1 parent 653cf40 commit e22a5a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
21 changes: 10 additions & 11 deletions inference.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import argparse
import os, logging, argparse
parser = argparse.ArgumentParser(description='Runs inference on a given ligand SMILES and an input of pdb files.')
parser.add_argument('-ls','--ligand_smile', type=str, required=True, help='Ligand SMILES string.')
parser.add_argument('-pdb','--pdb_files', type=str, nargs='+', required=True,
Expand Down Expand Up @@ -35,17 +35,16 @@
FOLD = args.fold
BATCH_SIZE = args.batch_size

import logging
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("#"*50)
logging.debug(f"LIGAND_SMILE: {LIGAND_SMILES}")
logging.debug(f"LIGAND_ID: {LIGAND_ID}")
logging.debug(f"PDB_FILES: {PDB_FILES}")
logging.debug(f"OUT_PATH: {CSV_OUT}")
logging.debug(f"MODEL_OPT: {MODEL_OPT}")
logging.debug(f"FOLD: {FOLD}")
logging.debug(f"BATCH_SIZE: {BATCH_SIZE}")
logging.debug("#"*50)
logging.info("#"*50)
logging.info(f"LIGAND_SMILE: {LIGAND_SMILES}")
logging.info(f"LIGAND_ID: {LIGAND_ID}")
logging.info(f"PDB_FILES: {PDB_FILES}")
logging.info(f"OUT_PATH: {CSV_OUT}")
logging.info(f"MODEL_OPT: {MODEL_OPT}")
logging.info(f"FOLD: {FOLD}")
logging.info(f"BATCH_SIZE: {BATCH_SIZE}")
logging.info("#"*50)

import os
import numpy as np
Expand Down
36 changes: 18 additions & 18 deletions run_mutagenesis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import os, logging, argparse
parser = argparse.ArgumentParser(description='Runs Mutagenesis on an input PDB file and a given ligand SMILES.')
parser.add_argument('--ligand_smile', type=str, required=True, help='Ligand SMILES string.')
parser.add_argument('--ligand_smile_name', type=str, required=True, help='Ligand SMILES name, required for output path.')
parser.add_argument('--ligand_id', type=str, required=True, help='Ligand SMILES identifier, required for output path.')
parser.add_argument('--pdb_file', type=str, required=True, help='Path to the PDB file.')
parser.add_argument('--out_path', type=str, default='./',
help='Output directory path to save resulting mutagenesis numpy matrix with predicted pkd values')
Expand All @@ -21,28 +21,30 @@

# Assign variables
LIGAND_SMILE = args.ligand_smile
LIGAND_SMILE_NAME = args.ligand_smile_name
LIGAND_ID = args.ligand_id
PDB_FILE = args.pdb_file
OUT_PATH = args.out_path
MODEL_OPT = args.model_opt
FOLD = args.fold
RES_START = args.res_start
RES_END = args.res_end

import logging
OUT_DIR = f'{OUT_PATH}/{LIGAND_ID}/{MODEL_OPT}'
os.makedirs(OUT_DIR, exist_ok=True)

logging.getLogger().setLevel(logging.DEBUG)
logging.debug("#"*50)
logging.debug(f"LIGAND_SMILE: {LIGAND_SMILE}")
logging.debug(f"LIGAND_SMILE_NAME: {LIGAND_SMILE_NAME}")
logging.debug(f"PDB_FILE: {PDB_FILE}")
logging.debug(f"OUT_PATH: {OUT_PATH}")
logging.debug(f"MODEL_OPT: {MODEL_OPT}")
logging.debug(f"FOLD: {FOLD}")
logging.debug(f"RES_START: {RES_START}")
logging.debug(f"RES_END: {RES_END}")
logging.debug("#"*50)

import os
logging.info("#"*50)
logging.info(f"LIGAND_SMILE: {LIGAND_SMILE}")
logging.info(f"LIGAND_ID: {LIGAND_ID}")
logging.info(f"PDB_FILE: {PDB_FILE}")
logging.info(f"OUT_PATH: {OUT_PATH}")
logging.info(f"MODEL_OPT: {MODEL_OPT}")
logging.info(f"FOLD: {FOLD}")
logging.info(f"RES_START: {RES_START}")
logging.info(f"RES_END: {RES_END}")
logging.info(f"OUT_DIR: {OUT_DIR}")
logging.info("#"*50)

import numpy as np
import torch
import torch_geometric as torchg
Expand Down Expand Up @@ -148,8 +150,6 @@ def get_protein_features(pdb_file_path, cmap_thresh=8.0):


# Save mutagenesis matrix
OUT_DIR = f'{OUT_PATH}/{LIGAND_SMILE_NAME}/{MODEL_OPT}'
os.makedirs(OUT_DIR, exist_ok=True)
OUT_FP = f"{OUT_DIR}/{res_range[0]}_{res_range[1]}.npy"
print("Saving mutagenesis numpy matrix to", OUT_FP)
np.save(OUT_FP, muta)

0 comments on commit e22a5a0

Please sign in to comment.