annotate scripts/TEMP_Absence.sh @ 21:9672fe07a232 draft default tip

planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
author mvdbeek
date Mon, 05 Dec 2016 09:58:47 -0500
parents ca36262102d8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
1 #!/bin/bash -x
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
2 # TEMP (Transposable Element Movement present in a Population)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
3 # 2013-06-14
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
4 # Jiali Zhuang(jiali.zhuang@umassmed.edu)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
5 # Zhiping Weng Lab
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
6 # Programs in Bioinformatics and Integrative Biology
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
7 # University of Massachusetts Medical School
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
8
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
9 #usage function
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
10 usage() {
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
11 echo -en "\e[1;36m"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
12 cat <<EOF
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
13
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
14 usage: $0 -i input_file.sorted.bam -s scripts_directory -o output_directory -r transposon_rpmk.bed -t reference.2bit -f fragment_size -c CPUs -h
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
15
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
16 TEMP is a software package for detecting transposable elements (TEs)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
17 insertions and excisions from pooled high-throughput sequencing data.
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
18 Please send questions, suggestions and bug reports to:
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
19 jiali.zhuang@umassmed.edu
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
20
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
21 Options:
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
22 -i Input file in bam format with full path. Please sort and index the file before calling this program.
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
23 Sorting and indexing can be done by 'samtools sort' and 'samtools index'
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
24 -s Directory where all the scripts are
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
25 -o Path to output directory. Default is current directory
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
26 -r Annotated transposon positions in the genome (e.g., repeakMask) in bed6 format with full path
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
27 -t 2bit file for the reference genome (can be downloaded from UCSC Genome Browser)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
28 -f An integer specifying the length of the fragments (inserts) of the library. Default is 500
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
29 -x The minimum score difference between the best hit and the second best hit for considering a read as uniquely mapped. For BWA MEM.
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
30 -c An integer specifying the number of CPUs used. Default is 4
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
31 -h Show help message
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
32
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
33 EOF
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
34 echo -en "\e[0m"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
35 }
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
36
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
37 # taking options
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
38 while getopts "hi:c:f:o:r:s:t:x:" OPTION
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
39 do
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
40 case $OPTION in
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
41 h)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
42 usage && exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
43 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
44 i)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
45 BAM=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
46 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
47 f)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
48 INSERT=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
49 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
50 o)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
51 OUTDIR=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
52 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
53 c)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
54 CPU=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
55 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
56 s)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
57 BINDIR=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
58 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
59 r)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
60 TEBED=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
61 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
62 t)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
63 REF=$OPTARG
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
64 ;;
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
65 x)
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
66 SCORE=$OPTARG
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
67 ;;
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
68 ?)
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
69 usage && exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
70 ;;
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
71 esac
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
72 done
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
73
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
74 if [[ -z $BAM ]] || [[ -z $BINDIR ]] || [[ -z $TEBED ]] || [[ -z $REF ]]
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
75 then
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
76 usage && exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
77 fi
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
78 [ ! -z "${CPU##*[!0-9]*}" ] || CPU=4
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
79 [ ! -z "${INSERT##*[!0-9]*}" ] || INSERT=500
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
80 [ ! -z "${SCORE##*[!0-9]*}" ] || SCORE=0
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
81 [ ! -z $OUTDIR ] || OUTDIR=$PWD
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
82
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
83 mkdir -p "${OUTDIR}" || echo -e "\e[1;31mWarning: Cannot create directory ${OUTDIR}. Using the direcory of input fastq file\e[0m"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
84 cd ${OUTDIR} || echo -e "\e[1;31mError: Cannot access directory ${OUTDIR}... Exiting...\e[0m" || exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
85 touch ${OUTDIR}/.writting_permission && rm -rf ${OUTDIR}/.writting_permission || echo -e "\e[1;31mError: Cannot write in directory ${OUTDIR}... Exiting...\e[0m" || exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
86
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
87 function checkExist {
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
88 echo -ne "\e[1;32m\"${1}\" is using: \e[0m" && which "$1"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
89 [[ $? != 0 ]] && echo -e "\e[1;36mError: cannot find software/function ${1}! Please make sure that you have installed the pipeline correctly.\nExiting...\e[0m" && exit 1
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
90 }
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
91 echo -e "\e[1;35mTesting required softwares/scripts:\e[0m"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
92 checkExist "echo"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
93 checkExist "rm"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
94 checkExist "mkdir"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
95 checkExist "date"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
96 checkExist "mv"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
97 checkExist "sort"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
98 checkExist "touch"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
99 checkExist "awk"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
100 checkExist "grep"
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
101 checkExist "twoBitToFa"
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
102 checkExist "bwa"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
103 checkExist "samtools"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
104 echo -e "\e[1;35mDone with testing required softwares/scripts, starting pipeline...\e[0m"
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
105
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
106 name=`basename $BAM`
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
107 i=${name/.sorted.bam/}
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
108 echo $name
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
109 echo $i
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
110 if [[ ! -s $name ]]
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
111 then
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
112 cp $BAM ./
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
113 fi
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
114 if [[ ! -s $name.bai ]]
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
115 then cp $BAM.bai ./
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
116 fi
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
117
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
118 #Detect excision sites
21
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents: 12
diff changeset
119 samtools view -F 0x2 $name > $i.unpair.sam
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
120 awk -F "\t" '{OFS="\t"; if ($9 != 0) print $0}' $i.unpair.sam > temp1.sam
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
121 perl $BINDIR/pickUniqIntervalPos.pl temp1.sam $INSERT > $i.unproper.uniq.interval.bed
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
122
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
123 rm temp1.sam $i.unpair.sam
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
124
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
125 # Sometimes $i.unproper.uniq.interval.bed contains malformed bed entries
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
126 # These must be removed to prevent the script failing
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
127 awk '{if ($3>=$2 && $3 > 0 && $2 > 0) print $0}' $i.unproper.uniq.interval.bed > $i.unproper.uniq.interval.fixed.bed
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
128 mv $i.unproper.uniq.interval.fixed.bed $i.unproper.uniq.interval.bed
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
129
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
130 # Map to transposons
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
131 bedtools intersect -a $TEBED -b $i.unproper.uniq.interval.bed -f 1.0 -wo > temp
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
132 perl $BINDIR/filterFalsePositive.ex.pl temp $INSERT $i.final.pairs.rpmk.bed
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
133 bedtools intersect -a $TEBED -b $i.final.pairs.rpmk.bed -f 1.0 -wo > temp2
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
134
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
135 perl $BINDIR/excision.clustering.pl temp2 $i.excision.cluster.rpmk
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
136 rm temp temp2 $i.unproper.uniq.interval.bed $i.final.pairs.rpmk.bed
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
137
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
138 # Identify breakpoints using soft-clipping information
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
139 perl $BINDIR/pickSoftClipping.over.pl $i.excision.cluster.rpmk $REF > $i.excision.cluster.rpmk.sfcp
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
140 perl $BINDIR/refine_breakpoint.ex.pl
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
141
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
142 # Estimate excision sites frequencies
12
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
143 if [[ $SCORE -eq 0 ]]
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
144 then
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
145 perl $BINDIR/pickOverlapPair.ex.pl $i.excision.cluster.rpmk.refined.bp > $i.excision.cluster.rpmk.refined.bp.refsup
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
146 else
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
147 perl $BINDIR/pickOverlapPair.ex_MEM.pl $i.excision.cluster.rpmk.refined.bp $SCORE > $i.excision.cluster.rpmk.refined.bp.refsup
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
148 fi
ca36262102d8 planemo upload for repository https://github.com/portiahollyoak/Tools commit 5d021f520b653582862ec98dd812a051b804aa50
portiahollyoak
parents: 0
diff changeset
149
0
28d1a6f8143f planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff changeset
150 perl $BINDIR/summarize_excision.pl