Skip to content

Commit

Permalink
revert BARCODE_PARAMS stuff and make sure to pass read_structure to i…
Browse files Browse the repository at this point in the history
…llumina_basecalls in snakemake
  • Loading branch information
dpark01 committed Apr 29, 2015
1 parent e6041dd commit 00e34df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions broad_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}
Expand Down
16 changes: 10 additions & 6 deletions pipes/rules/demux.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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',''))
Expand All @@ -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

8 changes: 2 additions & 6 deletions tools/picard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 00e34df

Please sign in to comment.