Guest User

Untitled

a guest
Mar 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. # get the list of fastqs - R1 only
  2. FQ=$(shell find /path/to/jvarkit-git/src/test/resources/ -type f -name "*.R1.fq.gz")
  3. # reference genome
  4. REF=/path/to/jvarkit-git/src/test/resources/rotavirus_rf.fa
  5. .PHONY:all
  6.  
  7. # function used to extract a name from a fastq: we remove the suffix .R1.fq.gz and the directory
  8. define sample
  9. $(notdir $(subst .R1.fq.gz,,$(1)))
  10. endef
  11.  
  12. # function used create a recipe fastq->sam
  13. # argument $1 is a Fastq R1
  14. # target is the sample-name + ".sam" extension
  15. # dependencies are : REF, the fastq-R1, the fastq R1 -> replace R1.fq.gz with R2.fq.gz
  16.  
  17. define run
  18. $$(addsuffix .sam,$$(call sample,$(1))): $(REF) $(1) $$(subst .R1.fq.gz,.R2.fq.gz,$(1))
  19. bwa mem \
  20. -R '@RG\tID:$$(call sample,$(1))\tSM:$$(call sample,$(1))\tLB:Trusight_custom_amplicon_CARR\tPL:ILLUMINA\tPI:150' \
  21. -k 19 -A 1 -B 4 -O 6 -L 5 \
  22. $$(word 1,$$^) \
  23. $$(word 2,$$^) \
  24. $$(word 3,$$^) > $$@
  25. endef
  26.  
  27. # final target: extract the sample names from the R1.fastq and add the suffix '.sam'
  28. all: $(addsuffix .sam,$(call sample,$(FQ)))
  29.  
  30. $(foreach S,$(FQ),$(eval $(call run,$S)))
Add Comment
Please, Sign In to add comment