Skip to main content

Resolwe SDK for Python

Project description

Build Status Coverage Status Documentation Status Version on PyPI Supported Python versions

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.

Docs & Help

Read the detailed description in documentation.

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]

Quick Start

Connect to a Resolwe server:

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

# Recomended: start logging
resdk.start_logging()

If you do not have access to the Resolwe server, contact us at info@genialis.com.

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

sample = res.sample.get('primary_chor_142a2a4_h3k27ac')
sample.download(file_type='bam')

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

samples = res.sample.filter(descriptor__organism="Homo sapiens")
for sample in samples:
    sample.download(file_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:

sample = res.sample.get('primary_chor_142a2a4_h3k27ac')
for data_id in sample.data:
    data = res.data.get(data_id)
    print data.process_name

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

rose2_list = res.data.filter(type='data:chipseq:rose2:')
rose2 = rose2_list[0]
rose2.download(name='20150531-u266-A-H3K27Ac-ML1949_S2_R1_mapped_peaks_Plot_panel.png')

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

genome = res.data.get('hg19')
genome_id = genome.id
reads_id = sample.data[0]
aligned = res.run('alignment-bowtie2', input={
                      'genome': genome_id,
                      'reads': reads_id,
                      'reporting': {'rep_mode': 'k', 'k_reports': 1}
                  })
aligned.status

After a while you can check if the alignment has finished:

aligned.update()
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resdk-1.3.4.tar.gz (269.3 kB view hashes)

Uploaded Source

Built Distribution

resdk-1.3.4-py2.py3-none-any.whl (96.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page