.. _spruce_examples_metadata:

Write a metadata JSON file from a FASTA file
================================================================================

This example shows how to read in a FASTA to structure metadata and write to a JSON file.

Example
--------------------------------------------------------------------------------

.. oe:language:: c++

    .. code-block:: console

        prompt> fasta_to_structmeta seq.fasta chainIDs output.JSON

.. oe:language:: python
    
   .. code-block:: console

      prompt> fasta_to_structmeta.py seq.fasta chainIDs output.JSON


Code
--------------------------------------------------------------------------------

.. oe:language:: c++

    .. only:: oehtml

        .. admonition:: Download code

           :download:`fasta_to_structmeta.cpp <../../../../sublibs/tklibs/spruce/examples/fasta_to_structmeta.cpp>`

    .. only:: oepdf

        .. oe:source:: fasta_to_structmeta.cpp
            :language: c++

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`fasta_to_structmeta.py <../../../../wrappers/python/examples/spruce/fasta_to_structmeta.py>`
.. wrappers/python/examples/spruce/fasta_to_structmeta.py
.. rstdocs/toolkits/sprucetk/examples_metadata.rst

.. :ref:`Full listing. <listing-fasta_to_structmeta.py>`

   ..   literalinclude:: ../../../../wrappers/python/examples/spruce/fasta_to_structmeta.py

   .. only:: oepdf

      .. oe:source:: fasta_to_structmeta.py
         :language: python