Skip to main content

A Software Workflow Management System Based on DoIt

Project description

JUDI - Bioinformatics Pipeline: Just Do It

judi comes from the idea of bringing the power and efficiency of doit to execute any kind of task under many combinations of parameter settings.

Sample Code

Snippet from tutorial, save it as dodo.py.

from judi import File, Task, add_param, combine_csvs

add_param('100 101 102 103'.split(), 'sample')
add_param('1 2'.split(), 'group')

REF = 'hg_refs/hg19.fa'
path_gen = lambda x: '{}_{}.fq'.format(x['sample'],x['group'])

class AlignFastq(Task):
  inputs = {'reads': File('orig_fastq', path = path_gen)}
  targets = {'sai': File('aln.sai')}
  actions = [('bwa aln {} {} > {}', [REF,'$reads','$sai'])]

class CreateBam(Task):
  mask = ['group']
  inputs = {'reads': AlignFastq.inputs['reads'],
             'sai': AlignFastq.targets['sai']}
  targets = {'bam': File('aln.bam', mask = mask)}
  actions = [('bwa sampe {} {} {} | samtools view -Sbh - | samtools sort - > {}', [REF,'$sai','$reads','$bam'])]

class GetCoverage(Task):
  mask = ['group']
  inputs = {'bam': CreateBam.targets['bam']}
  targets = {'cov': File('cov.csv', mask = mask)}
  actions = [('(echo val; samtools rmdup {} - | samtools mpileup - | cut -f4) > {}', ['$bam','$cov'])]

class CombineCoverage(Task):
  mask = ['group', 'sample']
  inputs = {'cov': GetCoverage.targets['cov']}
  targets = {'csv': File('combined.csv', mask = mask),
             'pdf': File('pltcov.pdf', mask = mask, root = '.')}
  actions = [(combine_csvs, ['#cov', '#csv']),
             ("""echo "library(ggplot2); pdf('{}')
              ggplot(read.csv('{}'), aes(x = val)) +
              geom_density(aes(color = factor(sample)))"\
              | R --vanilla""", ['$pdf','$csv'])]

Run from terminal:

$ doit list
AlignFastq
CombineCoverage
CreateBam
GetCoverage
$ doit
. AlignFastq:group~1,sample~100
. AlignFastq:group~2,sample~100
. AlignFastq:group~1,sample~101
. AlignFastq:group~2,sample~101
. AlignFastq:group~1,sample~102
. AlignFastq:group~2,sample~102
. AlignFastq:group~1,sample~103
. AlignFastq:group~2,sample~103
. CreateBam:sample~100
. CreateBam:sample~102
. CreateBam:sample~103
. CreateBam:sample~101
. GetCoverage:sample~100
. GetCoverage:sample~102
. GetCoverage:sample~103
. GetCoverage:sample~101
. CombineCoverage:

Project Details

License

The MIT License Copyright (c) 2019-2020 Soumitra Pal

see LICENSE file

Install

judi is tested on python 3.6.

$ pip install judi

Dependencies

  • doit

Documentation

docs folder contains ReST documentation based on Sphinx.

$ make html

Contributing

On github create pull requests using a named feature branch.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

judi-0.0.0.4-py3-none-any.whl (13.1 kB view hashes)

Uploaded 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