-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquality-control.make
62 lines (46 loc) · 2.6 KB
/
quality-control.make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# FASTQ QC# {{{
.PHONY: fastq-qc
fastq-qc: ${fastqc_zip}
${data_path}/fastqc/%_fastqc.zip: ${data_path}/%.fastq.gz
${bsub} -n 6 -R 'rusage[mem=6000]' "run-fastqc.sh $<"
# }}}
# ChIP quality control# {{{
.PHONY: chip-qc
## Calculates cross-correlation and makes custom fingerprint plots to investigate enrichment
chip-qc: ${cross_correlation} ${enrichment_files} ${enrichment_plots}
# use 6 nodes, savp creates the cross correlation plot
# run_spp_parallel.R is a modified version of phantompeaktools/run_spp.R to use
# makeForkCluster from parallel package (instead of makeCluster from snow, which doesn't play well
# with LSF in this case). Similar problem as here: https://stat.ethz.ch/pipermail/r-sig-hpc/2012-December/001568.html
${qc_path}%.cross-correlation:: ${map_path}%.bam
${bsub} -n 8 -M ${memlimit} -R "select[ncores=8]" "Rscript ~/local/phantompeakqualtools/run_spp_parallel.R -p=8 -c=$< -savp -tmpdir=${qc_path}/tmp -out=$@"
mv ${map_path}$*.pdf ${qc_path}
${qc_path}/%.cross-correlation:: ${map_path}/ddup/%.bam
${bsub} -n 8 -M ${memlimit} -R "select[ncores=8]" "Rscript ~/local/phantompeakqualtools/run_spp_nodups.R -p=8 -c=$< -savp -tmpdir=${qc_path}/tmp -out=$@"
mv ${map_path}/ddup/$*.pdf ${qc_path}
${qc_path}%.enrichment: ${map_path}%.bam
${bsub} -n 4 "perl ~/source/check-chip-enrichment.pl ${reference}/${assembly}.fa.fai 1000 $< > $@"
${qc_path}/plots/%.png: ${qc_path}/%.enrichment
$(eval target_ctrl := $(call KEEP,$(call get-base,$*),$(call KEEP,$(call get-ctrl-type,$*)_,${enrichment_files})))
${bsub} -M ${memlimit} "Rscript ~/source/plot-chip-enrichment.R -b $< $(target_ctrl) -o $(dir $(@D))"
# }}}
# Correlation # {{{
# ${sample_correlation} needs to be provided from the project specific makefile,
# where any particular filtering is done.
correlation_sets := $(patsubst %.pdf, %, ${sample_correlation})
define COR
$(1).sample-correlation: $(call KEEP,ddup,$(call KEEP,$(notdir $(1)),${bigwig}))
# @echo $$^ | tr ' ' '\n' > $(1).tmp
@echo $$^ | tr ' ' '\n' #> $(1).tmp
# Rscript -e "a=read.delim('$(1).tmp', stringsAsFactors=F); a=a[[1]]; b=as.data.frame(t(combn(a,2))); write.table(b, '$(1).pairwise-combn', col.names=F, row.names=F, sep=' ', quote=F)"
# ${bsub} run-bigWigCorrelate-on-pairs.sh $(1).pairwise-combn $(1).sample-correlation
# rm $(1).tmp
$(1).pdf: $(1).sample-correlation
${bsub} "Rscript ~/source/plot-bw-correlation.R -s $(1).sample-correlation"
endef
$(foreach cn,${correlation_sets},$(eval $(call COR,$(cn))))
.PHONY: correlation
## Calculate correlation of samples genome wide (not on specific regions)
correlation: ${sample_correlation} #${correlation_plots}
# }}}
# vim: ft=make