modified: Makefile
[GalaxyCodeBases.git] / python / salus / cmplatform / makefile
blob0761a7787a8d596dd6f7a7eed7708f6220951367
1 SAMPLEID := mbrain mkidney
2 LANEID_Illumina := L001
3 LANEID_Salus := L001 L002 L003 L004
4 PLATFORMS := Illumina Salus
6 SRBIN := /share/result/spatial/test_huxs/10x/space-ranger/spaceranger-2.1.1/bin/spaceranger
8 define platform_rule
9 TAGS_$1 := $$(foreach s, $$(SAMPLEID), $1/$$(s)_S1_L001)
10 endef
11 $(foreach platform,$(PLATFORMS),$(eval $(call platform_rule,$(platform))))
12 ALLTAGS := $(TAGS_Illumina) $(TAGS_Salus)
14 RAW_Salus := $(foreach a, $(SAMPLEID), $(foreach b, $(LANEID_Salus), $(foreach r,R1 R2,raw4_Salus/$(a)_S1_$(b)_$(r)_001.fastq.gz )))
15 MERGE_Salus := $(foreach tag,$(TAGS_Salus),raw_$(tag) )
16 MERGE_Illumina := $(foreach a, $(SAMPLEID), $(foreach r,R1 R2,raw_Illumina/$(a)_S1_L001 ))
17 FASTP_TAGS := $(foreach tag,$(ALLTAGS),fastp_$(tag) )
18 SUBFQ_TAGS := $(foreach tag,$(ALLTAGS),sub_$(tag) )
19 FQ_DIRS := $(foreach p,raw fastp sub,$(foreach pf,$(PLATFORMS),$(p)_$(pf)))
20 SRLOGS := $(foreach smp, $(SAMPLEID), $(foreach pf,$(PLATFORMS),sr_$(pf)/sub_$(pf)_$(smp).log ))
22 #all: $(MERGE_Salus) $(FASTP_TAGS) $(foreach d,$(FQ_DIRS),$(d).stats) $(SRLOGS)
23 all: $(foreach d,$(FQ_DIRS),$(d).stats) $(SRLOGS)
24 @echo $^
26 define smp_rule
27 raw_Salus/$1_S1_L001: $$(filter raw4_Salus/$1_S1_%,$$(RAW_Salus))
28 mkdir -p $$(dir $$@)
29 @cat $$(filter %_R1_001.fastq.gz,$$^) > $$@_R1_001.fastq.gz
30 @cat $$(filter %_R2_001.fastq.gz,$$^) > $$@_R2_001.fastq.gz
31 touch $$@
32 raw_Illumina/$1_S1_L001:
33 touch $$@
34 sub_Illumina/$1_S1_L001: $$(filter fastp_Illumina/$1_S1_L001,$$(FASTP_TAGS))
35 mkdir -p $$(dir $$@)
36 cp --reflink=auto -l $$^_R1_001.cut.gz $$@_R1_001.fastq.gz
37 cp --reflink=auto -l $$^_R2_001.cut.gz $$@_R2_001.fastq.gz
38 touch $$@
39 endef
40 $(foreach sample, $(SAMPLEID), $(eval $(call smp_rule,$(sample))))
42 define pf_smp_rule
43 fastp_$1/$2_S1_L001: $$(filter raw_$1/$2_S1_L001,$$(MERGE_Salus) $$(MERGE_Illumina))
44 mkdir -p $$(dir $$@)
45 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 \
46 -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
47 micromamba run -n salus cutadapt -Z -j8 --pair-filter=any --minimum-length 28:50 --length 100 --times 0 --report full --json=$$@.cut.json \
48 -o $$@_R1_001.cut.gz -p $$@_R2_001.cut.gz $$@_R1_001.fastp.gz $$@_R2_001.fastp.gz >$$@.cut.log
49 touch $$@
50 endef
51 $(foreach pf, $(PLATFORMS), $(foreach sample, $(SAMPLEID), $(eval $(call pf_smp_rule,$(pf),$(sample)))) )
53 define pf_rule
54 sr_$(1)/sub_$(1)_mbrain.log: $$(filter sub_$1/mbrain_S1_L001,$$(SUBFQ_TAGS))
55 mkdir -p $$(dir $$@)
56 micromamba run -n salus $$(SRBIN) count --id=srp_$(1)_mbrain --transcriptome=refdata-gex-mm10-2020-A --fastqs=sub_$1 --sample=mbrain \
57 --slide=V12A25-031 --slidefile=V12A25-031.gpr --localcores=36 --localmem=64 --vdrmode=disable \
58 --area=A1 --image=mbrain.tif >$$@
59 sr_$(1)/sub_$(1)_mkidney.log: $$(filter sub_$1/mkidney_S1_L001,$$(SUBFQ_TAGS))
60 mkdir -p $$(dir $$@)
61 micromamba run -n salus $$(SRBIN) count --id=srp_$(1)_mkidney --transcriptome=refdata-gex-mm10-2020-A --fastqs=sub_$1 --sample=mkidney \
62 --slide=V12A25-031 --slidefile=V12A25-031.gpr --localcores=36 --localmem=64 --vdrmode=disable \
63 --area=A1 --image=mkidney.tif >$$@
64 endef
65 $(foreach pf, $(PLATFORMS), $(eval $(call pf_rule,$(pf))))
67 sub_Salus/mbrain_S1_L001: $(filter fastp_Salus/mbrain_S1_L001,$(FASTP_TAGS))
68 mkdir -p $(dir $@)
69 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
70 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
71 touch $@
73 sub_Salus/mkidney_S1_L001: $(filter fastp_Salus/mkidney_S1_L001,$(FASTP_TAGS))
74 mkdir -p $(dir $@)
75 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
76 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
77 touch $@
79 %.stats: $(foreach sample, $(SAMPLEID), %/$(sample)_S1_L001)
80 micromamba run -n salus seqkit stats -a -o $@ -j8 $(dir $<)*.gz
82 .PHONY scp:
83 scp makefile s0:/share/result/spatial/data/BoAo_sp/sub/