.. _chapter_saiph_examples:

Traversing File with an OEMolFileConverter 
===========================================

This is an example of a :ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>` creating a vector of an :ref:`OERecord <OEDataFlow_OERecord>`
from a string file input. 

..  oe:language:: c++

    .. oe:source:: basicFileTraversal.cpp
       :language: c++
       :caption:  Simple file traversal
       :refnum:   1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`basicFileTraversal.cpp <../../../../sublibs/tklibs/saiph/examples/basicFileTraversal.cpp>`


..  oe:language:: python

    .. oe:source:: basicFileTraversal.py
       :language: python
       :caption: Simple file traversal
       :refnum: 1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`basicFileTraversal.py <../../../../wrappers/python/examples/saiph/basicFileTraversal.py>`


Set Schema Record to Shape OERecord Extraction
==============================================

This example sets an :ref:`OERecord <OEDataFlow_OERecord>` as the schema to the :ref:`OEMolConversionOptions <OESaiph_OEMolConversionOptions>`,
giving the :ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>` specific :ref:`OEField <OEDataFlow_OEField>` to extract from the file given. 

..  oe:language:: c++

    .. oe:source:: customSchemaETL.cpp
       :language: c++
       :caption:  Sets Schema Record for ETL
       :refnum:   1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`customSchemaETL.cpp <../../../../sublibs/tklibs/saiph/examples/customSchemaETL.cpp>`


..  oe:language:: python

    .. oe:source:: customSchemaETL.py
       :language: python
       :caption: Sets Schema Record for ETL
       :refnum: 2

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`customSchemaETL.py <../../../../wrappers/python/examples/saiph/customSchemaETL.py>`


OERecord to OEMol 
=================

This example creates an :ref:`OEMol <OEChem_OEMol>` from the first :ref:`OERecord <OEDataFlow_OERecord>` produced by the input file. 

..  oe:language:: c++

    .. oe:source:: record2mol.cpp
       :language: c++
       :caption:  First OERecord to OEMol
       :refnum:   1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`record2mol.cpp <../../../../sublibs/tklibs/saiph/examples/record2mol.cpp>`


..  oe:language:: python

    .. oe:source:: record2mol.py
       :language: python
       :caption: First OERecord to OEMol
       :refnum: 3

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`record2mol.py <../../../../wrappers/python/examples/saiph/record2mol.py>`


OEMol to OERecord 
=================

This example creates an :ref:`OERecord <OEDataFlow_OERecord>` from the :ref:`OEMol <OEChem_OEMol>` found in the input file. 

..  oe:language:: c++

    .. oe:source:: mol2record.cpp
       :language: c++
       :caption:  OEMol to OERecord
       :refnum:   1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`mol2record.cpp <../../../../sublibs/tklibs/saiph/examples/mol2record.cpp>`


..  oe:language:: python

    .. oe:source:: mol2record.py
       :language: python
       :caption: OEMol to OERecord
       :refnum: 4

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`mol2record.py <../../../../wrappers/python/examples/saiph/mol2record.py>`


OERecord to OEDesignUnit 
========================

This example creates an :ref:`OEDesignUnit <OEBio_OEDesignUnit>` from an :ref:`OERecord <OEDataFlow_OERecord>`.

..  oe:language:: c++

    .. oe:source:: record2designunit.cpp
       :language: c++
       :caption:  Sets Schema Record for ETL
       :refnum:   1

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`record2designunit.cpp <../../../../sublibs/tklibs/saiph/examples/record2designunit.cpp>`


..  oe:language:: python

    .. oe:source:: record2designunit.py
       :language: python
       :caption: Sets Schema Record for ETL
       :refnum: 5

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`record2designunit.py <../../../../wrappers/python/examples/saiph/record2designunit.py>`


File Records to Pandas DataFrame 
================================

This example takes in a file and creates a pandas DataFrame from the :ref:`OERecord <OEDataFlow_OERecord>`
produced. The user must have pandas installed in their Python environment to gain access to this function.

..  oe:language:: python

    .. oe:source:: recordToPandasDataFrame.py
       :language: python
       :caption: Creates a DataFrame from File
       :refnum: 6

    ..  only:: oehtml

        .. admonition:: Download code

         :download:`recordToPandasDataFrame.py <../../../../wrappers/python/examples/saiph/recordToPandasDataFrame.py>`



