Verified Commit dfd2bd7d authored by Aurélien Ginolhac's avatar Aurélien Ginolhac 🚴
Browse files

bugfixes in individual peak type

parent a97de040
......@@ -99,11 +99,16 @@ def get_sample_control_peak_combinations_list():
return sam_contr
def get_peak_combinations_list():
peak_contr = []
for sample in samples.index:
if not is_control(sample):
sam_contr.extend(expand(["{peak}"], peak = samples.loc[sample]["peak-analysis"]))
return peak_contr
peak_type = []
for peak_file in get_sample_control_peak_combinations_list():
try:
found = re.search('\.(.+?)_peaks', peak_file).group(1)
peak_type.append(found)
except AttributeError:
found = ''
finally:
peak_type.append(found)
return peak_type
def get_peaks_count_plot_input():
return expand(
......@@ -117,11 +122,11 @@ def get_peaks_output():
if not is_control(sample):
if samples.loc[sample]["peak-analysis"] == "broad":
peak_out.extend(expand(["results/macs2_callpeak/{sample}-{control}.{peak}_peaks.gappedPeak"], sample = sample, control = samples.loc[sample]["control"], peak = samples.loc[sample]["peak-analysis"]))
if samples.loc[sample]["peak-analysis"] == "nrrow":
elif samples.loc[sample]["peak-analysis"] == "narrow":
peak_out.extend(expand(["results/macs2_callpeak/{sample}-{control}.{peak}_summits.bed"], sample = sample, control = samples.loc[sample]["control"], peak = samples.loc[sample]["peak-analysis"]))
else:
raise ValueError(
f"for {sample}, peak-analysis must be either narrow or broad (not {samples.loc[sample]["peak-analysis"]}\n"
f"for {sample}, peak-analysis must be either narrow or broad (not {samples.loc[sample]['peak-analysis']})\n"
)
return peak_out
......@@ -132,10 +137,11 @@ def get_frip_score_input():
)
def get_macs2_peaks():
return expand(
"results/macs2_callpeak/{sam_contr_peak}_peaks.{peak}Peak",
sam_contr_peak = get_sample_control_peak_combinations_list(), peak = get_peak_combinations_list()
)
sam_contr = []
for sample in samples.index:
if not is_control(sample):
sam_contr.extend(expand(["results/macs2_callpeak/{sample}-{control}.{peak}_peaks.{peak}Peak"], sample = sample, control = samples.loc[sample]["control"], peak = samples.loc[sample]["peak-analysis"]))
return sam_contr
def get_plot_homer_annotatepeaks_input():
return expand("results/homer/annotate_peaks/{sam_contr_peak}_peaks.annotatePeaks.txt",
......@@ -225,7 +231,7 @@ def get_files_for_igv():
"results/macs2_merged_expand/{antibody}.consensus_{peak}-peaks.boolean.bed"
],
sample_control_peak=get_sample_control_peak_combinations_list(),
peak=get_peak_combinations_list()
peak=get_peak_combinations_list(),
antibody=get_unique_antibodies()
)
)
......@@ -351,8 +357,7 @@ def all_input(wildcards):
# QC with fastQC and multiQC, igv session
wanted_input.extend([
"results/qc/multiqc/multiqc.html",
"results/IGV/igv_session.xml"
"results/qc/multiqc/multiqc.html"
])
# trimming reads
......@@ -461,7 +466,7 @@ def all_input(wildcards):
"results/macs2_callpeak/{sample}-{control}.{peak}_control_lambda.bdg",
"results/macs2_callpeak/{sample}-{control}.{peak}_peaks.{peak}Peak",
"results/macs2_callpeak/plots/plot_{peak}_peaks_count.pdf",
"results/macs2_callpeak/plots/plot_{peak}_peaks_frip_score.pdf",
#"results/macs2_callpeak/plots/plot_{peak}_peaks_frip_score.pdf",
"results/macs2_callpeak/plots/plot_{peak}_peaks_macs2.pdf"
],
sample = sample,
......@@ -470,5 +475,5 @@ def all_input(wildcards):
antibody = samples.loc[sample]["antibody"]
)
)
wanted_input.extend(get_peaks_output())samples.loc[sample]["peak-analysis"]
wanted_input.extend(get_peaks_output())
return wanted_input
......@@ -38,6 +38,7 @@ rule mark_merged_duplicates:
metrics="results/picard_dedup/{sample}.metrics.txt"
log:
"logs/picard/picard_dedup/{sample}.log"
threads: 2
params:
"REMOVE_DUPLICATES=false ASSUME_SORTED=true VALIDATION_STRINGENCY=LENIENT"
wrapper:
......
Markdown is supported
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