Package: macaw-py
MACAWMACAW(Molecular AutoenCoding Auto-Workaround) is a cheminformatic tool for Python that embeds molecules in a low-dimensional, continuous numerical space. It also enables the generation of new molecules on specification.MACAW embeddings are molecular features that can be used as inputs in mathematical and machine-learning models. MACAW embeddings can be used as an alternative for conventional molecular descriptors. The embeddings are fast and easy to compute, variable selection is not needed, and they may enable more accuracte predictive models than conventional molecular descriptors.MACAW also provides original algorithms to generate molecular libraries and to evolve moleculesin silicothat meet a desired specification (inverse molecular design). The design specification can be any property or combination of properties that can be predicted for the molecule, such as its octane number or its binding affinity to a protein.Details about the different algorithms are explained in theMACAW publication.InstallationMACAW requires rdkit 2020.09.4 or later to run, which can be installed usingconda:condainstall-cconda-forgerdkitAlternative methods to install rdkit are givenhere.Then run the following command to install MACAW:pipinstallmacaw_pyDocumentationRead the documentation onRead the Docs.UsageThe following illustrates some of the main commands in MACAW. Detailed use examples with real datasets are available as Jupyter Notebooks in theMACAW repository.Molecule embeddingGiven a list of molecules represented as SMILES strings (smiles), their MACAW embeddings (X) can be obtained as follows:frommacawimport*mcw=MACAW()mcw.fit(smiles)X=mcw.transform(smiles)Any list of molecules in SMILES format (qsmiles) can be embedded using an existing MACAW object:X_new=mcw.transform(qsmiles)The embedder has a variety of parameters that can be tuned to improve results. These include the dimensionality of the embedding (n_components), the number of landmarks used (n_landmarks), the type of molecular fingeprint (type_fp), and the similarity metric (metric). Property values (y_values) can also be provided to the argumentYto improve landmark choice. Other arguments and options available are explained in the documentation.mcw=MACAW(n_components=20,type_fp='rdk5',metric='Dice',n_landmarks=60)mcw.fit_transform(smiles,Y=y_values)The functionMACAW_optimusautomatically explores a variety of fingeprint type (type_fp) and similarity metric (metric) combinations and returns a recommended embedder ready for use:mcw=MACAW_optimus(smiles,n_components=20,y=y_values,verbose=True)Molecule generationGiven an input dataset of molecules in SELFIES format, MACAW'slibrary_makerfunction will generate a library of molecules around it. The maximum number of molecules to generate is specified with then_genparameter, while the spread of the distribution can be controlled with thenoise_factorargument. Additional parameters are explained in the function help.smiles_lib=library_maker(smiles,n_gen=50000,noise_factor=0.3)Molecule recommendation (inverse design)Given a property of interest, a modelfcan be trained to predict the property values of different molecules. The modelftakes as inputs the features generated by the embeddermcw.Then, we can evolve and recommend molecules to satisfy a desired property specification value (spec) using the functionlibrary_evolver. It takes as input an initial set of molecules (smiles), the featurizer (mcw), the predictive model (f), the desired specification value (spec), the number of molecules ro recommend (n_hits), the number of evolution rounds (n_rounds). Other optional arguments described in the function help.recommended_smiles=library_evolver(smiles,mcw,f,spec,n_hits=10,n_rounds=8)LicenseMACAW code is distributed under the license specified in theNoncommercial_Academic_LA.pdffile. This license allows freenon-commercialuse foracademic institutions. Modifications should be fed back to the original repository to benefit all users.Separateevaluationandcommercial uselicenses are available for businesses. Business users, please contactLBNL Licensing.