Skip to content

Commit

Permalink
Add SampleTab Api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
djcomlab committed Mar 21, 2017
1 parent ca9b730 commit 438b482
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
37 changes: 37 additions & 0 deletions docs/exportdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
###############################
Exporting data from ISA formats
###############################

We have provided a number of modules that allow you to export data from ISA formats to formats for well-known
databases or services.

----------------------------------
Exporting ISA content to SampleTab
----------------------------------
To export metadata from SampleTab files (e.g. for EBI BioSamples database), you can do the following to export a
ISA-Tab to SampleTab:

.. code-block:: python
from isatools.convert import isatab2sampletab
with open('your/path/to/i_investigation.txt', 'r') as input_investigation_file:
with open('your/path/to/sampletab.txt', 'w') as output_sampletab_file:
isatab2sampletab.convert(input_investigation_file, output_sampletab_file)
To export an ISA JSON file to SampleTab, you can do:

.. code-block:: python
from isatools.convert import isatab2sampletab
with open('your/path/to/i_investigation.txt', 'r') as input_investigation_file:
with open('your/path/to/sampletab.txt', 'w') as output_sampletab_file:
isatab2sampletab.convert(input_investigation_file, output_sampletab_file)
You can also dump SampleTab content directly from ISA Python objects:

.. code-block:: python
from isatools import sampletab
with open('your/path/to/sampletab.txt', 'w') as output_sampletab:
# Note: ISA would be a previously loaded or constructed root Investigation object
sampletab.dump(ISA, output_sampletab)
32 changes: 31 additions & 1 deletion docs/importdata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,34 @@ tool from https://github.com/ISA-tools/mzml2isa and can be run as follows:
.. code-block:: python
from isatools.convert import mzml2isa
mzml2isa.convert('your/path/to/mzml/files/', 'tmp/', "My Study ID")
mzml2isa.convert('your/path/to/mzml/files/', 'tmp/', "My Study ID")
--------------------------
Importing SampleTab to ISA
--------------------------
To import metadata from SampleTab files (e.g. from EBI BioSamples database), you can do the following to import a
SampleTab to ISA-Tab:

.. code-block:: python
from isatools.convert import sampletab2isatab
with open('your/path/to/sampletab.txt', 'r') as input_sampletab:
sampletab2isatab.convert(input_sampletab, 'tmp/')
To import a SampleTab to ISA JSON, you can do:

.. code-block:: python
from isatools.convert import sampletab2json
with open('your/path/to/sampletab.txt', 'r') as input_sampletab:
with open('your/path/to/myjson.json', 'w') as output_json:'
sampletab2json.convert(input_sampletab, output_json)
You can also load SampleTab content directly into ISA Python objects:

.. code-block:: python
from isatools import sampletab
with open('your/path/to/sampletab.txt', 'r') as input_sampletab:
ISA = sampletab.load(input_sampletab)
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ flexible way to build and use ISA content, as well as provide utility functions
#. :doc:`Downloading files stored in Github </github>`
#. :doc:`Validating ISA-Tab and ISA JSON </validation>`
#. :doc:`Importing data in ISA formats </importdata>`
#. :doc:`Exporting data in ISA formats </exportdata>`
#. :doc:`Known Issues </knownissues>`

License
Expand All @@ -43,4 +44,5 @@ This code is licensed under the `CPAL License <https://raw.githubusercontent.com
Downloading files stored in Github <github>
Validating ISA-Tab and ISA JSON <validation>
Importing data in ISA formats <importdata>
Exporting data from ISA formats <exportdata>
Known Issues <knownissues>

0 comments on commit 438b482

Please sign in to comment.