mattragoza / LiGAN

Deep generative models of 3D grids for structure-based drug discovery
GNU General Public License v2.0
225 stars 44 forks source link

how I can export embeddings #57

Open sll513 opened 2 years ago

sll513 commented 2 years ago

Is that possible I can export embeddings for a given docked sdf, like .latent file? Thanks

mattragoza commented 2 years ago

Yes, if you have the option generate: output_latents: True in generate.config, the latent vectors for each generated sample will be written to files in the {out_dir}/latents/ subdirectory. They will be text files with one value per line named using the pattern {out_prefix}_{example_idx}_lig_gen_{sample_idx}.latent, where example_idx refers to the row number in the input data file.

sll513 commented 2 years ago

Thanks. this is very useful. additional query, how I can get the embeddings for a pre-docked cmpd (not the de novo designed cmpd)

mattragoza commented 2 years ago

There is no distinction between the latent space of the generated molecule and the input molecule. If you set the variability factor to zero, the latent vector represents the mean of the posterior distribution for the input ligand, which represents the input ligand in some sense. Just bear in mind that this is not guaranteed to decode to the same exact molecule, as there is some reconstruction error.