def build_dag(input_fastqs, chrs=[]): """Build a DAG to handle a FASTQ->polymorphic STR loci.""" return DAG().sequence_( add_(gen_inputs(input_fastqs)), reduce_([ 'sample', 'readgroup', 'chunk' ], tools.align), reduce_([ 'sample' ], tools.remdup), map_(tools.index_bam), split_([ ('chrom', chrs) ], tools.sputnik), map_(tools.index_bam, stage_name='Index Sputnik BAMs'), map_(tools.msitools), reduce_([ 'sample' ], tools.combine_summaries), map_(tools.genotyper) )
from cosmos.Workflow.models import Workflow from cosmos.contrib.ezflow.dag import DAG, split_,add_,map_,reduce_ from tools import ECHO, CAT, WC, PASTE, Sleep #################### # Workflow #################### dag = DAG().sequence_( add_([ ECHO(tags={'word':'hello'}), ECHO(tags={'word':'world'}) ]), map_(Sleep), split_([('i',[1,2])], CAT), reduce_([], PASTE), map_(WC), ) dag.create_dag_img('/tmp/ex.svg') ################# # Run Workflow ################# WF = Workflow.start('Example 3',restart=True,delete_intermediates=True) dag.add_to_workflow(WF) WF.run()