Updated read counts to give information about aligment percent, and adapter percent.
[htsworkflow.git] / htswanalysis / scripts / Flowcell_QC_Makefile
1 EXPTRACK_DIR=$(HTSW_ANALYSIS_ROOT)
2 DATA_DIR=/Users/Data
3
4 FLOWCELL=$(shell pwd | awk -F/ '{print $$NF}')
5 FILES=$(shell ls -1d *.align*.txt)
6 QPCR_FILES=$(shell ls -1d *.align*.txt | sed -e s/txt/txt.qPCR/)
7 COUNT_FILES=$(shell ls -1d *.align*.txt | sed -e s/txt/txt.count/)
8 CMPLX_FILES=$(shell ls -1d *.align*.txt | sed -e s/txt/txt.complexity/)
9 PROFILE_FILES=$(shell ls -1d *.align*.txt | sed -e s/txt/txt.profile/)
10 PROFILE_IMAGES=$(shell ls -1d *.align*.txt | sed -e s/txt/txt.profile.png/)
11 PERCENT_BASE_IMAGES=$(shell ls -1d *.pf.txt.gz | sed -e s/pf.txt.gz/percent_base.png/)
12
13 all: $(QPCR_FILES) $(PROFILE_FILES) $(CMPLX_FILES) $(PROFILE_IMAGES) $(PERCENT_BASE_IMAGES) $(COUNT_FILES) $(FILES) $(FLOWCELL)_qPCR_summary.txt $(FLOWCELL)_qPCR_summary.html $(FLOWCELL)_LibraryInfo.xml $(FLOWCELL)_SequencingSummary.html $(FLOWCELL)_QC_Summary.html
14
15 %.txt.complexity: %.txt
16         $(EXPTRACK_DIR)/bin/complexity_count `basename $<` $< > $@
17
18 %.txt.count: %.txt
19         $(EXPTRACK_DIR)/scripts/count_reads.pm $< $(shell echo $< | awk -F\. '{ print $$1".all.txt.gz"; }') > $@
20
21 %.txt.qPCR: %.txt
22         $(EXPTRACK_DIR)/bin/qPCR $< $(EXPTRACK_DIR)/reference_data/GenericBackground $(EXPTRACK_DIR)/reference_data/qPCR_Tests/ | sort -k 2 -g -r | awk -F\/ '{print $$NF}' > $@
23
24 %.txt.profile: %.txt
25         $(EXPTRACK_DIR)/bin/profile_reads_against_features $< $(EXPTRACK_DIR)/reference_data/`basename $< | awk -F\. '{ print $$3 }'`_tx_start_sites > $@
26
27 %.txt.profile.png: %.txt.profile
28         cat $(EXPTRACK_DIR)/conf/TSSProfileFormat.gnuplot | sed -e s#FILENAME#$<#g -e s#OUTNAME#$@# | gnuplot;
29
30 # new software to profile base composition .
31 %.percent_base: %.pf.txt.gz
32         cat $< | gzip -d | $(EXPTRACK_DIR)/scripts/count_bases.pm > $@
33
34 %.percent_base.png: %.percent_base
35         cat $(EXPTRACK_DIR)/conf/PercentBaseFormat.gnuplot | sed -e s#FILENAME#$<#g -e s#OUTNAME#$@# | gnuplot;
36
37 $(FLOWCELL)_qPCR_summary.txt: $(QPCR_FILES)
38         rm -f $@;
39         for f in $^; do echo `echo $$f`       `cat $$f | head -n 1` >> $@; echo `echo $$f`       `cat $$f | head -n 2 | tail -n 1` >> $@; done;
40
41 $(FLOWCELL)_qPCR_summary.html: $(FLOWCELL)_qPCR_summary.txt;
42         cat $< | $(EXPTRACK_DIR)/scripts/QC_Summarize_qPCR.pm > $@
43
44 $(FLOWCELL)_LibraryInfo.xml: $(COUNT_FILES)
45         $(EXPTRACK_DIR)/scripts/CollectLibraries.pm `ls *.align*.txt` > $@
46
47 $(FLOWCELL)_SequencingSummary.html: $(FLOWCELL)_LibraryInfo.xml
48         $(EXPTRACK_DIR)/scripts/SummarizeLibrary.pm $< > $@
49
50 $(FLOWCELL)_QC_Summary.html: $(FLOWCELL)_SequencingSummary.html $(FLOWCELL)_qPCR_summary.html $(PROFILE_IMAGES) $(PERCENT_BASE_IMAGES)
51         $(EXPTRACK_DIR)/scripts/WriteQCSummary.pm $(FLOWCELL)_LibraryInfo.xml $(FLOWCELL)_qPCR_summary.txt > $@;