class_docstr: Handles loading of FASTA files.
  
  FASTA files are commonly used to hold sequence data. This
  class provides convenience files to lead FASTA data and
  one-hot encode the genomic sequences for use in downstream
  learning tasks.
class_docstr_tok: ["Handles","loading","of","FASTA","files",".","FASTA","files","are","commonly","used","to","hold","sequence","data",".","This","class","provides","convenience","files","to","lead","FASTA","data","and","one-hot","encode","the","genomic","sequences","for","use","in","downstream","learning","tasks","."]
docstr: Creates a `Dataset` from input FASTA files.
  
  At present, FASTA support is limited and doesn't allow for sharding.
  
  Parameters
  ----------
  input_files: List[str]
      List of fasta files.
  data_dir: str, optional (default None)
      Name of directory where featurized data is stored.
  shard_size: int, optional (default None)
      For now, this argument is ignored and each FASTA file gets its
      own shard.
  
  Returns
  -------
  DiskDataset
      A `DiskDataset` object containing a featurized representation of data
      from `input_files`.
docstr_tok: ["Creates","a","`","Dataset","`","from","input","FASTA","files",".","At","present",",","FASTA","support","is","limited","and","does","n't","allow","for","sharding",".","Parameters","--","--","--","--","--","input_files",":","List","[","str","]","List","of","fasta","files",".","data_dir",":","str",",","optional","(","default","None",")","Name","of","directory","where","featurized","data","is","stored",".","shard_size",":","int",",","optional","(","default","None",")","For","now",",","this","argument","is","ignored","and","each","FASTA","file","gets","its","own","shard",".","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] = None,
  ) -> DiskDataset:
      """Creates a `Dataset` from input FASTA files.
  
      At present, FASTA support is limited and doesn't allow for sharding.
  
      Parameters
      ----------
      input_files: List[str]
          List of fasta files.
      data_dir: str, optional (default None)
          Name of directory where featurized data is stored.
      shard_size: int, optional (default None)
          For now, this argument is ignored and each FASTA file gets its
          own shard.
  
      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():  # TODO Enable sharding with shard size parameter
          for input_file in input_files:
              if self.legacy:
                  X = encode_bio_sequence(input_file)
              else:
                  sequences = _read_file(input_file)
                  X = self.featurizer(sequences)
              ids = np.ones(len(X))
              # (X, y, w, ids)
              yield X, None, None, ids
  
      def _read_file(input_file: str):
          """
          Convert the FASTA file to a numpy array of FASTA-format strings.
          """
  
          # TODO don't convert all sequences into np array (allow shards)
          def _generate_sequences(
              fasta_file, header_mark=">"
          ) -> np.ndarray:
              """
              Uses a fasta_file to create a numpy array of annotated FASTA-format strings
              """
              sequences: np.ndarray = np.array([])
              sequence: np.ndarray = np.array([])
              header_read = False
              for line in fasta_file:
                  # Check if line is a header
                  if line.startswith(header_mark):  # New header line
                      header_read = True
                      sequences = _add_sequence(sequences, sequence)
                      sequence = np.array([])
                  elif (
                      header_read
                  ):  # Line contains sequence in FASTA format
                      if (
                          line[-1:] == "\n"
                      ):  # Check last character in string
                          line = line[0:-1]  # Remove last character
                      sequence = np.append(sequence, line)
              sequences = _add_sequence(
                  sequences, sequence
              )  # Add last sequence
              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
  
          with open(input_file, "r") as f:  # Read FASTA file
              return _generate_sequences(f)
  
      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 2 for calling the FASTALoader obj's underlying member method code with example usage: obj.create_dataset(input_files, data_dir, shard_size) and returns: DiskDataset, sequences, new_sequences, _generate_sequences, np