Minor typeo fix
[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         grep -v contam $< | awk '{if(NF > 3) {print $$1} }' | wc -l > $@;
20
21 %.txt.qPCR: %.txt
22         echo $(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         $(EXPTRACK_DIR)/bin/qPCR $< $(EXPTRACK_DIR)/reference_data/GenericBackground $(EXPTRACK_DIR)/reference_data/qPCR_Tests/ | sort -k 2 -g -r | awk -F\/ '{print $$NF}' > $@
24
25 %.txt.profile: %.txt
26         $(EXPTRACK_DIR)/bin/profile_reads_against_features $< $(EXPTRACK_DIR)/reference_data/`basename $< | awk -F\. '{ print $$3 }'`_tx_start_sites > $@
27
28 %.txt.profile.png: %.txt.profile
29         cat $(EXPTRACK_DIR)/conf/TSSProfileFormat.gnuplot | sed -e s#FILENAME#$<#g -e s#OUTNAME#$@# | gnuplot;
30
31 # new software to profile base composition .
32 %.percent_base: %.pf.txt.gz
33         cat $< | gzip -d | $(EXPTRACK_DIR)/scripts/count_bases.pm > $@
34
35 %.percent_base.png: %.percent_base
36         cat $(EXPTRACK_DIR)/conf/PercentBaseFormat.gnuplot | sed -e s#FILENAME#$<#g -e s#OUTNAME#$@# | gnuplot;
37
38 $(FLOWCELL)_qPCR_summary.txt: $(QPCR_FILES)
39         rm -f $@;
40         for f in $^; do echo `echo $$f`       `cat $$f | head -n 1` >> $@; echo `echo $$f`       `cat $$f | head -n 2 | tail -n 1` >> $@; done;
41
42 $(FLOWCELL)_qPCR_summary.html: $(FLOWCELL)_qPCR_summary.txt;
43         cat $< | $(EXPTRACK_DIR)/scripts/QC_Summarize_qPCR.pm > $@
44
45 $(FLOWCELL)_LibraryInfo.xml: $(COUNT_FILES)
46         $(EXPTRACK_DIR)/scripts/CollectLibraries.pm `ls *.align*.txt` > $@
47
48 $(FLOWCELL)_SequencingSummary.html: $(FLOWCELL)_LibraryInfo.xml
49         $(EXPTRACK_DIR)/scripts/SummarizeLibrary.pm $< > $@
50
51 $(FLOWCELL)_QC_Summary.html: $(FLOWCELL)_SequencingSummary.html $(FLOWCELL)_qPCR_summary.html $(PROFILE_IMAGES) $(PERCENT_BASE_IMAGES)
52         $(EXPTRACK_DIR)/scripts/WriteQCSummary.pm $(FLOWCELL)_LibraryInfo.xml $(FLOWCELL)_qPCR_summary.txt > $@;