def run_pipeline(reads, options): # Instantiate options output_dir = options['output_dir'] logs_dir = options['logs_dir'] lib_prefix = options['lib_prefix'] step = options['step'] config = options['config'] run_is_paired_end = options['run_is_paired_end'] cutadapt = Software('cutadapt', config['cutadapt']['path']) fastqc = Software('FastQC', config['fastqc']['path']) bwa_aln = Software('BWA aln', config['bwa']['path'] + ' aln') bwa_sampe = Software('BWA sampe', config['bwa']['path'] + ' sampe')
config = options['config'] run_is_paired_end = options['run_is_paired_end'] # Keep list of items to delete staging_delete = ['tmp'] try: forward_adapter = options['extra_info']['forward_adapter'] reverse_adapter = options['extra_info']['reverse_adapter'] sailfish_libtype = options['extra_info']['sailfish_libtype'] except KeyError, e: # TODO Make better exception message raise KeyError('Some needed extra_info not given.') # Establish Software instances cat = Software('cat', '/bin/cat') cutadapt = Software('cutadapt', config['cutadapt']['path']) kallisto = Software('kallisto', config['kallisto']['path']) sailfish = Software('sailfish', config['sailfish']['path']) # Combine reads with extra sequencing depth if step <= 1 and len(reads) >= 2: if run_is_paired_end: # Aggregate read1s and read2s read1s, read2s = [], [] for read in reads: read1, read2 = read.split(':') read1s.append(read1) read2s.append(read2) # Combine reads groups
config = options['config'] run_is_paired_end = options['run_is_paired_end'] try: run_is_stranded = True if options['extra_info']['run_is_stranded'].lower() == 'true' else False cufflinks_lib_type = options['extra_info']['cufflinks_lib_type'] htseq_stranded = options['extra_info']['htseq_stranded'] # yes|no|reverse forward_adapter = options['extra_info']['forward_adapter'] reverse_adapter = options['extra_info']['reverse_adapter'] except KeyError, e: # TODO Make better exception message raise KeyError('Some needed extra_info not given.') # Establish Software instances cutadapt = Software('Cutadapt', config['cutadapt']['path']) star = Software('STAR Two-Pass', config['STAR']['path']) novosort = Software('Novosort', config['novosort']['path']) samtools_flagstat = Software('Samtools Flagstat', config['samtools_flagstat']['path']) cufflinks = Software('Cufflinks', config['cufflinks']['path']) htseq = Software('HTSeq', config['htseq']['path']) # Housekeeping star_output = [] novosort_outfile = '' if htseq_stranded not in ['yes', 'no', 'reverse']: raise ValueError('htseq_stranded is not yes|no|reverse') if cufflinks_lib_type not in ['ff-firststrand', 'ff-secondstrand', 'ff-unstranded', 'fr-firststrand',
__author__ = 'Dominic Fitzgerald' import sys from dive.components import Software, Parameter, Redirect sample = sys.argv[1] # Instantiate software # Software(software_name, software_path) picard = Software('picard', '/path/to/java /path/to/picard.jar') # Run software # Put as many Parameter and Redirect as needed # Order matters, so generally Redirect should be last # Parameter('arguments', 'separated', 'by', 'spaces') picard.run( Parameter('I=' + sample), Parameter('O=/path/to/output'), Parameter('-T', 'SplitNCigarReads'), Redirect(type='>', dest='out.txt') ) # Will produce and execute: # /path/to/java /path/to/picard.jar I=/path/to/input.bam O=/path/to/output -T SplitNCigarReads > out.txt
star_output = [] # Keep list of items to delete staging_delete = ['tmp'] # Get extra options try: forward_adapter = options['extra_info']['forward_adapter'] reverse_adapter = options['extra_info']['reverse_adapter'] run_is_stranded = True if options['extra_info']['run_is_stranded'].lower() == 'true' else False except KeyError, e: # TODO Make better exception message raise KeyError('Some needed extra_info not given.') # Establish software instances cat = Software('cat', '/bin/cat') cutadapt = Software('cutadapt', config['cutadapt']['path']) star = Software('STAR', config['STAR']['path']) rsem = Software('RSEM', config['RSEM']['path']) bedGraph_to_bw = Software('bedGraphToBigWig', config['bedGraphToBigWig']['path']) if step <= 1 and len(reads) >= 2: if run_is_paired_end: # Aggregate read1s and read2s read1s, read2s = [], [] for reads_set in reads: read1, read2 = reads_set.split(':') read1s.append(read1) read2s.append(read2) # Combine reads groups
__author__ = 'Dominic Fitzgerald' import sys from dive.components import Software, Parameter, Redirect sample = sys.argv[1] # Instantiate software # Software(software_name, software_path) picard = Software('picard', '/path/to/java /path/to/picard.jar') # Run software # Put as many Parameter and Redirect as needed # Order matters, so generally Redirect should be last # Parameter('arguments', 'separated', 'by', 'spaces') picard.run(Parameter('I=' + sample), Parameter('O=/path/to/output'), Parameter('-T', 'SplitNCigarReads'), Redirect(type='>', dest='out.txt')) # Will produce and execute: # /path/to/java /path/to/picard.jar I=/path/to/input.bam O=/path/to/output -T SplitNCigarReads > out.txt