Skip to content

tjanez/resolwe-bio-py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resolwe SDK for Python

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:

from resdk import Resolwe
res = 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 ID and download the aligned reads (BAM file):

sample = res.sample.get(1)
sample.download(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(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(1)
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-bowtie-2-2-3_trim', 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.

About

Resolwe Bioinformatics Python API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%