Molecular Sets (MOSES): Your Gateway to Advanced Molecular Generation

Jun 7, 2022 | Data Science

In the realm of drug discovery and materials science, the spotlight shines brightly on deep generative models for their impressive capability to learn from extensive datasets and create novel molecular structures. Enter Molecular Sets (MOSES), a benchmarking platform designed for evaluating molecular generation models. Let’s explore how MOSES can elevate your research in this exciting field.

What is MOSES?

MOSES is a pivotal platform for researchers engaged in machine learning applications for drug discovery. It encompasses a diverse array of molecular generation models and a comprehensive set of metrics to gauge the quality and diversity of generated molecules.

With MOSES, researchers can standardize their methodologies and share their innovative models, fostering collaboration and advancement in the field.

Installation: Getting Started with MOSES

Before you can dive into experimenting with molecular generation, you need to install MOSES. Here’s a straightforward installation guide—even if you’re a beginner!

1. Using PyPi

  • First, install RDKit by executing the following command:
  • conda install -yq -c rdkit rdkit
  • Next, install MOSES via pip:
  • pip install molsets
  • If you want to use the LatentGAN model, don’t forget to install additional dependencies using:
  • bash install_latentgan_dependencies.sh
  • On Ubuntu? Execute this command:
  • sudo apt-get install libxrender1 libxext6

2. Using Docker

  • Install docker and nvidia-docker.
  • Pull the existing MOSES image:
  • docker pull molecularsetsmoses
  • Alternatively, clone the repository and build it manually:
  • git clone https://github.com/molecularsetsmoses.git
    nvidia-docker image build --tag molecularsetsmoses moses
  • Run a container:
  • nvidia-docker run -it --name moses --network=host --shm-size 10G molecularsetsmoses

3. Manual Installation

  • Clone the MOSES repository:
  • git lfs install
    git clone https://github.com/molecularsetsmoses.git
  • Continue with installation steps mentioned for PyPi or Docker.

Using MOSES to Benchmark Your Models

Once installed, you can effortlessly benchmark your own models using MOSES. Let’s break it down with an analogy.

Understanding Model Benchmarking Through an Analogy

Imagine you own a bakery that specializes in unique cupcakes. You want to find out how well your cupcakes rank against others in the city. MOSES is like a prestigious cupcake competition where bakers showcase their creations, and expert judges (the metrics) evaluate them based on taste, creativity, and overall appearance (quality and diversity).

To participate in this competition, you follow these steps:

  • Gather Your Ingredients (Datasets): Import the necessary datasets for training, testing, and evaluating your models using:
  • python
    import moses
    train = moses.get_dataset("train")
    test = moses.get_dataset("test")
    test_scaffolds = moses.get_dataset("test_scaffolds")
    
  • Mix Your Batter (DataLoader): Prepare your data with a DataLoader to create batches:
  • from torch.utils.data import DataLoader
    from moses import CharVocab, StringDataset
    
    vocab = CharVocab.from_data(train)
    train_dataset = StringDataset(vocab, train)
    train_dataloader = DataLoader(
        train_dataset, batch_size=512,
        shuffle=True, collate_fn=train_dataset.default_collate
    )
    
    for with_bos, with_eos, lengths in train_dataloader:
        ...
    
  • Submit Your Cupcakes (Samples): After baking, you need to calculate the metrics:
  • metrics = moses.get_all_metrics(list_of_generated_smiles)

Troubleshooting Tips

If you encounter any issues during installation or benchmarking, consider the following solutions:

  • Ensure all dependencies are correctly installed and compatible with your operating system.
  • Check for any additional system requirements or libraries that may need installation.
  • Visit the MOSES GitHub Issues page for community assistance and documentation.
  • For personalized support, don’t hesitate to connect with other researchers and developers.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox