Last active
August 31, 2016 09:15
-
-
Save claczny/fc11b0b32bfe8ff2071ecdcd00b9163a to your computer and use it in GitHub Desktop.
A Makefile to run the taxonomic classification tool for sequences, Kraken, to filter and to create reports of the results.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL := /bin/bash | |
##### | |
# PRESETS | |
##### | |
FASTA?=YOUR-FASTA-FILE.fa | |
KRAKEN_PATH?=KRAKEN-BINARY-TOP-FOLDER | |
KRAKEN_CORES?=10 | |
KRAKEN_FILTER_THRESHOLD?=0.2 | |
KRAKEN_BIN=$(KRAKEN_PATH)/kraken | |
KRAKEN_FILTER_BIN=$(KRAKEN_PATH)/kraken-filter | |
KRAKEN_REPORT_BIN=$(KRAKEN_PATH)/kraken-report | |
KRAKEN_DB?=PATH-TO-KRAKEN-DB | |
##### | |
# BEAUTY TARGETS | |
##### | |
.PHONY: all kraken kraken_filter kraken_report kraken_filter_report | |
all: kraken kraken_filter kraken_report kraken_filter_report | |
kraken: $(FASTA:.fa=.kraken) | |
kraken_filter: $(FASTA:.fa=.kraken_filter) | |
kraken_report: $(FASTA:.fa=.kraken_report) | |
kraken_filter_report: $(FASTA:.fa=.kraken_filter_report) | |
##### | |
# ACTUAL TARGETS | |
##### | |
# Run kraken | |
%.kraken: %.fa | |
@echo "Running Kraken ..." | |
@date | |
$(KRAKEN_BIN) --db $(KRAKEN_DB) --threads $(KRAKEN_CORES) $^ > $@ | |
@echo "done (kraken)." | |
@date | |
# Run filter | |
%.kraken_filter: %.kraken | |
@echo "Running Kraken-Filter $(KRAKEN_THRESHOLD) ..." | |
@date | |
$(KRAKEN_FILTER_BIN) --db $(KRAKEN_DB) --threshold $(KRAKEN_FILTER_THRESHOLD) $^ > $@ | |
@echo "done (kraken-filter)." | |
@date | |
# Create a report | |
%_report: % | |
@echo "Running Kraken-Report ..." | |
@date | |
$(KRAKEN_REPORT_BIN) --db $(KRAKEN_DB) $^ > $@ | |
@echo "done (kraken-report)." | |
@date | |
##### | |
# CLEAN-UP | |
##### | |
clean: | |
rm -f *.kraken* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL := /bin/bash | |
##### | |
# PRESETS | |
##### | |
FASTA?=YOUR-FASTA-FILE.fa | |
KRAKEN_PATH?=KRAKEN-BINARY-TOP-FOLDER | |
KRAKEN_CORES?=10 | |
KRAKEN_FILTER_THRESHOLD?=0.2 | |
KRAKEN_BIN=$(KRAKEN_PATH)/kraken | |
KRAKEN_FILTER_BIN=$(KRAKEN_PATH)/kraken-filter | |
KRAKEN_REPORT_BIN=$(KRAKEN_PATH)/kraken-report | |
KRAKEN_DB?=PATH-TO-KRAKEN-DB | |
DB=$(notdir $(KRAKEN_DB)) | |
##### | |
# BEAUTY TARGETS | |
##### | |
.PHONY: all kraken kraken_filter kraken_report kraken_filter_report | |
all: kraken kraken_filter kraken_report kraken_filter_report | |
kraken: $(FASTA:.fa=_x_$(DB).kraken) | |
kraken_filter: $(FASTA:.fa=_x_$(DB).kraken_filter) | |
kraken_report: $(FASTA:.fa=_x_$(DB).kraken_report) | |
kraken_filter_report: $(FASTA:.fa=_x_$(DB).kraken_filter_report) | |
##### | |
# ACTUAL TARGETS | |
##### | |
# Run kraken | |
%_x_$(DB).kraken: %.fa | |
@echo "Running Kraken against microbes DB ..." | |
@date | |
$(KRAKEN_BIN) --db $(KRAKEN_DB) --threads $(KRAKEN_CORES) $^ > $@ | |
@echo "done (kraken against microbes db)." | |
@date | |
# Run filter | |
%.kraken_filter: %.kraken | |
@echo "Running Kraken-Filter $(KRAKEN_THRESHOLD) ..." | |
@date | |
$(KRAKEN_FILTER_BIN) --db $(KRAKEN_DB) --threshold $(KRAKEN_FILTER_THRESHOLD) $^ > $@ | |
@echo "done (kraken-filter)." | |
@date | |
# Create report | |
%_report: % | |
@echo "Running Kraken-Report ..." | |
@date | |
$(KRAKEN_REPORT_BIN) --db $(KRAKEN_DB) $^ > $@ | |
@echo "done (kraken-report)." | |
@date | |
##### | |
# CLEAN-UP | |
##### | |
clean: | |
rm -f *.kraken* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
N.B. Make sure that the indentation of the recipes commands are all tab-indented.
To enable running the Makefile on your installation, you need to adjust/set the variables:
FASTA
: The path to your fasta-file of interest (needs to end in.fa
, here)KRAKEN_PATH
: The path your local Kraken-installation, i.e., the top directory including executableskraken
,kraken-filter
, andkraken-report
.KRAKEN_DB
: The path to your Kraken database.You can either adjust these variable within the Makefile, or your could do it within the
make
call, e.g.,make -f Kraken.mk FASTA=PATH-TO-YOUR-FASTA-FILE KRAKEN_PATH=YOUR-KRAKEN-PATH KRAKEN_DB=YOUR-KRAKEN-DB-PATH
.Kraken_incl_db_name_appended.mk
serves the same purpose asKraken.mk
but additionally includes the name of the database in the output. This is particularly helpful if the same set of sequences should be searched against different databases, e.g., databases that were constructed using different k-mer sizes.