class_docstr: Featurizes protein-ligand complex using flat features or a 3D grid (in which
  each voxel is described with a vector of features).
class_docstr_tok: ["Featurizes","protein-ligand","complex","using","flat","features","or","a","3D","grid","(","in","which","each","voxel","is","described","with","a","vector","of","features",")","."]
code: def _compute_feature(
      self,
      feature_name,
      prot_xyz,
      prot_rdk,
      lig_xyz,
      lig_rdk,
      distances,
  ):
      if feature_name == "ecfp_ligand":
          return [
              compute_ecfp_features(
                  lig_rdk, self.ecfp_degree, self.ecfp_power
              )
          ]
      if feature_name == "ecfp_hashed":
          return [
              vectorize(
                  hash_ecfp,
                  feature_dict=ecfp_dict,
                  size=2**self.ecfp_power,
              )
              for ecfp_dict in featurize_contacts_ecfp(
                  (prot_xyz, prot_rdk),
                  (lig_xyz, lig_rdk),
                  distances,
                  cutoff=self.cutoffs["ecfp_cutoff"],
                  ecfp_degree=self.ecfp_degree,
              )
          ]
      if feature_name == "splif_hashed":
          return [
              vectorize(
                  hash_ecfp_pair,
                  feature_dict=splif_dict,
                  size=2**self.splif_power,
              )
              for splif_dict in featurize_splif(
                  (prot_xyz, prot_rdk),
                  (lig_xyz, lig_rdk),
                  self.cutoffs["splif_contact_bins"],
                  distances,
                  self.ecfp_degree,
              )
          ]
      if feature_name == "hbond_count":
          return [
              vectorize(
                  hash_ecfp_pair, feature_list=hbond_list, size=2**0
              )
              for hbond_list in compute_hydrogen_bonds(
                  (prot_xyz, prot_rdk),
                  (lig_xyz, lig_rdk),
                  distances,
                  self.cutoffs["hbond_dist_bins"],
                  self.cutoffs["hbond_angle_cutoffs"],
              )
          ]
      if feature_name == "ecfp":
          return [
              sum(
                  [
                      voxelize(
                          convert_atom_to_voxel,
                          xyz,
                          box_width=self.box_width,
                          voxel_width=self.voxel_width,
                          hash_function=hash_ecfp,
                          feature_dict=ecfp_dict,
                          nb_channel=2**self.ecfp_power,
                      )
                      for xyz, ecfp_dict in zip(
                          (prot_xyz, lig_xyz),
                          featurize_contacts_ecfp(
                              (prot_xyz, prot_rdk),
                              (lig_xyz, lig_rdk),
                              distances,
                              cutoff=self.cutoffs["ecfp_cutoff"],
                              ecfp_degree=self.ecfp_degree,
                          ),
                      )
                  ]
              )
          ]
      if feature_name == "splif":
          return [
              voxelize(
                  convert_atom_pair_to_voxel,
                  (prot_xyz, lig_xyz),
                  box_width=self.box_width,
                  voxel_width=self.voxel_width,
                  hash_function=hash_ecfp_pair,
                  feature_dict=splif_dict,
                  nb_channel=2**self.splif_power,
              )
              for splif_dict in featurize_splif(
                  (prot_xyz, prot_rdk),
                  (lig_xyz, lig_rdk),
                  self.cutoffs["splif_contact_bins"],
                  distances,
                  self.ecfp_degree,
              )
          ]
      if feature_name == "sybyl":
  
          def hash_sybyl_func(x):
              hash_sybyl(x, sybyl_types=self.sybyl_types)
  
          return [
              voxelize(
                  convert_atom_to_voxel,
                  xyz,
                  box_width=self.box_width,
                  voxel_width=self.voxel_width,
                  hash_function=hash_sybyl_func,
                  feature_dict=sybyl_dict,
                  nb_channel=len(self.sybyl_types),
              )
              for xyz, sybyl_dict in zip(
                  (prot_xyz, lig_xyz),
                  featurize_binding_pocket_sybyl(
                      prot_xyz,
                      prot_rdk,
                      lig_xyz,
                      lig_rdk,
                      distances,
                      cutoff=self.cutoffs["sybyl_cutoff"],
                  ),
              )
          ]
      if feature_name == "salt_bridge":
          return [
              voxelize(
                  convert_atom_pair_to_voxel,
                  (prot_xyz, lig_xyz),
                  box_width=self.box_width,
                  voxel_width=self.voxel_width,
                  feature_list=compute_salt_bridges(
                      prot_rdk,
                      lig_rdk,
                      distances,
                      cutoff=self.cutoffs["salt_bridges_cutoff"],
                  ),
                  nb_channel=1,
              )
          ]
      if feature_name == "charge":
          return [
              sum(
                  [
                      voxelize(
                          convert_atom_to_voxel,
                          xyz,
                          box_width=self.box_width,
                          voxel_width=self.voxel_width,
                          feature_dict=compute_charge_dictionary(mol),
                          nb_channel=1,
                          dtype="np.float16",
                      )
                      for xyz, mol in (
                          (prot_xyz, prot_rdk),
                          (lig_xyz, lig_rdk),
                      )
                  ]
              )
          ]
      if feature_name == "hbond":
          return [
              voxelize(
                  convert_atom_pair_to_voxel,
                  (prot_xyz, lig_xyz),
                  box_width=self.box_width,
                  voxel_width=self.voxel_width,
                  feature_list=hbond_list,
                  nb_channel=2**0,
              )
              for hbond_list in compute_hydrogen_bonds(
                  (prot_xyz, prot_rdk),
                  (lig_xyz, lig_rdk),
                  distances,
                  self.cutoffs["hbond_dist_bins"],
                  self.cutoffs["hbond_angle_cutoffs"],
              )
          ]
      if feature_name == "pi_stack":
          return voxelize_pi_stack(
              prot_xyz,
              prot_rdk,
              lig_xyz,
              lig_rdk,
              distances,
              self.cutoffs["pi_stack_dist_cutoff"],
              self.cutoffs["pi_stack_angle_cutoff"],
              self.box_width,
              self.voxel_width,
          )
      if feature_name == "cation_pi":
          return [
              sum(
                  [
                      voxelize(
                          convert_atom_to_voxel,
                          xyz,
                          box_width=self.box_width,
                          voxel_width=self.voxel_width,
                          feature_dict=cation_pi_dict,
                          nb_channel=1,
                      )
                      for xyz, cation_pi_dict in zip(
                          (prot_xyz, lig_xyz),
                          compute_binding_pocket_cation_pi(
                              prot_rdk,
                              lig_rdk,
                              dist_cutoff=self.cutoffs[
                                  "cation_pi_dist_cutoff"
                              ],
                              angle_cutoff=self.cutoffs[
                                  "cation_pi_angle_cutoff"
                              ],
                          ),
                      )
                  ]
              )
          ]
      raise ValueError('Unknown feature type "%s"' % feature_name)
  
file_path: deepchem/deepchem/feat/complex_featurizers/rdkit_grid_featurizer.py
imports: import logging
  import time
  from deepchem.utils.rdkit_utils import MoleculeLoadException, load_molecule, compute_ecfp_features
  from deepchem.utils.geometry_utils import rotate_molecules, compute_pairwise_distances, compute_centroid, subtract_centroid
  from deepchem.utils.hash_utils import hash_ecfp, hash_ecfp_pair, hash_sybyl, vectorize
  from deepchem.utils.noncovalent_utils import compute_hydrogen_bonds, compute_salt_bridges, compute_binding_pocket_cation_pi
  from deepchem.utils.voxel_utils import convert_atom_to_voxel, convert_atom_pair_to_voxel, voxelize, voxelize_pi_stack
  from deepchem.feat.complex_featurizers.contact_fingerprints import featurize_contacts_ecfp, featurize_binding_pocket_sybyl
  from deepchem.feat.complex_featurizers.splif_fingerprints import featurize_splif
  from deepchem.feat.complex_featurizers.grid_featurizers import compute_charge_dictionary
  import numpy
  from deepchem.feat import ComplexFeaturizer
label_desc: Use image node_id 2 for calling the RdkitGridFeaturizer obj's underlying member method code with example usage: obj._compute_feature(feature_name, prot_xyz, prot_rdk, lig_xyz, lig_rdk, distances) and returns: list, unknown, unknown, unknown, list, unknown, unknown, list, list, unknown, voxelize_pi_stack, list