Commit f5be3025 authored by Rachel  LEGENDRE's avatar Rachel LEGENDRE
Browse files

add stderr log to macs2 - add spp file as input instead of params

parent 9e1eddaa
......@@ -667,7 +667,7 @@ if config["macs2"]["do"]:
macs2_options += " --nomodel "
macs2_shift_file = os.path.join(analysis_dir, "05-QC/PhantomPeakQualTools/{{SAMPLE}}_{}_sort{}_spp.out".format(ref, biasedRegions))
else:
macs2_shift_file = "Empty"
macs2_shift_file = "{}/{{SAMPLE}}_{}_sort{}.bam".format(biasedRegions_dir, ref, biasedRegions)
if paired :
macs2_pe_mode = "no"
else:
......@@ -675,7 +675,8 @@ if config["macs2"]["do"]:
macs2_input_bam = "{}/{{SAMPLE}}_{}_sort{}.bam".format(biasedRegions_dir, ref, biasedRegions)
macs2_control = INPUTtoIP
macs2_log = os.path.join(analysis_dir, "06-PeakCalling/macs2/{}/logs/{{SAMPLE}}.out".format(model_dir))
macs2_log_out = os.path.join(analysis_dir, "06-PeakCalling/macs2/{}/logs/{{SAMPLE}}.out".format(model_dir))
macs2_log_err = os.path.join(analysis_dir, "06-PeakCalling/macs2/{}/logs/{{SAMPLE}}.err".format(model_dir))
macs2_output = os.path.join(analysis_dir, "06-PeakCalling/macs2/{}/{{SAMPLE}}_peaks.{}Peak".format(model_dir, model))
macs2_output_prefix = os.path.join(analysis_dir, "06-PeakCalling/macs2/{}/{{SAMPLE}}".format(model_dir))
......
......@@ -26,16 +26,17 @@
rule macs2:
input:
bam = macs2_input_bam,
control = macs2_control
control = macs2_control,
shift_file = macs2_shift_file
params:
gsize = config["macs2"]["genomeSize"],
options = macs2_options,
pe_mode = macs2_pe_mode,
prefix = macs2_output_prefix,
shift_file = macs2_shift_file,
read_length = 146
log:
out = macs2_log
out = macs2_log_out,
err = macs2_log_err
output:
macs2_output
singularity:
......@@ -46,20 +47,20 @@ rule macs2:
#if [[ "{input.control}" == "NA" ]] ; then input="" ; else input="{input.control}" ; fi
if [[ {params.shift_file} != "Empty" ]] ; then
if [[ -e {params.shift_file} ]] ; then
shift=$(awk '{{print $3}}' {params.shift_file} | awk -F ',' '{{if ($1=={params.read_length}){{print $2}} else {{print $1}} }}')
if [[ {input.shift_file} == "*_spp.out" ]] ; then
if [[ -e {input.shift_file} ]] ; then
shift=$(awk '{{print $3}}' {input.shift_file} | awk -F ',' '{{if ($1=={params.read_length}){{print $2}} else {{print $1}} }}')
if [[ {params.pe_mode} == "yes" ]] ; then
macs2 callpeak -t {input.bam} -c {input.control} -f BAMPE -g {params.gsize} -n {params.prefix} {params.options} --extsize ${{shift}} 2> {log.out}
macs2 callpeak -t {input.bam} -c {input.control} -f BAMPE -g {params.gsize} -n {params.prefix} {params.options} --extsize ${{shift}} > {log.out} 2> {log.err}
else
macs2 callpeak -t {input.bam} -c {input.control} -f BAM -g {params.gsize} -n {params.prefix} {params.options} --extsize ${{shift}} 2> {log.out}
macs2 callpeak -t {input.bam} -c {input.control} -f BAM -g {params.gsize} -n {params.prefix} {params.options} --extsize ${{shift}}> {log.out} 2> {log.err}
fi
fi
else
if [[ {params.pe_mode} == "yes" ]] ; then
macs2 callpeak -t {input.bam} -c {input.control} -f BAMPE -g {params.gsize} -n {params.prefix} {params.options} 2> {log.out}
macs2 callpeak -t {input.bam} -c {input.control} -f BAMPE -g {params.gsize} -n {params.prefix} {params.options} > {log.out} 2> {log.err}
else
macs2 callpeak -t {input.bam} -c {input.control} -f BAM -g {params.gsize} -n {params.prefix} {params.options} 2> {log.out}
macs2 callpeak -t {input.bam} -c {input.control} -f BAM -g {params.gsize} -n {params.prefix} {params.options} > {log.out} 2> {log.err}
fi
fi
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment