-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
911 lines (750 loc) · 35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
# ==============================================================================
# Brief explanation of Makefile syntax
# ==============================================================================
# Since Makefiles are a bit special, and there are not a lot of easy to read
# tutorials out there, here follows a very brief introduction to the syntax in
# Makefiles.
#
# Basics
# ------------------------------------------------------------------------------
#
# Makefiles are in many ways similar to bash-scripts, but unlike bash-scripts
# they are not written in a linear sequential fashion, but rather divided into
# so called rules, that are typically tightly connected to specific output file
# paths or file path pattern.
#
# Firstly, Makefiles should be named `Makefile` and be put inside a folder
# where one wants to run the make command.
#
# The rule syntax
# ------------------------------------------------------------------------------
#
# The syntax of a rule is at its core very simple:
#
# output file(s)/target(s) : any dependent input files
# commands to produce the output files from input files
# possibly more commands
#
# So, the significant part of the rule syntax is the ':'-character, as well as
# the indentation of the rows following the head of the rule, to indicate the
# "recipe" or the commands to produce the outputs of the rule.
#
# A rule can also have just a name, and no concrete output file. That is, it
# would have the form:
#
# name_of_the_rule : any dependent input files
# one commands
# more commands
#
# Now, there is one big caveat here, related to our scripts: Make will rebuild
# a target as soon as any of its inputs are updated, or have a newer timestamp
# than the target. This is typically not desired for us, since we might have
# files unpacked with zip with all kinds of different dates, and for a one-run
# installation, we are mostly interested in wheter an output file already
# exists or not, not so much about timestamps.
#
# To change so that Make only cares about whether files exist, and not timestamps,
# one can add a | character before those input files, like so:
#
# name_of_the_rule : input files where timestamp matters | input files where only existence matters
# one commands
# more commands
#
# Of course, one can have everything on the right side of the | character, so:
#
# name_of_the_rule : | input files where only existence matters
# one commands
# more commands
#
# Running Makefiles
# ------------------------------------------------------------------------------
#
# To run a named rule, you would then do:
#
# $ make name_of_the_rule
#
# For normal rules, you would hit:
#
# $ make <outputfile>
#
# Tip: Type "make" and hit tab twice in the shell, to show available targets to
# run in the current makefile.
#
# Special variables and more
# ------------------------------------------------------------------------------
#
# Inside the commands of the rules, one can write pretty much bash, especially
# if setting `SHELL := /bin/bash` in the beginning of the Makefile which we have
# done below.
#
# There are a some differences though:
#
# 1. Variable syntax using only a single $-character refer to MAKE-variables.
# Thus, to use variables set in bash, you have to use double-$.
# So:
# echo $(this-is-a-make-variable) and $$(this-is-a-bash-variable)
#
# This also goes for command substitution, so rather than:
#
# echo "Lines in file:" $(wc -l somefile.txt)
#
# ... you would write:
#
# echo "Lines in file:" $$(wc -l somefile.txt)
#
# 2. Makefiles also use some special variables with special meaning, to access
# things like the output and input files:
#
# $@ The output target (In case of multiple targets, the same command will
# be run once for every output file, feeding this variable with only a
# single one at a time)
#
# $< The first input file or dependency
#
# $^ ALL input files / dependencies.
#
# 3. Another speciality is that adding a '@' character before any command, will
# stop this command from being printed out when it is executed (only its output
# will be printed).
#
# That's all for now. For the official docs, see:
# https://www.gnu.org/software/make/manual/make.html
#
# Some more caveats
# ------------------------------------------------------------------------------
# Here are some things that might not be obvious at first:
#
# To create a rule with a single output but many dependencies, you can add
# these dependencies on multiple lines by using the continuation character \
# like so:
#
# name_of_rule: dependency1 \
# dependency2 \
# dependency3 \
# dependency4 \
# ==============================================================================
# Various definitions
# ==============================================================================
# Make sure bash is used as shell, for consistency and to make some more
# advanced scripting possible than with /bin/sh
SHELL := /bin/bash
# Define path variables
SCRIPT_DIR := $(shell pwd)
ASSETS_DIR := $(shell realpath $(SCRIPT_DIR)/assets/)
CONTAINER_DIR := $(realpath $(SCRIPT_DIR)/container/)
PRODIGAL_TRAINING_DIR := $(ASSETS_DIR)/prodigal_training_files
# The root folder where the pipeline is currently located. To be mounted into
# the Singularity containers below.
MNT_ROOT := /$(shell readlink -f . | cut -d"/" -f2)
INSTALL_LOG := "$(SCRIPT_DIR)/.install.log"
define log_message
@echo "--------------------------------------------------------------------------------" | tee -a $(INSTALL_LOG);
@echo "$$(date "+%Y-%m-%d %H:%M:%S"): $1" | tee -a $(INSTALL_LOG);
@echo "--------------------------------------------------------------------------------" | tee -a $(INSTALL_LOG);
endef
# ==============================================================================
# Main rules
# ==============================================================================
print_paths:
@echo "SCRIPT_DIR:" $(SCRIPT_DIR)
@echo "ASSETS_DIR:" $(ASSETS_DIR)
@echo "CONTAINER_DIR:" $(CONTAINER_DIR)
@echo "MNT_ROOT:" $(MNT_ROOT)
install: download_or_build_containers \
update_databases \
update_organisms
update_databases: update_amrfinderplus \
update_mlst_db \
update_blast_db \
update_finder_dbs \
update_shigapass_db
update_organisms: staphylococcus_aureus_all \
ecoli_all \
kpneumoniae_all \
mtuberculosis_all \
spyogenes_all \
streptococcus_all
check: check_chewbbaca \
check_bwa \
check_blastdb
# ==============================================================================
# Check and update git submodules
# ==============================================================================
check-and-reinit-git-submodules:
@if git submodule status | egrep -q '^[-]|^[+]' ; then \
echo "Updating / re-initializing git submodules ..." \
&& git submodule update --init; \
fi
# ==============================================================================
# Build containers
# ==============================================================================
download_or_build_containers:
$(call log_message,"Checking if any containers need to be built ...")
@set -euo \
&& cd $(CONTAINER_DIR) \
&& make all; \
cd -
# ==============================================================================
# Update databases
# ==============================================================================
# -----------------------------
# Update ShigaPass database
# -----------------------------
SHIGAPASS_DIR := $(ASSETS_DIR)/ShigaPass
update_shigapass_db: $(SHIGAPASS_DIR)/SCRIPT/ShigaPass_DataBases/IPAH/ipaH_150-mers.fasta.ndb
$(SHIGAPASS_DIR)/SCRIPT/ShigaPass_DataBases/IPAH/ipaH_150-mers.fasta.ndb:
$(call log_message,"Starting update of ShigaPass database")
cd $(SHIGAPASS_DIR) \
&& chmod +x SCRIPT/ShigaPass.sh \
&& gunzip $(SHIGAPASS_DIR)/Example/Input/*.fasta.gz \
&& singularity exec \
--bind $(MNT_ROOT) \
$(CONTAINER_DIR)/shigapass.sif \
bash ShigaPass.sh -u \
-p $(SHIGAPASS_DIR)/SCRIPT/ShigaPass_DataBases \
-l $(SHIGAPASS_DIR)/Example/Input/ShigaPass_test.txt \
-o $(SHIGAPASS_DIR)/Example/ShigaPass_Results |& tee -a $(INSTALL_LOG)
# -----------------------------
# Update AMRFinderPlus database
# -----------------------------
# For more info, see:
# https://www.ncbi.nlm.nih.gov/pathogens/antimicrobial-resistance/AMRFinder/
AMRFINDERDB_DIR := $(ASSETS_DIR)/amrfinder_db
update_amrfinderplus: $(AMRFINDERDB_DIR)/latest
$(AMRFINDERDB_DIR)/latest:
$(call log_message,"Starting update of AMRFinderPlus database ...")
singularity exec \
--bind $(MNT_ROOT) \
$(CONTAINER_DIR)/ncbi-amrfinderplus.sif \
amrfinder_update \
--database $(AMRFINDERDB_DIR) |& tee -a $(INSTALL_LOG)
# -----------------------------
# Update MLST database
# -----------------------------
MLSTDB_DIR := $(ASSETS_DIR)/mlst_db
update_mlst_db: $(MLSTDB_DIR)/pubmlst/dbases.xml
$(ASSETS_DIR)/mlst_db/pubmlst/dbases.xml:
$(call log_message,"Starting update of MLST database ...")
cd $(MLSTDB_DIR) \
&& bash mlst-download_pub_mlst.sh |& tee -a $(INSTALL_LOG)
# -----------------------------
# Update Blast database
# -----------------------------
update_blast_db: $(MLSTDB_DIR)/blast
$(MLSTDB_DIR)/blast:
$(call log_message,"Starting update of Blast database")
cd $(MLSTDB_DIR) \
&& singularity exec \
--bind $(MNT_ROOT) \
$(CONTAINER_DIR)/blast.sif \
bash $(MLSTDB_DIR)/mlst-make_blast_db.sh |& tee -a $(INSTALL_LOG)
# -----------------------------
# Update VirulenceFinder database
# -----------------------------
VIRULENCEFINDERDB_DIR := $(ASSETS_DIR)/virulencefinder_db
KMA_DIR := $(ASSETS_DIR)/kma
update_finder_dbs: $(VIRULENCEFINDERDB_DIR)/stx.name
$(ASSETS_DIR)/virulencefinder_db/stx.name: | check-and-reinit-git-submodules
$(call log_message,"Starting update of VirulenceFinder database")
cd $(ASSETS_DIR)/kma \
&& make \
&& cd $(VIRULENCEFINDERDB_DIR) \
&& export PATH=$(ASSETS_DIR)/kma:$$PATH \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 INSTALL.py \
$(KMA_DIR)/kma_index |& tee -a $(INSTALL_LOG) \
&& cd $(ASSETS_DIR)/resfinder_db \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 INSTALL.py \
$(KMA_DIR)/kma_index |& tee -a $(INSTALL_LOG) \
&& cd $(ASSETS_DIR)/pointfinder_db \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 INSTALL.py \
$(KMA_DIR)/kma_index |& tee -a $(INSTALL_LOG) \
&& cd $(ASSETS_DIR)/serotypefinder_db \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 INSTALL.py \
$(KMA_DIR)/kma_index |& tee -a $(INSTALL_LOG)
# ==============================================================================
# Download, index and prep reference genomes for organisms
# ==============================================================================
# -----------------------------
# S. aureus
# -----------------------------
staphylococcus_aureus_all: staphylococcus_aureus_download_reference \
staphylococcus_aureus_faidx_reference \
staphylococcus_aureus_bwaidx_reference \
staphylococcus_aureus_download_prodigal_training_file \
staphylococcus_aureus_download_cgmlst_schema \
staphylococcus_aureus_unpack_cgmlst_schema \
staphylococcus_aureus_prep_cgmlst_schema
SAUR_GENOMES_DIR := $(ASSETS_DIR)/genomes/staphylococcus_aureus
SAUR_CGMLST_DIR := $(ASSETS_DIR)/cgmlst/staphylococcus_aureus
SAUR_REFSEQ_ACC := GCF_000012045.1
staphylococcus_aureus_download_reference: $(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta
$(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta:
$(call log_message,"Downloading S. aureus reference genome ...")
mkdir -p $(SAUR_GENOMES_DIR) \
&& cd $(SCRIPT_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 bin/download_ncbi.py \
-i $(SAUR_REFSEQ_ACC) \
-o $(SAUR_GENOMES_DIR) |& tee -a $(INSTALL_LOG) \
staphylococcus_aureus_faidx_reference: $(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta.fai
$(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta.fai: $(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta
$(call log_message,"Indexing S. aureus reference genome using samtools...")
cd $(SAUR_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/samtools.sif \
samtools faidx $$(basename $<) |& tee -a $(INSTALL_LOG)
staphylococcus_aureus_bwaidx_reference: $(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta.bwt
$(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta.bwt: $(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta
$(call log_message,"Indexing S. aureus reference genome using bwa...")
cd $(SAUR_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bwakit.sif \
bwa index $$(basename $<) |& tee -a $(INSTALL_LOG)
staphylococcus_aureus_download_prodigal_training_file: $(PRODIGAL_TRAINING_DIR)/Staphylococcus_aureus.trn
$(PRODIGAL_TRAINING_DIR)/Staphylococcus_aureus.trn:
$(call log_message,"Downloading S. aureus prodigal training file ...")
mkdir -p $(PRODIGAL_TRAINING_DIR) \
&& cd $(PRODIGAL_TRAINING_DIR) \
&& wget https://raw.githubusercontent.com/B-UMMI/chewBBACA/master/CHEWBBACA/prodigal_training_files/Staphylococcus_aureus.trn \
-O $@ \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
staphylococcus_aureus_download_cgmlst_schema: $(SAUR_CGMLST_DIR)/alleles/cgmlst_141106.zip
$(SAUR_CGMLST_DIR)/alleles/cgmlst_141106.zip:
$(call log_message,"Downloading S. aureus cgMLST schema ...")
mkdir -p $(SAUR_CGMLST_DIR)/alleles &> /dev/null \
&& cd $(SAUR_CGMLST_DIR)/alleles \
&& wget https://www.cgmlst.org/ncs/schema/141106/alleles/ \
-O $@ \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
staphylococcus_aureus_unpack_cgmlst_schema: $(SAUR_CGMLST_DIR)/alleles/unpacking.done
$(SAUR_CGMLST_DIR)/alleles/unpacking.done: $(SAUR_CGMLST_DIR)/alleles/cgmlst_141106.zip
$(call log_message,"Unpacking S. aureus cgMLST schema ...")
cd $$(dirname $<) \
&& unzip -DDq $$(basename $<) |& tee -a $(INSTALL_LOG) \
&& echo $$(date "+%Y%m%d %H:%M:%S")": Done unpacking zip file: " $< > $@
staphylococcus_aureus_prep_cgmlst_schema: | $(SAUR_CGMLST_DIR)/alleles_rereffed/Staphylococcus_aureus.trn
$(SAUR_CGMLST_DIR)/alleles_rereffed/Staphylococcus_aureus.trn: $(SAUR_CGMLST_DIR)/alleles_rereffed
$(SAUR_CGMLST_DIR)/alleles_rereffed: | $(SAUR_CGMLST_DIR)/alleles/unpacking.done check-and-reinit-git-submodules
$(call log_message,"Prepping S. aureus cgMLST schema ...")
cd $(SAUR_CGMLST_DIR) \
&& echo "WARNING! Prepping cgMLST schema. This takes a looong time. Put on some coffee" \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie PrepExternalSchema \
-g $(SAUR_CGMLST_DIR)/alleles \
-o $(SAUR_CGMLST_DIR)/alleles_rereffed \
--cpu 2 \
--ptf $(PRODIGAL_TRAINING_DIR)/Staphylococcus_aureus.trn |& tee -a $(INSTALL_LOG)
# -----------------------------
# E. coli
# -----------------------------
ecoli_all: ecoli_download_reference \
ecoli_faidx_reference \
ecoli_bwaidx_reference \
ecoli_download_prodigal_training_file \
ecoli_download_wgmlst_schema \
ecoli_prep_ecoli_cgmlst_schema
ECOLI_GENOMES_DIR := $(ASSETS_DIR)/genomes/escherichia_coli
ECOLI_WGMLST_DIR := $(ASSETS_DIR)/wgmlst/escherichia_coli
ECOLI_CGMLST_DIR := $(ASSETS_DIR)/cgmlst/escherichia_coli
ECOLI_REFSEQ_ACC := GCF_000005845.2
ecoli_download_reference: $(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta
$(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta:
$(call log_message,"Downloading E. coli genome ...")
cd $(SCRIPT_DIR) \
&& mkdir -p $(ECOLI_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 bin/download_ncbi.py \
-i $(ECOLI_REFSEQ_ACC) \
-o $(ECOLI_GENOMES_DIR) |& tee -a $(INSTALL_LOG)
ecoli_faidx_reference: $(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta.fai
$(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta.fai: $(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta
$(call log_message,"Indexing E. coli genome using samtools...")
cd $(ECOLI_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/samtools.sif \
samtools faidx $$(basename $<) |& tee -a $(INSTALL_LOG)
ecoli_bwaidx_reference: $(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta.bwt
$(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta.bwt: $(ECOLI_GENOMES_DIR)/$(ECOLI_REFSEQ_ACC).fasta
$(call log_message,"Indexing E. coli genome using bwa...")
cd $(ECOLI_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bwakit.sif \
bwa index $$(basename $<) |& tee -a $(INSTALL_LOG)
ecoli_download_prodigal_training_file: $(PRODIGAL_TRAINING_DIR)/Escherichia_coli.trn
$(PRODIGAL_TRAINING_DIR)/Escherichia_coli.trn:
$(call log_message,"Downloading E. coli prodigal training file ...")
mkdir -p $(PRODIGAL_TRAINING_DIR) \
&& cd $(PRODIGAL_TRAINING_DIR) \
&& wget https://raw.githubusercontent.com/B-UMMI/chewBBACA/master/CHEWBBACA/prodigal_training_files/Escherichia_coli.trn \
-O $@ \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
# Download Ecoli wgmlst INNUENDO schema
ecoli_download_wgmlst_schema: $(ECOLI_WGMLST_DIR)/alleles/ecoli_INNUENDO_wgMLST/Escherichia_coli.trn
$(ECOLI_WGMLST_DIR)/alleles/ecoli_INNUENDO_wgMLST/Escherichia_coli.trn:
$(call log_message,"Downloading E. coli wgMLST schema ...")
mkdir -p $(ECOLI_WGMLST_DIR)/alleles &> /dev/null \
&& cd $(ECOLI_WGMLST_DIR)/alleles \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie DownloadSchema \
-sp 5 \
-sc 1 \
-o $(ECOLI_WGMLST_DIR)/alleles \
--latest |& tee -a $(INSTALL_LOG)
# Download Ecoli cgmlst cgmlst.org schema
ecoli_download_cgmlst_schema: $(ECOLI_CGMLST_DIR)/alleles/ecoli_cgmlst_alleles_5064703.zip
$(ECOLI_CGMLST_DIR)/alleles/ecoli_cgmlst_alleles_5064703.zip:
$(call log_message,"Downloading E. coli cgMLST schema ...")
mkdir -p $(ECOLI_CGMLST_DIR)/alleles &> /dev/null \
&& cd $(ECOLI_CGMLST_DIR)/alleles \
&& wget https://www.cgmlst.org/ncs/schema/5064703/alleles/ \
-O $$(basename $@) \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
# Unpack Ecoli cgmlst schema
ecoli_unpack_cgmlst_schema: $(ECOLI_CGMLST_DIR)/alleles/unpacking.done
$(ECOLI_CGMLST_DIR)/alleles/unpacking.done: $(ECOLI_CGMLST_DIR)/alleles/ecoli_cgmlst_alleles_5064703.zip
$(call log_message,"Unpacking E. coli cgMLST schema ...")
cd $(ECOLI_CGMLST_DIR)/alleles \
&& unzip -DDq $$(basename $<) |& tee -a $(INSTALL_LOG) \
&& echo $$(date +"%Y%m%d %H:%M:%S")": Done unpacking zip file: " $< > $@
# Prepping Ecoli cgmlst cgmlst.org schema
ecoli_prep_ecoli_cgmlst_schema: $(ECOLI_CGMLST_DIR)/alleles_rereffed/Escherichia_coli.trn
$(ECOLI_CGMLST_DIR)/alleles_rereffed/Escherichia_coli.trn: $(ECOLI_CGMLST_DIR)/alleles_rereffed
$(ECOLI_CGMLST_DIR)/alleles_rereffed: | $(ECOLI_CGMLST_DIR)/alleles/unpacking.done check-and-reinit-git-submodules
$(call log_message,"Prepping E. coli cgMLST schema ... WARNING: This takes a looong time. Put on some coffee")
cd $(ECOLI_CGMLST_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie PrepExternalSchema \
-g $(ECOLI_CGMLST_DIR)/alleles \
-o $(ECOLI_CGMLST_DIR)/alleles_rereffed \
--cpu 2 \
--ptf $(PRODIGAL_TRAINING_DIR)/Escherichia_coli.trn |& tee -a $(INSTALL_LOG)
# -----------------------------
# K. pneumoniae
# -----------------------------
kpneumoniae_all: kpneumoniae_download_reference \
kpneumoniae_faidx_reference \
kpneumoniae_bwaidx_reference \
kpneumoniae_download_prodigal_training_file \
kpneumoniae_download_cgmlst_schema \
kpneumoniae_unpack_cgmlst_schema \
kpneumoniae_prep_cgmlst_schema
KPNEU_GENOMES_DIR := $(ASSETS_DIR)/genomes/klebsiella_pneumoniae
KPNEU_CGMLST_DIR := $(ASSETS_DIR)/cgmlst/klebsiella_pneumoniae
KPNEU_REFSEQ_ACC := GCF_000240185.1
kpneumoniae_download_reference: $(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta
$(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta:
$(call log_message,"Downloading K. pneumoniae genome ...")
cd $(SCRIPT_DIR) \
&& mkdir -p $(KPNEU_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 bin/download_ncbi.py \
-i $(KPNEU_REFSEQ_ACC) \
-o $(KPNEU_GENOMES_DIR) |& tee -a $(INSTALL_LOG)
kpneumoniae_faidx_reference: $(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta.fai
$(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta.fai: $(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta
$(call log_message,"Indexing K. pneumoniae genome using samtools...")
cd $(KPNEU_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/samtools.sif \
samtools faidx $$(basename $<) |& tee -a $(INSTALL_LOG)
kpneumoniae_bwaidx_reference: $(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta.bwt
$(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta.bwt: $(KPNEU_GENOMES_DIR)/$(KPNEU_REFSEQ_ACC).fasta
$(call log_message,"Indexing K. pneumoniae genome using bwa...")
cd $(KPNEU_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bwakit.sif \
bwa index $$(basename $<) |& tee -a $(INSTALL_LOG)
kpneumoniae_download_prodigal_training_file: $(PRODIGAL_TRAINING_DIR)/Klebsiella_pneumoniae.trn
$(PRODIGAL_TRAINING_DIR)/Klebsiella_pneumoniae.trn:
$(call log_message,"Downloading K. pneumonia prodigal training file ...")
mkdir -p $(PRODIGAL_TRAINING_DIR) \
&& cd $(PRODIGAL_TRAINING_DIR) \
&& wget https://raw.githubusercontent.com/B-UMMI/chewBBACA/master/CHEWBBACA/prodigal_training_files/Klebsiella_pneumoniae.trn \
-O $@ \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
# Download Kpneumoniae cgmlst cgmlst.org schema
kpneumoniae_download_cgmlst_schema: $(KPNEU_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip
$(KPNEU_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip:
$(call log_message,"Downloading K. pneumoniae cgMLST schema ...")
mkdir -p $(KPNEU_CGMLST_DIR)/alleles \
&& cd $(KPNEU_CGMLST_DIR)/alleles \
&& wget https://www.cgmlst.org/ncs/schema/2187931/alleles/ \
-O $$(basename $@) \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
kpneumoniae_unpack_cgmlst_schema: $(KPNEU_CGMLST_DIR)/alleles/unpacking.done
$(KPNEU_CGMLST_DIR)/alleles/unpacking.done: $(KPNEU_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip
$(call log_message,"Unpacking K. pneumoniae cgMLST schema ...")
cd $(KPNEU_CGMLST_DIR)/alleles \
&& unzip -DDq $$(basename $<) |& tee -a $(INSTALL_LOG) \
&& echo $$(date "+%Y%m%d %H:%M:%S")": Done unpacking zip file: " $< > $@
# Prep Kpneumoniae cgmlst cgmlst.org schema
kpneumoniae_prep_cgmlst_schema: | $(KPNEU_CGMLST_DIR)/alleles_rereffed/Klebsiella_pneumoniae.trn
$(KPNEU_CGMLST_DIR)/alleles_rereffed/Klebsiella_pneumoniae.trn: $(KPNEU_CGMLST_DIR)/alleles_rereffed
$(KPNEU_CGMLST_DIR)/alleles_rereffed: | $(KPNEU_CGMLST_DIR)/alleles/unpacking.done check-and-reinit-git-submodules
$(call log_message,"Prepping K. pneumoniae cgMLST schema ... Warning: This takes a looong time. Put on some coffee!")
cd $(KPNEU_CGMLST_DIR) \
&& echo "WARNING! Prepping cgMLST schema. This takes a looong time. Put on some coffee" \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie PrepExternalSchema \
-g $(KPNEU_CGMLST_DIR)/alleles \
-o $(KPNEU_CGMLST_DIR)/alleles_rereffed \
--cpu 2 \
--ptf $(PRODIGAL_TRAINING_DIR)/Klebsiella_pneumoniae.trn |& tee -a $(INSTALL_LOG)
# -----------------------------
# Streptococcus pyogenes
# -----------------------------
spyogenes_all: spyogenes_download_reference \
spyogenes_faidx_reference \
spyogenes_bwaidx_reference \
spyogenes_download_prodigal_training_file \
spyogenes_download_cgmlst_schema \
spyogenes_unpack_cgmlst_schema \
spyogenes_prep_cgmlst_schema
SPYO_GENOMES_DIR := $(ASSETS_DIR)/genomes/streptococcus_pyogenes
SPYO_CGMLST_DIR := $(ASSETS_DIR)/cgmlst/streptococcus_pyogenes
SPYO_REFSEQ_ACC := GCF_000006785.2
spyogenes_download_reference: $(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta
$(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta:
$(call log_message,"Downloading S. pyogenes genome ...")
cd $(SCRIPT_DIR) \
&& mkdir -p $(SPYO_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 bin/download_ncbi.py \
-i $(SPYO_REFSEQ_ACC) \
-o $(SPYO_GENOMES_DIR) |& tee -a $(INSTALL_LOG)
spyogenes_faidx_reference: $(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta.fai
$(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta.fai: $(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta
$(call log_message,"Indexing S. pyogenes genome using samtools...")
cd $(SPYO_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/samtools.sif \
samtools faidx $$(basename $<) |& tee -a $(INSTALL_LOG)
spyogenes_bwaidx_reference: $(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta.bwt
$(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta.bwt: $(SPYO_GENOMES_DIR)/$(SPYO_REFSEQ_ACC).fasta
$(call log_message,"Indexing S. pyogenes genome using bwa...")
cd $(SPYO_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bwakit.sif \
bwa index $$(basename $<) |& tee -a $(INSTALL_LOG)
spyogenes_download_prodigal_training_file: $(PRODIGAL_TRAINING_DIR)/Streptococcus_pyogenes.trn
$(PRODIGAL_TRAINING_DIR)/Streptococcus_pyogenes.trn:
$(call log_message,"Downloading K. pneumonia prodigal training file ...")
mkdir -p $(PRODIGAL_TRAINING_DIR) \
&& cd $(PRODIGAL_TRAINING_DIR) \
&& wget https://raw.githubusercontent.com/B-UMMI/chewBBACA/master/CHEWBBACA/prodigal_training_files/Streptococcus_pyogenes.trn \
-O $@ \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
# Download Streptococcus pyogenes cgmlst cgmlst.org schema
spyogenes_download_cgmlst_schema: $(SPYO_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip
$(SPYO_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip:
$(call log_message,"Downloading S. pyogenes cgMLST schema ...")
mkdir -p $(SPYO_CGMLST_DIR)/alleles \
&& cd $(SPYO_CGMLST_DIR)/alleles \
&& wget https://www.cgmlst.org/ncs/schema/2187931/alleles/ \
-O $$(basename $@) \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
spyogenes_unpack_cgmlst_schema: $(SPYO_CGMLST_DIR)/alleles/unpacking.done
$(SPYO_CGMLST_DIR)/alleles/unpacking.done: $(SPYO_CGMLST_DIR)/alleles/cgmlst_schema_2187931.zip
$(call log_message,"Unpacking S. pyogenes cgMLST schema ...")
cd $(SPYO_CGMLST_DIR)/alleles \
&& unzip -DDq $$(basename $<) |& tee -a $(INSTALL_LOG) \
&& echo $$(date "+%Y%m%d %H:%M:%S")": Done unpacking zip file: " $< > $@
# Prep Streptococcus cgmlst cgmlst.org schema
spyogenes_prep_cgmlst_schema: | $(SPYO_CGMLST_DIR)/alleles_rereffed/Streptococcus_pyogenes.trn
$(SPYO_CGMLST_DIR)/alleles_rereffed/Streptococcus_pyogenes.trn: $(SPYO_CGMLST_DIR)/alleles_rereffed
$(SPYO_CGMLST_DIR)/alleles_rereffed: | $(SPYO_CGMLST_DIR)/alleles/unpacking.done check-and-reinit-git-submodules
$(call log_message,"Prepping S. pyogenes cgMLST schema ... Warning: This takes a looong time. Put on some coffee!")
cd $(SPYO_CGMLST_DIR) \
&& echo "WARNING! Prepping cgMLST schema. This takes a looong time. Put on some coffee" \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie PrepExternalSchema \
-g $(SPYO_CGMLST_DIR)/alleles \
-o $(SPYO_CGMLST_DIR)/alleles_rereffed \
--cpu 2 \
--ptf $(PRODIGAL_TRAINING_DIR)/Streptococcus_pyogenes.trn |& tee -a $(INSTALL_LOG)
# -----------------------------
# Streptococcus
# -----------------------------
streptococcus_all: streptococcus_download_cgmlst_schema \
streptococcus_unpack_cgmlst_schema \
streptococcus_prep_cgmlst_schema
STREP_CGMLST_DIR := $(ASSETS_DIR)/cgmlst/streptococcus
# Download Streptococcus cgmlst cgmlst.org schema
streptococcus_download_cgmlst_schema: $(STREP_CGMLST_DIR)/alleles/index.html
$(STREP_CGMLST_DIR)/alleles/index.html:
$(call log_message,"Downloading Streptococcus cgMLST schema ...")
mkdir -p $(STREP_CGMLST_DIR)/alleles \
&& cd $(STREP_CGMLST_DIR)/alleles \
&& wget -r https://enterobase.warwick.ac.uk/schemes/Streptococcus.cgMLSTv1/ \
-np \
-nH \
--cut-dirs 2 \
--no-verbose \
--no-check-certificate |& tee -a $(INSTALL_LOG)
streptococcus_unpack_cgmlst_schema: $(STREP_CGMLST_DIR)/alleles/unpacking.done
$(STREP_CGMLST_DIR)/alleles/unpacking.done: $(STREP_CGMLST_DIR)/alleles/profiles.list
$(call log_message,"Unpacking S. pyogenes cgMLST schema ...")
cd $(STREP_CGMLST_DIR)/alleles \
&& gunzip *.gz |& tee -a $(INSTALL_LOG) \
&& echo $$(date "+%Y%m%d %H:%M:%S")": Done unpacking gz files: " $< > $@
# Prep Streptococcus cgmlst cgmlst.org schema
streptococcus_prep_cgmlst_schema: $(STREP_CGMLST_DIR)/alleles_rereffed_summary_stats.tsv
$(STREP_CGMLST_DIR)/alleles_rereffed_summary_stats.tsv: $(STREP_CGMLST_DIR)/alleles_rereffed
$(STREP_CGMLST_DIR)/alleles_rereffed: | $(STREP_CGMLST_DIR)/alleles/index.html
$(call log_message,"Prepping Streptococcus cgMLST schema ... Warning: This takes a looong time. Put on some coffee!")
cd $(STREP_CGMLST_DIR) \
&& echo "WARNING! Prepping cgMLST schema. This takes a looong time. Put on some coffee" \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/chewbbaca.sif \
chewie PrepExternalSchema \
-g $(STREP_CGMLST_DIR)/alleles \
-o $(STREP_CGMLST_DIR)/alleles_rereffed \
--cpu 2 |& tee -a $(INSTALL_LOG)
# -----------------------------
# M. tuberculosis
# -----------------------------
MTUBE_GENOMES_DIR := $(ASSETS_DIR)/genomes/mycobacterium_tuberculosis
MTUBE_TBDB_DIR := $(ASSETS_DIR)/tbdb
MTUBE_TB_INFO_DIR := $(ASSETS_DIR)/tb_info
MTUBE_REFSEQ_ACC := GCF_000195955.2
mtuberculosis_all: mtuberculosis_download_reference mtuberculosis_faidx_reference mtuberculosis_bwaidx_reference mtuberculosis_converged_who_fohm_tbdb mtuberculosis_bgzip_bed mtuberculosis_index_bed
mtuberculosis_download_reference: $(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta
$(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta:
$(call log_message,"Downloading M. tuberculosis genome ...")
mkdir -p $(MTUBE_GENOMES_DIR) \
&& cd $(SCRIPT_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bonsai-prp.sif \
python3 bin/download_ncbi.py \
-i $(MTUBE_REFSEQ_ACC) \
-o $(MTUBE_GENOMES_DIR) |& tee -a $(INSTALL_LOG)
mtuberculosis_faidx_reference: $(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta.fai
$(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta.fai: $(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta
$(call log_message,"Indexing M. tuberculosis genome using samtools...")
cd $(MTUBE_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/samtools.sif \
samtools faidx $$(basename $<) |& tee -a $(INSTALL_LOG)
mtuberculosis_bwaidx_reference: $(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta.bwt
$(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta.bwt: $(MTUBE_GENOMES_DIR)/$(MTUBE_REFSEQ_ACC).fasta
$(call log_message,"Indexing M. tuberculosis genome using bwa...")
cd $(MTUBE_GENOMES_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/bwakit.sif \
bwa index $$(basename $<) |& tee -a $(INSTALL_LOG)
mtuberculosis_converged_who_fohm_tbdb: $(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.variables.json
$(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.variables.json: $(MTUBE_TB_INFO_DIR)/csv/converged_who_fohm_tbdb.csv
$(call log_message,"Creating WHO FoHM TBDB ...")
cd $(MTUBE_TBDB_DIR) \
&& cp $(MTUBE_TB_INFO_DIR)/csv/converged_who_fohm_tbdb.csv $(MTUBE_TBDB_DIR) \
&& singularity exec --bind $(MNT_ROOT) $(CONTAINER_DIR)/tb-profiler.sif \
tb-profiler create_db --prefix converged_who_fohm_tbdb --dir $(MTUBE_TBDB_DIR) \
--match_ref $(MTUBE_GENOMES_DIR)/GCF_000195955.2.fasta --csv converged_who_fohm_tbdb.csv \
&& tb-profiler load_library converged_who_fohm_tbdb --dir $(MTUBE_TBDB_DIR) |& tee -a $(INSTALL_LOG)
mtuberculosis_bgzip_bed: $(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed.gz
$(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed.gz: $(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed
$(call log_message,"Bgzipping converged WHO + FoHM + TBDB bed file ...")
cd $(MTUBE_TBDB_DIR) \
&& bgzip $$(basename $<) |& tee -a $(INSTALL_LOG)
mtuberculosis_index_bed: $(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed.gz.tbi
$(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed.gz.tbi: $(MTUBE_TBDB_DIR)/converged_who_fohm_tbdb.bed.gz
$(call log_message,"Indexing converged WHO + FoHM + TBDB bgzipped bed file ...")
cd $(MTUBE_TBDB_DIR) \
&& tabix -p bed $$(basename $<) |& tee -a $(INSTALL_LOG)
# ==============================================================================
# Perform checks
# ==============================================================================
# TODO: Integrate with main installation rules?
# -----------------------------
# Check chewBBACA
# -----------------------------
check_chewbbaca:
@cd $(SCRIPT_DIR) \
&& saureus=$(SAUR_CGMLST_DIR)/alleles_rereffed \
&& ecoli=$(ECOLI_CGMLST_DIR)/alleles_rereffed \
&& kpneumoniae=$(KPNEU_CGMLST_DIR)/alleles_rereffed \
&& spyogenes=$(SPYO_CGMLST_DIR)/alleles_rereffed \
&& streptococcus=$(STREP_CGMLST_DIR)/alleles_rereffed \
&& if [[ -d "$$saureus" && -d "$$ecoli" && -d "$$kpneumoniae" && -d "$$spyogenes" && -d "$$streptococcus" ]]; then \
echo "[✓] PASSED check for chewBBACA: Directories exist:" |& tee -a $(INSTALL_LOG) \
&& echo "- $$saureus" |& tee -a $(INSTALL_LOG) \
&& echo "- $$ecoli" |& tee -a $(INSTALL_LOG) \
&& echo "- $$kpneumoniae" |& tee -a $(INSTALL_LOG) \
&& echo "- $$spyogenes" |& tee -a $(INSTALL_LOG) \
&& echo "- $$streptococcus" |& tee -a $(INSTALL_LOG); \
else \
echo "[!] FAILED check for chewBBACA: Some directories do not exist:"; \
if [[ ! -d $$saureus ]]; then \
echo " Missing directory: $$saureus" |& tee -a $(INSTALL_LOG); \
fi; \
if [[ ! -d $$ecoli ]]; then \
echo " Missing directory: $$ecoli" |& tee -a $(INSTALL_LOG); \
fi; \
if [[ ! -d $$kpneumoniae ]]; then \
echo " Missing directory: $$kpneumoniae" |& tee -a $(INSTALL_LOG); \
fi; \
if [[ ! -d $$spyogenes ]]; then \
echo " Missing directory: $$spyogenes" |& tee -a $(INSTALL_LOG); \
fi; \
if [[ ! -d $$streptococcus ]]; then \
echo " Missing directory: $$streptococcus" |& tee -a $(INSTALL_LOG); \
fi; \
echo " Please report this in an issue on the JASEN repo: https://github.com/genomic-medicine-sweden/JASEN/issues" |& tee -a $(INSTALL_LOG); \
fi
# -----------------------------
# Check BWA
# -----------------------------
check_bwa:
@cd $(SCRIPT_DIR) \
&& ref=$(SAUR_GENOMES_DIR)/$(SAUR_REFSEQ_ACC).fasta; \
refamb=$${ref}.amb; \
refann=$${ref}.ann; \
refbwt=$${ref}.bwt; \
refpac=$${ref}.pac; \
refsa=$${ref}.sa \
&& if [[ -f $$ref \
&& -f $${refamb} \
&& -f $${refann} \
&& -f $${refbwt} \
&& -f $${refpac} \
&& -f $${refsa} \
]]; then \
echo "[✓] PASSED check for bwa: Indexes exist in $(SAUR_GENOMES_DIR)" |& tee -a $(INSTALL_LOG); \
else \
echo "[!] FAILED check for bwa: Indexes do not exist in $(SAUR_GENOMES_DIR)" |& tee -a $(INSTALL_LOG); \
fi
# -----------------------------
# Check BlastDB
# -----------------------------
MLST_BLAST_DIR := $(ASSETS_DIR)/mlst_db/blast
check_blastdb:
@cd $(SCRIPT_DIR) \
&& mlst=$(MLST_BLAST_DIR)/mlst.fa; \
mlstndb=$${mlst}.ndb; \
mlstnhd=$${mlst}.nhd; \
mlstnhi=$${mlst}.nhi; \
mlstnhr=$${mlst}.nhr; \
mlstnin=$${mlst}.nin; \
mlstnog=$${mlst}.nog; \
mlstnos=$${mlst}.nos; \
mlstnot=$${mlst}.not; \
mlstnsq=$${mlst}.nsq; \
mlstntf=$${mlst}.ntf; \
mlstnto=$${mlst}.nto \
&& if [[ -f $${mlst} \
&& -f $${mlstndb} \
&& -f $${mlstnhd} \
&& -f $${mlstnhi} \
&& -f $${mlstnhr} \
&& -f $${mlstnin} \
&& -f $${mlstnog} \
&& -f $${mlstnos} \
&& -f $${mlstnot} \
&& -f $${mlstnsq} \
&& -f $${mlstntf} \
&& -f $${mlstnto} \
]]; then \
echo "[✓] PASSED check for blast: Indexes exist in $(MLST_BLAST_DIR)" |& tee -a $(INSTALL_LOG); \
else \
echo "[!] FAILED check for blast: Indexes do not exist in $(MLST_BLAST_DIR)" |& tee -a $(INSTALL_LOG); \
fi