class_docstr: Creates a `Dataset` object from SDF input files.
  
  This class provides conveniences to load and featurize data from
  Structure Data Files (SDFs). SDF is a standard format for structural
  information (3D coordinates of atoms and bonds) of molecular compounds.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> import os
  >>> current_dir = os.path.dirname(os.path.realpath(__file__))
  >>> featurizer = dc.feat.CircularFingerprint(size=16)
  >>> loader = dc.data.SDFLoader(["LogP(RRCK)"], featurizer=featurizer, sanitize=True)
  >>> dataset = loader.create_dataset(os.path.join(current_dir, "tests", "membrane_permeability.sdf")) # doctest:+ELLIPSIS
  >>> len(dataset)
  2
class_docstr_tok: ["Creates","a","`","Dataset","`","object","from","SDF","input","files",".","This","class","provides","conveniences","to","load","and","featurize","data","from","Structure","Data","Files","(","SDFs",")",".","SDF","is","a","standard","format","for","structural","information","(","3D","coordinates","of","atoms","and","bonds",")","of","molecular","compounds",".","Examples","--","--","--","--",">",">",">","import","deepchem","as","dc",">",">",">","import","os",">",">",">","current_dir","=","os.path.dirname","(","os.path.realpath","(","__file__",")",")",">",">",">","featurizer","=","dc.feat.CircularFingerprint","(","size=16",")",">",">",">","loader","=","dc.data.SDFLoader","(","[","``","LogP","(","RRCK",")","''","]",",","featurizer=featurizer",",","sanitize=True",")",">",">",">","dataset","=","loader.create_dataset","(","os.path.join","(","current_dir",",","``","tests","''",",","``","membrane_permeability.sdf","''",")",")","#","doctest",":","+ELLIPSIS",">",">",">","len","(","dataset",")","2"]
docstr: Creates and returns a `Dataset` object by featurizing provided sdf files.
  
  Parameters
  ----------
  inputs: List
      List of inputs to process. Entries can be filenames or arbitrary objects.
      Each file should be supported format (.sdf) or compressed folder of
      .sdf files
  data_dir: str, optional (default None)
      Directory to store featurized dataset.
  shard_size: int, optional (default 8192)
      Number of examples stored in each shard.
  
  Returns
  -------
  DiskDataset
      A `DiskDataset` object containing a featurized representation of data
      from `inputs`.
docstr_tok: ["Creates","and","returns","a","`","Dataset","`","object","by","featurizing","provided","sdf","files",".","Parameters","--","--","--","--","--","inputs",":","List","List","of","inputs","to","process",".","Entries","can","be","filenames","or","arbitrary","objects",".","Each","file","should","be","supported","format","(",".sdf",")","or","compressed","folder","of",".sdf","files","data_dir",":","str",",","optional","(","default","None",")","Directory","to","store","featurized","dataset",".","shard_size",":","int",",","optional","(","default","8192",")","Number","of","examples","stored","in","each","shard",".","Returns","--","--","--","-","DiskDataset","A","`","DiskDataset","`","object","containing","a","featurized","representation","of","data","from","`","inputs","`","."]
code: def create_dataset(
      self,
      inputs: OneOrMany[Any],
      data_dir: Optional[str] = None,
      shard_size: Optional[int] = 8192,
  ) -> Dataset:
      """Creates and returns a `Dataset` object by featurizing provided sdf files.
  
      Parameters
      ----------
      inputs: List
          List of inputs to process. Entries can be filenames or arbitrary objects.
          Each file should be supported format (.sdf) or compressed folder of
          .sdf files
      data_dir: str, optional (default None)
          Directory to store featurized dataset.
      shard_size: int, optional (default 8192)
          Number of examples stored in each shard.
  
      Returns
      -------
      DiskDataset
          A `DiskDataset` object containing a featurized representation of data
          from `inputs`.
      """
      logger.info("Loading raw samples now.")
      logger.info("shard_size: %s" % str(shard_size))
  
      # Special case handling of single input
      if not isinstance(inputs, list):
          inputs = [inputs]
  
      processed_files = []
      for input_file in inputs:
          filename, extension = os.path.splitext(input_file)
          extension = extension.lower()
          if extension == ".sdf":
              processed_files.append(input_file)
          elif extension == ".zip":
              zip_dir = tempfile.mkdtemp()
              unzip_file(input_file, zip_dir)
              zip_files = [
                  os.path.join(zip_dir, name)
                  for name in os.listdir(zip_dir)
              ]
              for zip_file in zip_files:
                  _, extension = os.path.splitext(zip_file)
                  extension = extension.lower()
                  if extension in [".sdf"]:
                      processed_files.append(zip_file)
          else:
              raise ValueError("Unsupported file format")
  
      inputs = processed_files
  
      def shard_generator():
          for shard_num, shard in enumerate(
              self._get_shards(inputs, shard_size)
          ):
              time1 = time.time()
              X, valid_inds = self._featurize_shard(shard)
              ids = shard[self.id_field].values
              ids = ids[valid_inds]
              if len(self.tasks) > 0:
                  # Featurize task results iff they exist.
                  y, w = _convert_df_to_numpy(shard, self.tasks)
                  # Filter out examples where featurization failed.
                  y, w = (y[valid_inds], w[valid_inds])
                  assert len(X) == len(ids) == len(y) == len(w)
              else:
                  # For prospective data where results are unknown, it
                  # makes no sense to have y values or weights.
                  y, w = (None, None)
                  assert len(X) == len(ids)
  
              time2 = time.time()
              logger.info(
                  "TIMING: featurizing shard %d took %0.3f s"
                  % (shard_num, time2 - time1)
              )
              yield X, y, w, ids
  
      return DiskDataset.create_dataset(
          shard_generator(), data_dir, self.tasks
      )
  
imports: import os
  import tempfile
  import zipfile
  import time
  import logging
  import warnings
  from typing import List, Optional, Tuple, Any, Sequence, Union, Iterator
  import pandas
  import numpy
  from deepchem.utils.typing import OneOrMany
  from deepchem.utils.data_utils import load_image_files, load_csv_files, load_json_files, load_sdf_files, unzip_file
  from deepchem.feat import UserDefinedFeaturizer, Featurizer
  from deepchem.data import Dataset, DiskDataset, NumpyDataset, ImageDataset
  from deepchem.feat.molecule_featurizers import OneHotFeaturizer
  from deepchem.utils.genomics_utils import encode_bio_sequence
label_desc: Use image node_id 2 for calling the SDFLoader obj's underlying member method code with example usage: obj.create_dataset(inputs, data_dir, shard_size) and returns: DiskDataset