class_docstr: Handles loading of FASTQ files.
  
  FASTQ files are commonly used to hold very large sequence data. It is a variant of FASTA format.
  This class provides convenience files to load FASTQ data and one-hot encode
  the genomic sequences for use in downstream learning tasks.
  
  Example
  -------
  >>> import os
  >>> from deepchem.feat.molecule_featurizers import OneHotFeaturizer
  >>> from deepchem.data.data_loader import FASTQLoader
  >>> current_dir = os.path.dirname(os.path.abspath(__file__))
  >>> input_file = os.path.join(current_dir, "tests", "sample1.fastq")
  >>> loader = FASTQLoader()
  >>> sequences = loader.create_dataset(input_file)
  
  See Also
  --------
  `Info on the structure of FASTQ files <https://support.illumina.com/bulletins/2016/04/fastq-files-explained.html>`
class_docstr_tok: ["Handles","loading","of","FASTQ","files",".","FASTQ","files","are","commonly","used","to","hold","very","large","sequence","data",".","It","is","a","variant","of","FASTA","format",".","This","class","provides","convenience","files","to","load","FASTQ","data","and","one-hot","encode","the","genomic","sequences","for","use","in","downstream","learning","tasks",".","Example","--","--","--","-",">",">",">","import","os",">",">",">","from","deepchem.feat.molecule_featurizers","import","OneHotFeaturizer",">",">",">","from","deepchem.data.data_loader","import","FASTQLoader",">",">",">","current_dir","=","os.path.dirname","(","os.path.abspath","(","__file__",")",")",">",">",">","input_file","=","os.path.join","(","current_dir",",","``","tests","''",",","``","sample1.fastq","''",")",">",">",">","loader","=","FASTQLoader","(",")",">",">",">","sequences","=","loader.create_dataset","(","input_file",")","See","Also","--","--","--","--","`","Info","on","the","structure","of","FASTQ","files","<","https",":","\/\/support.illumina.com\/bulletins\/2016\/04\/fastq-files-explained.html",">","`"]
docstr: Creates a `Dataset` from input FASTQ files.
  
  Parameters
  ----------
  input_files: List[str]
      List of fastQ files.
  data_dir: str, optional (default None)
      Name of directory where featurized data is stored.
    shard_size: int, optional (default 4096)
  
  Returns
  -------
  DiskDataset
      A `DiskDataset` object containing a featurized representation of data
      from `input_files`.
docstr_tok: ["Creates","a","`","Dataset","`","from","input","FASTQ","files",".","Parameters","--","--","--","--","--","input_files",":","List","[","str","]","List","of","fastQ","files",".","data_dir",":","str",",","optional","(","default","None",")","Name","of","directory","where","featurized","data","is","stored",".","shard_size",":","int",",","optional","(","default","4096",")","Returns","--","--","--","-","DiskDataset","A","`","DiskDataset","`","object","containing","a","featurized","representation","of","data","from","`","input_files","`","."]
code: def create_dataset(
      self,
      input_files: OneOrMany[str],
      data_dir: Optional[str] = None,
      shard_size: Optional[int] = 4096,
  ) -> DiskDataset:
      """Creates a `Dataset` from input FASTQ files.
  
      Parameters
      ----------
      input_files: List[str]
          List of fastQ files.
      data_dir: str, optional (default None)
          Name of directory where featurized data is stored.
        shard_size: int, optional (default 4096)
  
      Returns
      -------
      DiskDataset
          A `DiskDataset` object containing a featurized representation of data
          from `input_files`.
      """
      if isinstance(input_files, str):
          input_files = [input_files]
  
      def shard_generator():
          for shard_num, shard in enumerate(
              self._get_shards(input_files, shard_size)
          ):
              if self.return_quality_scores:
                  sequences, quality_scores = _generate_sequences(shard)
                  # Featurize sequences
                  X = self.featurizer(sequences)
                  ids = np.ones(len(X))
                  # (X, y , w, ids)
                  yield X, None, quality_scores, ids
              else:
                  sequences = _generate_sequences(shard)
                  # Featurize sequences
                  X = self.featurizer(sequences)
                  ids = np.ones(len(X))
                  # (X, y , w, ids)
                  yield X, None, None, ids
  
      def _generate_sequences(shard: List) -> OneOrMany[np.ndarray]:
          """
          Creates a numpy array of annotated FASTQ-format strings.
          """
          assert (
              len(shard) % 4 == 0
          ), f"Sharded length not divisible by four: Length of shard = {len(shard)}. File is possibly incomplete"
          sequences: np.ndarray = np.array([], dtype="object")
          if self.return_quality_scores:
              quality_scores: np.ndarray = np.array([], dtype="object")
  
          # Go through each sequence entity in the fastq_file: each sequence consists of 4 lines
          # First line : header description
          # second line : sequence
          # third line : more description usually the same as the first line
          # fourth line: quality scores of the sequence
          for start_index in range(0, len(shard), 4):
              each_sequence = shard[start_index : start_index + 4]
  
              # Second line : add sequence to the sequence array
              sequences = _add_sequence(
                  sequences, np.array([each_sequence[1].strip("\n")])
              )
  
              # Fourth line
              if self.return_quality_scores:
                  quality_scores = _add_sequence(
                      quality_scores,
                      np.array([each_sequence[3].strip("\n")]),
                  )
  
          if self.return_quality_scores:
              return sequences, quality_scores
          else:
              return sequences
  
      def _add_sequence(
          sequences: np.ndarray, sequence: np.ndarray
      ) -> np.ndarray:
          # Handle empty sequence
          if sequence is None or len(sequence) <= 0:
              return np.array([])
          # Annotate start/stop of sequence
          if self.auto_add_annotations:
              sequence = np.insert(sequence, 0, "[CLS]")
              sequence = np.append(sequence, "[SEP]")
          new_sequence = "".join(sequence)
          new_sequences = np.append(sequences, new_sequence)
          return new_sequences
  
      return DiskDataset.create_dataset(shard_generator(), data_dir)
  
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 3 for calling the FASTQLoader obj's underlying member method code with example usage: obj.create_dataset(input_files, data_dir, shard_size) and returns: DiskDataset, new_sequences, sequences,  quality_scores, sequences, np