modified: makefile
[GalaxyCodeBases.git] / python / salus / cmplatform / makefile
blob4944cd600b6cea95e2e912abf0609cc658586576
1 SAMPLEID := mbrain mkidney
2 LANEID_Illumina := L001
3 LANEID_Salus := L001 L002 L003 L004
4 PLATFORMS := Illumina Salus
6 define platform_rule
7 TAGS_$1 := $$(foreach s, $$(SAMPLEID), $1/$$(s)_S1_L001)
8 endef
9 $(foreach platform,$(PLATFORMS),$(eval $(call platform_rule,$(platform))))
10 ALLTAGS := $(TAGS_Illumina) $(TAGS_Salus)
12 RAW_Salus := $(foreach a, $(SAMPLEID), $(foreach b, $(LANEID_Salus), $(foreach r,R1 R2,raw4_Salus/$(a)_S1_$(b)_$(r)_001.fastq.gz )))
13 MERGE_Salus := $(foreach tag,$(TAGS_Salus),raw_$(tag) )
14 MERGE_Illumina := $(foreach a, $(SAMPLEID), $(foreach r,R1 R2,raw_Illumina/$(a)_S1_L001 ))
15 FASTP_TAGS := $(foreach tag,$(ALLTAGS),fastp_$(tag) )
16 FQ_DIRS := $(foreach p,raw fastp sub,$(foreach pf,$(PLATFORMS),$(p)_$(pf)))
18 all: $(MERGE_Salus) $(FASTP_TAGS) $(foreach d,$(FQ_DIRS),$(d).stats)
19 @echo $^
21 define smp_rule
22 raw_Salus/$1_S1_L001: $$(filter raw4_Salus/$1_S1_%,$$(RAW_Salus))
23 mkdir -p $$(dir $$@)
24 @cat $$(filter %_R1_001.fastq.gz,$$^) > $$@_R1_001.fastq.gz
25 @cat $$(filter %_R2_001.fastq.gz,$$^) > $$@_R2_001.fastq.gz
26 touch $$@
27 .PHONY raw_Illumina/$1_S1_L001:
28 # touch $$@
29 sub_Illumina/$1_S1_L001: $$(filter fastp_Illumina/$1_S1_L001,$$(FASTP_TAGS))
30 mkdir -p $$(dir $$@)
31 cp --reflink=auto -l $$^_R1_001.cut.gz $$@_R1_001.fastq.gz
32 cp --reflink=auto -l $$^_R2_001.cut.gz $$@_R2_001.fastq.gz
33 touch $$@
34 endef
35 $(foreach sample, $(SAMPLEID), $(eval $(call smp_rule,$(sample))))
37 define pf_smp_rule
38 fastp_$1/$2_S1_L001: $$(filter raw_$1/$2_S1_L001,$$(MERGE_Salus) $$(MERGE_Illumina))
39 mkdir -p $$(dir $$@)
40 micromamba run -n salus fastp --thread 4 -z 4 -A --max_len1 28 --max_len2 0 --dont_eval_duplication -q 20 -u 82 -n 4 --average_qual 20 --length_required 28 -y -Y 30 -g -x \
41 -i $$<_R1_001.fastq.gz -I $$<_R2_001.fastq.gz -o $$@_R1_001.fastp.gz -O $$@_R2_001.fastp.gz -j $$@.fastp.json -h $$@.fastp.html 2>$$@.fastp.log
42 micromamba run -n salus cutadapt -Z -j8 --pair-filter=any --minimum-length 28:50 --length 100 --times 0 --report full --json=$$@.cut.json \
43 -o $$@_R1_001.cut.gz -p $$@_R2_001.cut.gz $$@_R1_001.fastp.gz $$@_R2_001.fastp.gz >$$@.cut.log
44 touch $$@
45 endef
46 $(foreach pf, $(PLATFORMS), $(foreach sample, $(SAMPLEID), $(eval $(call pf_smp_rule,$(pf),$(sample)))) )
48 define pf_rule
49 endef
50 $(foreach pf, $(PLATFORMS), $(eval $(call pf_rule,$(pf))))
52 sub_Salus/mbrain_S1_L001: $(filter fastp_Salus/mbrain_S1_L001,$(FASTP_TAGS))
53 mkdir -p $(dir $@)
54 micromamba run -n salus seqkit --compress-level 4 -o $@_R1_001.fastq.gz -w 200 -j 1 sample -p 0.72 -s 123456 $^_R1_001.cut.gz
55 micromamba run -n salus seqkit --compress-level 4 -o $@_R2_001.fastq.gz -w 200 -j 1 sample -p 0.72 -s 123456 $^_R2_001.cut.gz
56 touch $@
58 sub_Salus/mkidney_S1_L001: $(filter fastp_Salus/mkidney_S1_L001,$(FASTP_TAGS))
59 mkdir -p $(dir $@)
60 micromamba run -n salus seqkit --compress-level 4 -o $@_R1_001.fastq.gz -w 200 -j 1 sample -p 0.76 -s 123456 $^_R1_001.cut.gz
61 micromamba run -n salus seqkit --compress-level 4 -o $@_R2_001.fastq.gz -w 200 -j 1 sample -p 0.76 -s 123456 $^_R2_001.cut.gz
62 touch $@
64 %.stats: $(foreach sample, $(SAMPLEID), %/$(sample)_S1_L001)
65 micromamba run -n salus seqkit stats -a -o $@ -j8 $(dir $<)*.gz
67 .PHONY scp:
68 scp makefile s0:/share/result/spatial/data/BoAo_sp/sub/