Exemple #1
0
def main(argv):
    del argv  # unused.
    config_name = '/data/junyoung/workspace/Mol_DQN/models/multi_logp_qed_model/config_2'
    all_cid = '/data/junyoung/workspace/Mol_DQN/Config/all_cid'

    with open(config_name) as f:
        hparams = json.load(f)

    with open(all_cid) as f:
        all_mols = json.load(f)

    # init_mol = ["CNC(=O)/C(C#N)=C(/[O-])C1=NN(c2cc(C)ccc2C)C(=O)CC1"]

    environment = Multi_LogP_QED_Molecule(hparams=hparams,
                                          molecules=all_mols)

    dqn = deep_q_networks.DeepQNetwork(
        hparams=hparams,
        q_fn=functools.partial(
            deep_q_networks.Q_fn_neuralnet_model,
            hparams=hparams))

    Trainer =trainer.Trainer(
        hparams=hparams,
        environment=environment,
        model=dqn)

    Trainer.run_training()

    config.write_hparams(hparams, os.path.join(hparams['save_param']['model_path'], 'config.json'))
Exemple #2
0
def main(argv):
    del argv  # unused.
    config_name = '/home/junyoung/workspace/Mol_DQN/models/logp_model/config'
    all_cid = '/home/junyoung/workspace/Mol_DQN/Config/all_cid'

    with open(config_name) as f:
        hparams = json.load(f)

    # with open(all_cid) as f:
    #     all_mols = json.load(f)


    environment = LogP_Molecule(hparams=hparams,
                                molecules=None)

    dqn = deep_q_networks.DeepQNetwork(
        hparams=hparams,
        q_fn=functools.partial(
            deep_q_networks.Q_fn_neuralnet_model, hparams=hparams))

    Trainer =trainer.Trainer(
        hparams=hparams,
        environment=environment,
        model=dqn)

    Trainer.run_training()

    config.write_hparams(hparams, os.path.join(hparams['save_param']['model_dir'], 'config.json'))
Exemple #3
0
def main(argv):
    del argv  # unused.
    config_name = '/home/junyoung/workspace/Mol_DQN_ADMET_v2/models/admet_qed_model/config_1'
    # all_cid = '/home/junyoung/workspace/Mol_DQN_ADMET/Config/all_cid'

    logS_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/regression_model/logS/logS_Model_v3.pkl'
    caco_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/regression_model/caco2/caco2_Model_v3.pkl'
    cyp3a4_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/classification_model/CYP3A4-inhibitor/CYP_inhibitor_3A4_SVC_ecfp4_model_v3.pkl'
    # ppb_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/regression_model/PPB/PPB_Model_v3.pkl'
    t_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/regression_model/T/T_Model_v3.pkl'
    ld50_model_path = '/home/junyoung/workspace/ADMET/ADMETlab/regression_model/LD50/LD50_Model_v3.pkl'

    with open(config_name) as f:
        hparams = json.load(f)

    # with open(all_cid) as f:
    #     all_mols = json.load(f)

    with open(logS_model_path, 'rb') as f:
        logS_model = pickle.load(f, encoding="latin1")

    # with open(ppb_model_path, 'rb') as f:
    #     ppb_model = pickle.load(f, encoding="latin1")

    with open(caco_model_path, 'rb') as f:
        caco_model = pickle.load(f, encoding="latin1")

    with open(cyp3a4_model_path, 'rb') as f:
        cyp3a4_model = pickle.load(f, encoding="latin1")

    with open(t_model_path, 'rb') as f:
        t_model = pickle.load(f, encoding="latin1")

    with open(ld50_model_path, 'rb') as f:
        ld50_model = pickle.load(f, encoding="latin1")

    ##To calculate SA score##
    SA_model = molecules_rules.readSAModel()

    all_mols = ["C1(=CC(=CC=C1NC2=NC(=C(C=N2)Cl)CC3=CC=CC=C3C)[P](C)(C)=O)O"]

    mol = Chem.MolFromSmiles(all_mols[0])
    rings = mol.GetRingInfo().BondRings()
    ring_scaffolds = [
        Chem.MolToSmiles(Chem.PathToSubmol(mol, ring)) for ring in rings
    ]

    environment = ADMET_QED_Molecule(hparams=hparams,
                                     molecules=all_mols,
                                     SA_model=SA_model,
                                     logS_model=logS_model,
                                     caco_model=caco_model,
                                     cyp3a4_model=cyp3a4_model,
                                     t_model=t_model,
                                     ld50_model=ld50_model,
                                     scaffold=ring_scaffolds,
                                     record_path=True)

    dqn = deep_q_networks.DeepQNetwork(
        hparams=hparams,
        q_fn=functools.partial(deep_q_networks.Q_fn_neuralnet_model,
                               hparams=hparams))

    Trainer = trainer.Trainer(hparams=hparams,
                              environment=environment,
                              model=dqn)

    Trainer.run_training()
Exemple #4
0
    log = logging.getLogger("rhythm")

    if args.module is None:
        raise ValueError("Provide a module argument (see --help)")

    configure_logging(args.module, args.verbose)

    # seed for reproducability
    torch.manual_seed(args.seed)
    np.random.seed(args.seed)
    if hasattr(args, "device") and args.device != "cpu":
        torch.cuda.manual_seed_all(args.seed)

    log.info("Arguments: {}".format(args))
    if args.module == "process":
        data_process = process.Process(args)
        data_process.process()
    elif args.module == "compute-mean":
        mean_compute = ComputeMean(args)
        mean_compute.compute()
    elif args.module == "train":
        trainer = trainer.Trainer(args)
        if args.test:
            trainer.load()
            trainer.test()
        else:
            trainer.train()
    else:
        raise ValueError("Unknown module: {}".format(args.module))