class_docstr: Featurizer for MolGAN de-novo molecular generation [1]_.
  The default representation is in form of GraphMatrix object.
  It is wrapper for two matrices containing atom and bond type information.
  The class also provides reverse capabilities.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> from rdkit import Chem
  >>> rdkit_mol, smiles_mol = Chem.MolFromSmiles('CCC'), 'C1=CC=CC=C1'
  >>> molecules = [rdkit_mol, smiles_mol]
  >>> featurizer = dc.feat.MolGanFeaturizer()
  >>> features = featurizer.featurize(molecules)
  >>> len(features) # 2 molecules
  2
  >>> type(features[0])
  <class 'deepchem.feat.molecule_featurizers.molgan_featurizer.GraphMatrix'>
  >>> molecules = featurizer.defeaturize(features) # defeaturization
  >>> type(molecules[0])
  <class 'rdkit.Chem.rdchem.Mol'>
docstr: Parameters
  ----------
  max_atom_count: int, default 9
      Maximum number of atoms used for creation of adjacency matrix.
      Molecules cannot have more atoms than this number
      Implicit hydrogens do not count.
  kekulize: bool, default True
      Should molecules be kekulized.
      Solves number of issues with defeaturization when used.
  bond_labels: List[RDKitBond]
      List of types of bond used for generation of adjacency matrix
  atom_labels: List[int]
      List of atomic numbers used for generation of node features
  
  References
  ---------
  .. [1] Nicola De Cao et al. "MolGAN: An implicit generative model for
      small molecular graphs" (2018), https://arxiv.org/abs/1805.11973
docstr_tok: ["Parameters","--","--","--","--","--","max_atom_count",":","int",",","default","9","Maximum","number","of","atoms","used","for","creation","of","adjacency","matrix",".","Molecules","can","not","have","more","atoms","than","this","number","Implicit","hydrogens","do","not","count",".","kekulize",":","bool",",","default","True","Should","molecules","be","kekulized",".","Solves","number","of","issues","with","defeaturization","when","used",".","bond_labels",":","List","[","RDKitBond","]","List","of","types","of","bond","used","for","generation","of","adjacency","matrix","atom_labels",":","List","[","int","]","List","of","atomic","numbers","used","for","generation","of","node","features","References","--","--","--","--","-","..","[","1","]","Nicola","De","Cao","et","al",".","``","MolGAN",":","An","implicit","generative","model","for","small","molecular","graphs","''","(","2018",")",",","https",":","\/\/arxiv.org\/abs\/1805.11973"]
code: def __init__(
      self,
      max_atom_count: int = 9,
      kekulize: bool = True,
      bond_labels: Optional[List[RDKitBond]] = None,
      atom_labels: Optional[List[int]] = None,
  ):
      """
      Parameters
      ----------
      max_atom_count: int, default 9
          Maximum number of atoms used for creation of adjacency matrix.
          Molecules cannot have more atoms than this number
          Implicit hydrogens do not count.
      kekulize: bool, default True
          Should molecules be kekulized.
          Solves number of issues with defeaturization when used.
      bond_labels: List[RDKitBond]
          List of types of bond used for generation of adjacency matrix
      atom_labels: List[int]
          List of atomic numbers used for generation of node features
  
      References
      ---------
      .. [1] Nicola De Cao et al. "MolGAN: An implicit generative model for
          small molecular graphs" (2018), https://arxiv.org/abs/1805.11973
  
      """
  
      self.max_atom_count = max_atom_count
      self.kekulize = kekulize
  
      try:
          from rdkit import Chem
      except ModuleNotFoundError:
          raise ImportError(
              "This class requires RDKit to be installed."
          )
  
      # bond labels
      if bond_labels is None:
          self.bond_labels = [
              Chem.rdchem.BondType.ZERO,
              Chem.rdchem.BondType.SINGLE,
              Chem.rdchem.BondType.DOUBLE,
              Chem.rdchem.BondType.TRIPLE,
              Chem.rdchem.BondType.AROMATIC,
          ]
      else:
          self.bond_labels = bond_labels
  
      # atom labels
      if atom_labels is None:
          self.atom_labels = [0, 6, 7, 8, 9]  # C,N,O,F
      else:
          self.atom_labels = atom_labels
  
      # create bond encoders and decoders
      self.bond_encoder = {l: i for i, l in enumerate(self.bond_labels)}
      self.bond_decoder = {i: l for i, l in enumerate(self.bond_labels)}
      # create atom encoders and decoders
      self.atom_encoder = {l: i for i, l in enumerate(self.atom_labels)}
      self.atom_decoder = {i: l for i, l in enumerate(self.atom_labels)}
  
file_path: deepchem/deepchem/feat/molecule_featurizers/molgan_featurizer.py
imports: import logging
  import numpy
  from deepchem.utils.typing import RDKitBond, RDKitMol, List
  from deepchem.feat.base_classes import MolecularFeaturizer
  from deepchem.utils.typing import OneOrMany
  from typing import Optional
label_desc: Use image node_id 1 to create a new MolGanFeaturizer object from inherited base classes: MolecularFeaturizer with example: obj = MolGanFeaturizer(max_atom_count, kekulize, bond_labels, atom_labels)