Metadata-Version: 2.0
Name: resdk
Version: 1.3.2
Summary: Resolwe SDK for Python
Home-page: https://github.com/genialis/resolwe-bio-py
Author: Genialis d.o.o.
Author-email: dev-team@genialis.com
License: Apache License (2.0)
Keywords: bioinformatics resolwe bio pipelines dataflow django python sdk
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Requires-Dist: appdirs (>=1.4.0)
Requires-Dist: pyyaml (>=3.11)
Requires-Dist: requests (>=2.6.0)
Requires-Dist: six (>=1.10.0)
Requires-Dist: slumber (>=0.7.1)
Provides-Extra: docs
Requires-Dist: sphinx (>=1.4.1); extra == 'docs'
Requires-Dist: sphinx-rtd-theme (>=0.1.9); extra == 'docs'
Provides-Extra: package
Requires-Dist: twine; extra == 'package'
Requires-Dist: wheel; extra == 'package'
Provides-Extra: test
Requires-Dist: check-manifest; extra == 'test'
Requires-Dist: coverage (>=3.7.1); extra == 'test'
Requires-Dist: mock (==1.3.0); extra == 'test'
Requires-Dist: pep8 (>=1.6.2); extra == 'test'
Requires-Dist: pylint (>=1.4.3); extra == 'test'
Requires-Dist: readme-renderer; extra == 'test'

======================
Resolwe SDK for Python
======================

|build| |docs| |pypi_version| |pypi_pyversions| |pypi_downloads|

.. |build| image:: https://travis-ci.org/genialis/resolwe-bio-py.svg?branch=master
    :target: https://travis-ci.org/genialis/resolwe-bio-py
    :alt: Build Status

.. |docs| image:: https://readthedocs.org/projects/resdk/badge/?version=latest
    :target: http://resdk.readthedocs.io/
    :alt: Documentation Status

.. |pypi_version| image:: https://img.shields.io/pypi/v/resdk.svg
    :target: https://pypi.python.org/pypi/resdk
    :alt: Version on PyPI

.. |pypi_pyversions| image:: https://img.shields.io/pypi/pyversions/resdk.svg
    :target: https://pypi.python.org/pypi/resdk
    :alt: Supported Python versions

.. |pypi_downloads| image:: https://img.shields.io/pypi/dm/resdk.svg
    :target: https://pypi.python.org/pypi/resdk
    :alt: Number of downloads from PyPI


Resolwe_ is a dataflow package for the `Django framework`_.
`Resolwe Bioinformatics`_ is an extension of Resolwe that provides
bioinformatics pipelines. Resolwe SDK for Python supports writing
dataflow pipelines for Resolwe and Resolwe Bioinformatics.

.. _Resolwe Bioinformatics: https://github.com/genialis/resolwe-bio
.. _Resolwe: https://github.com/genialis/resolwe
.. _Django framework: https://www.djangoproject.com/

Docs & Help
===========

Read the detailed description in documentation_.

.. _documentation: http://resolwe-bio-py.readthedocs.io/

Install
=======

Install from PyPI::

  pip install resdk

To install for development, `fork on Github`_ and run::

  git clone https://github.com/<GITHUB_USER>/resolwe-bio-py.git
  cd resolwe-bio-py
  pip install -e .[docs,package,test]

.. _fork on Github: https://github.com/genialis/resolwe-bio-py

Quick Start
===========

Connect to a Resolwe server:

.. code-block:: python

   from resdk import Resolwe
   re = Resolwe('admin', 'admin', 'https://torta.bcm.genialis.com')

Get sample by ID and download the aligned reads (BAM file):

.. code-block:: python

   sample = re.sample.get(1)
   sample.download(type='bam')

Find human samples and download all aligned reads (BAM files):

.. code-block:: python

   samples = re.sample.filter(descriptor__organism="Homo sapiens")
   for sample in samples:
       sample.download(type='bam')

Primary analysis (*e.g.,* filtering, alignment, expression estimation)
starts automatically when samples are annotated. A step in primary
analysis is represented as ``Data`` object, attached to the sample.
A ``Sample`` object includes sample annotation. A ``Data`` object
includes input parameters, results and analysis annotation. Print the
steps in primary analysis pipeline:

.. code-block:: python

   sample = re.sample.get(1)
   for data_id in sample.data:
       data = re.data.get(data_id)
       print data.process_name

Find ROSE2 analysis results and display a super-enhancer rank plot of
the first ROSE2 analysis Data object:

.. code-block:: python

   rose2_list = re.data.filter(type='data:chipseq:rose2:')
   rose2 = rose2_list[0]
   # TODO: Plot results

Run Bowtie2 mapping on the reads ``Data`` object of the above sample:

.. code-block:: python

   genome = re.data.filter(type='data:genome:fasta:')[0]
   reads = sample.data[0]
   aligned = re.run('alignment-bowtie-2-2-3_trim', input={
                        genome: genome.id,
                        reads: reads.id,
                        reporting: {rep_mode: 'k', k_reports: 1}
                    })
   aligned.status()

Continue in the `Getting Started`_ section of Documentation, where we
explain how to upload files, create samples and provide details about
the Resolwe backend. Bioinformaticians can learn how to develop
pipelines in `Writing Pipelines`_.

.. _Getting Started: http://resdk.readthedocs.io/en/latest/intro.html
.. _Writing Pipelines: http://resdk.readthedocs.io/en/latest/pipelines.html


