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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file judi-0.0.0.4-py3-none-any.whl.

File metadata

  • Download URL: judi-0.0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3

File hashes

Hashes for judi-0.0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ac0031558045aa6cb5e1a20f7c63c509cadae2caa043d0c3b6c5069bf6e8e7ad
MD5 71a9067daf91e4496d55c3ceaf786c73
BLAKE2b-256 48537dd0e192c180cc972a4eabbae539f4893f7c874d3a39392deb8a7ced42c5

See more details on using hashes here.

Supported by

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