Skip to content

Commit

Permalink
docs: Render example TSV files as tables and provide download links
Browse files Browse the repository at this point in the history
This makes the TSV examples more readable on the page (i.e. the columns
line up unlike the raw TSV) while still retaining the ability for a
reader to get a copy of the example file to tinker with.

We could use the tab-width option of the literalinclude directive to
line up the columns, but that would break the ability to copy/paste the
contents into a new TSV file, as the tabs get expanded to spaces when
tab-width is used.
  • Loading branch information
tsibley committed Mar 10, 2023
1 parent 95c3ab3 commit 4d57557
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions docs/advanced-functionality/drag-drop-csv-tsv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@ The general format is compatible with other popular tools such as `MicroReact <h
Example:
--------

A TSV file as follows can be dragged onto `nextstrain.org/zika <https://nextstrain.org/zika>`__ to add a "secret" color-by:
A :download:`small TSV file <../assets/extra-data.tsv>` with the following data:

.. literalinclude:: ../assets/extra-data.tsv
:language: text
.. csv-table::
:file: ../assets/extra-data.tsv
:delim: tab

can be dragged onto `nextstrain.org/zika <https://nextstrain.org/zika>`_ to add a "secret" color-by:

.. figure:: ../assets/extra-data.png
:alt: Auspice with extra data shown via TSV

Auspice with extra data shown via TSV

A more complex metadata file may look like the following, which makes use of additional features available. This defines colours for the metadata (e.g. ``A`` is yellow, ``B`` is orange) as well as associating strains with (made up) geographic coordinates.
A :download:`more complex TSV file <../assets/extra-data-2.tsv>` can add more data to make use of additional features available:

.. csv-table::
:file: ../assets/extra-data-2.tsv
:delim: tab

.. literalinclude:: ../assets/extra-data-2.tsv
:language: text
This defines colours for the metadata (e.g. ``A`` is yellow, ``B`` is orange) as well as associating strains with (made up) geographic coordinates. When dragged onto `nextstrain.org/zika`_, it looks like:

.. figure:: ../assets/extra-data-2.png
:alt: Auspice with extra data shown via TSV
Expand Down

0 comments on commit 4d57557

Please sign in to comment.