all: build

.PHONY: ct com push fetch gt fmt fix

TOOLS=../tools

# Utility targets:
ct:
	git log --graph
fmt: *.go
	go fmt *.go
com: fmt
	git commit -a
push:
	git push --all
fetch:
	git fetch --all
fix:
	go fix .

# Target:
BINARY=spliced_bam2gff

# These are the values we want to pass for VERSION and BUILD
VERSION=0.1.0
BUILD=`git rev-parse HEAD`

# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"

# Builds the project
build: *.go
	go build ${LDFLAGS} -o ${BINARY}

# Installs our project: copies binaries
install:
	go install ${LDFLAGS}

# Cleans our project: deletes binaries
clean:
	if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi

# Test tool on simulated data (with no sequencing errors) agains the GFF output generated by GMAP:
test:
	 ./spliced_bam2gff -g ./test_data/sirv_no_errors_gmap.bam > ./test_data/test_out.gff
	 (cd test_data; gffcompare -V -r sirv_no_errors_gmap.gff test_out.gff)
	 cat ./test_data/gffcmp.stats

# Test tool on simulated data (with sequencing errors) agains the GFF output generated by GMAP:
test_err:
	 ./spliced_bam2gff  -g ./test_data/sirv_errors_gmap.bam > ./test_data/test_out_err.gff
	 (cd test_data; gffcompare -V -r sirv_errors_gmap.gff test_out_err.gff)
	 cat ./test_data/gffcmp.stats

# Run tool on larger simulated data (with sequencing errors):
test_sim:
	./spliced_bam2gff -M -s ./test_data/sirv_simulated.bam > ./test_data/sirv_simulated_mm2.gff

# Run tool on SIRV E0 mix full length cDNA dataset aligned using minimap2:
test_sirv:
	./spliced_bam2gff -M -s ../polish_clusters/test_data/sirv_e0_sorted.bam > /dev/null
