diff --git a/broad_utils.py b/broad_utils.py index 863711a86..abb9b0a76 100755 --- a/broad_utils.py +++ b/broad_utils.py @@ -188,14 +188,13 @@ def make_params_file(inFile, bamDir, outFile): if any(row.get('barcode_2') for row in util.file.read_tabfile_dict(inFile)): header = ['OUTPUT', 'SAMPLE_ALIAS', 'LIBRARY_NAME', 'BARCODE_1', 'BARCODE_2'] else: - header = ['BARCODE', 'OUTPUT', 'SAMPLE_ALIAS', 'LIBRARY_NAME'] + header = ['OUTPUT', 'SAMPLE_ALIAS', 'LIBRARY_NAME', 'BARCODE_1'] with open(outFile, 'wt') as outf: outf.write('\t'.join(header)+'\n') rows = list(util.file.read_tabfile_dict(inFile)) rows.append({'barcode_1':'N','barcode_2':'N','sample':'Unmatched'}) for row in rows: - out = {'BARCODE':row['barcode_1'], - 'BARCODE_1':row['barcode_1'], + out = {'BARCODE_1':row['barcode_1'], 'BARCODE_2':row.get('barcode_2',''), 'SAMPLE_ALIAS':row['sample'], 'LIBRARY_NAME':row['sample']} diff --git a/pipes/rules/demux.rules b/pipes/rules/demux.rules index 29f6a356b..f6e126cf3 100644 --- a/pipes/rules/demux.rules +++ b/pipes/rules/demux.rules @@ -126,7 +126,11 @@ rule illumina_basecalls: lane = get_one_lane_from_run(wildcards.flowcell, wildcards.lane, config['seqruns_demux']) dir = lane['bustard_dir'] run_date = lane.get('seq_run_date') - shell("{config[binDir]}/broad_utils.py illumina_basecalls {dir} {input[1]} {wildcards.flowcell} {wildcards.lane} {input[0]} --include_non_pf_reads=false --run_start_date={run_date} --sequencing_center={params.center}") + opts = '' + for opt in ('read_structure',): + if lane.get(opt): + opts += ' --%s=%s' % (opt, lane[opt]) + shell("{config[binDir]}/broad_utils.py illumina_basecalls {dir} {input[1]} {wildcards.flowcell} {wildcards.lane} {input[0]} --include_non_pf_reads=false --run_start_date={run_date} --sequencing_center={params.center} {opts}") def demux_move_bams_inputs(wildcards): lane = get_one_lane_from_run(wildcards.flowcell, wildcards.lane, config.get('seqruns_demux','')) @@ -143,15 +147,15 @@ rule move_bams_demux: shutil.move(input[0], output[0]) rule bams_from_fastq: - input: os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}_R1_{idx}.fastq'), - os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}_R2_{idx}.fastq') - output: os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}_{idx}.bam') + input: os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}_L001_R1_001.fastq.gz'), + os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}_L001_R2_001.fastq.gz') + output: os.path.join(config['dataDir'],config['subdirs']['source'],'{sample}.bam') params: LSF=config.get('LSF_queues', {}).get('short', '-W 4:00'), - logid="{sample}_{idx}", + logid="{sample}", center=config["seq_center"] run: makedirs(os.path.join(config['dataDir'], config['subdirs']['source'])) - shell("{config[binDir]}/read_utils.py fastq_to_bam {input} {output} --sampleName {wildcards.sample} --picardOptions PLATFORM=illumina SEQUENCING_CENTER={params.center} LIBRARY_NAME={wildcards.sample}_{wildcards.idx} SORT_ORDER=queryname") + shell("{config[binDir]}/read_utils.py fastq_to_bam {input} {output} --sampleName {wildcards.sample} --picardOptions PLATFORM=illumina SEQUENCING_CENTER={params.center} LIBRARY_NAME={wildcards.sample} SORT_ORDER=queryname") ruleorder: move_bams_demux > bams_from_fastq diff --git a/tools/picard.py b/tools/picard.py index 422b2209c..6898a8b0e 100644 --- a/tools/picard.py +++ b/tools/picard.py @@ -212,11 +212,7 @@ def execute(self, basecalls_dir, barcodes_dir, opts += ['BASECALLS_DIR='+basecalls_dir, 'BARCODES_DIR='+barcodes_dir, 'LANE='+str(lane), - 'RUN_BARCODE='+run_barcode] - if 'BARCODE' in util.file.readFlatFileHeader(library_params): - # yes, it's deprecated, but it's the only way to do single-barcode pools - opts.append('BARCODE_PARAMS='+library_params) - else: - opts.append('LIBRARY_PARAMS='+library_params) + 'RUN_BARCODE='+run_barcode, + 'LIBRARY_PARAMS='+library_params] PicardTools.execute(self, self.subtoolName, opts, JVMmemory)