-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathstrandeval.mk
executable file
·80 lines (66 loc) · 2.23 KB
/
strandeval.mk
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
#!/usr/bin/make -rRsf
SHELL=/bin/bash -o pipefail
#USAGE:
#
# $HOME/Oyster_River/Protocol/strandeval.mk main \
# ASSEMBLY=test.fasta \
# READ1=1.subsamp_1.cor.fq \
# READ2=1.subsamp_2.cor.fq \
# RUNOUT=test
#
MAKEDIR := $(dir $(firstword $(MAKEFILE_LIST)))
DIR := ${CURDIR}
CPU=24
READ1=
READ2=
RUNOUT =
ASSEMBLY=
bwapath := $(shell which bwa 2>/dev/null)
seqtkpath := $(shell which seqtk 2>/dev/null)
VERSION := ${shell cat ${MAKEDIR}version.txt}
help:
main: setup check welcome strandeval
clean:
setup:${DIR}/setup.done
strandeval:{DIR}/reports/${RUNOUT}.strandeval.done
.DELETE_ON_ERROR:
.PHONY:report check clean help
${DIR}/setup.done:
@mkdir -p ${DIR}/reports
touch ${DIR}/setup.done
check:
ifdef bwapath
else
$(error "\n\n*** BWA is not installed, must fix ***")
endif
ifdef seqtkpath
else
$(error "\n\n*** SEQTK is not installed, must fix ***")
endif
help:
printf "\n\n***** Welcome to the Oyster River Stand Evaluation Tool ***** \n"
printf "***** This is version ${VERSION} *****\n\n"
printf "Usage:\n\n"
printf "/path/to/Oyster_River/Protocol/strandeval.mk main CPU=24\n"
printf "ASSEMBLY=test.fasta\n"
printf "READ1=1.subsamp_1.cor.fq\n"
printf "READ2=1.subsamp_2.cor.fq\n"
printf "RUNOUT=test\n\n"
welcome:
printf "\n\n***** Welcome to the Oyster River Stand Evaluation Tool ***** \n"
printf "***** This is version ${VERSION} *****\n"
printf "***** This is adapted from https://github.com/trinityrnaseq/trinityrnaseq/wiki/Examine-Strand-Specificity ***** \n\n"
printf " \n\n"
{DIR}/reports/${RUNOUT}.strandeval.done:
bwa index -p ${RUNOUT} ${ASSEMBLY}
bwa mem -t $(CPU) ${RUNOUT} \
<(seqtk sample -s 23894 ${READ1} 200000) \
<(seqtk sample -s 23894 ${READ2} 200000) \
| samtools view -@10 -Sb - \
| samtools sort -T ${RUNOUT} -O bam -@10 -o "${RUNOUT}".sorted.bam -
perl -I $$(dirname $$(readlink -f $$(which Trinity)))/PerlLib ${MAKEDIR}/scripts/examine_strand.pl "${RUNOUT}".sorted.bam ${RUNOUT}
hist -p '#' -c red <(cat ${RUNOUT}.dat | awk '{print $$5}' | sed 1d)
rm -f "${RUNOUT}".sorted.bam
touch ${DIR}/reports/${RUNOUT}.strandeval.done
printf "\n\n***** See the following link for interpretation ***** \n"
printf "***** https://oyster-river-protocol.readthedocs.io/en/latest/strandexamine.html ***** \n\n"