.. include:: ../toolkit-substitutions
.. saiphtk toolkit documentation master file

.. _saiph-toolkit-intro:

#############################
Saiph Toolkit
#############################

.. attention::
   |TWOLANGUAGE|

Saiph TK provides the functionalities to easily  extract, transfer, and load (ETL) files. It
has six file-converting classes: :ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>`,
:ref:`OESmilesFileConverter <OESaiph_OESmilesFileConverter>`,
:ref:`OECSVFileConverter <OESaiph_OECSVFileConverter>`,
:ref:`OEDUFileConverter <OESaiph_OEDUFileConverter>`,
:ref:`OEShapeQueryConverter <OESaiph_OEShapeQueryConverter>`,
and :ref:`OERecordToCSV <OESaiph_OERecordToCSV>`.
:ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>` can be utilized on any
file that passes the :oe:func:`OEChem::OEIsReadable` check.
:ref:`OESmilesFileConverter <OESaiph_OESmilesFileConverter>` can be utilized on
SMI, ISM, CAN, CXSMILES, and USM files. The other converters are specific to their
file type. The Python version of the toolkit provides an :ref:`ArchiveConverter <OESaiph_ArchiveConverter>`,
which is an iterator class that converts tarball or zip files into :ref:`OERecord <OEDataFlow_OERecord>`
by returning the best-suited converter iterator for each file in the compressed file.

:ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>` and
:ref:`OESmilesFileConverter <OESaiph_OESmilesFileConverter>` both
take in :ref:`OEMolConversionOptions <OESaiph_OEMolConversionOptions>`,
which provides options to clear SDData, set conformer tests, and set and get generic
data, as well as allowing the user to set a Mol Title Column.
:ref:`OECSVFileConverter <OESaiph_OECSVFileConverter>` takes in
:ref:`OECSVConversionOptions <OESaiph_OECSVConversionOptions>` for setting the delimiter.
The main five converters utilize Open() and GetNextRecord() methods to traverse through a file.
Open() is where the file name and converter options can be set. GetNextRecord() populates an
:ref:`OEMolRecord <OEDataFlow_OEMolRecord>` while stepping through the data of the file.
This function returns Saiph return codes: ``SaiphReturnCode::Success``, ``SaiphReturnCode::Fail``, and
``SaiphReturnCode::EndOfFile``.

:ref:`OERecordToCSV <OESaiph_OERecordToCSV>` directly converts a file into a CSV file.
It has :ref:`OERecordToCSVOptions <OESaiph_OERecordToCSVOptions>` for setting the delimiter.

Saiph TK also provides functions like :oe:func:`OESaiph::GetConverter`, :oe:func:`OESaiph::OEMolToRecord`,
:oe:func:`OESaiph::OERecordToMol`, and :oe:func:`OESaiph::OERecordToDesignUnit`. :oe:func:`OESaiph::GetConverter`
returns the best converter for the file, and the other functions convert between :ref:`OERecord <OEDataFlow_OERecord>`
and the respective class type. On the Python side, :oe:func:`OESaiph::read_record_file_to_dataframe` give the utility
of creating a Pandas DataFrame from any file that passes the :oe:func:`OEChem::OEIsReadable` check. The user is required
to have Pandas installed in their Python environment.

.. toctree::
   :maxdepth: 3

   examples
   api
   releasenotes/index