-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgbcov.sh
executable file
·199 lines (152 loc) · 6.12 KB
/
gbcov.sh
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
#!/bin/bash
#SBATCH -J gbcov
#SBATCH -o %x.out
#SBATCH -n 6
#SBATCH --mem-per-cpu=18000
usage(){
echo "geneBodyCoverage - @bixBeta"
echo
echo
echo "Usage: bash" $0 "[-h arg] [-p arg] [-g arg]"
echo
echo "-------------------------------------------------------------------------------------------------------------------------------------------------------"
echo "[-h] --> Display Help "
echo "[-p] --> Project Identifier Number "
echo "[-g] --> genome < GRCh38, GRCm38, horse > "
echo "[-c] --> chr to subset on < a numeric option will subset on that chromosome e.g. 10)> "
echo "-------------------------------------------------------------------------------------------------------------------------------------------------------"
}
declare -A bed12
bed12=( ["hg38"]="/workdir/genomes/Homo_sapiens/hg38/UCSC/genes.bed12" \
["mm10"]="/workdir/genomes/Mus_musculus/mm10/UCSC/BED12/mm10.ucsc.bed12" \
["GRCh38"]="/workdir/genomes/Homo_sapiens/hg38/ENSEMBL/Homo_sapiens.GRCh38.bed12" \
["GRCm38"]="/workdir/genomes/Mus_musculus/mm10/ENSEMBL/Mus_musculus.GRCm38.bed12" \
["cat"]="/workdir/genomes/Felis_catus/Felis_catus9.0/Ensembl/Felis_catus.Felis_catus_9.0.95.bed12" \
["chicken"]="/workdir/genomes/Gallus_gallus/Galgal5/ENSEMBL/Gallus_gallus.Gallus_gallus-5.0.bed12" \
["chicken6"]="/workdir/genomes/Gallus_gallus/Galgal6/ENSEMBL/gtf.102/Gallus_gallus.GRCg6a.102.bed12" \
["horse"]="/workdir/genomes/Equus_caballus/EquCab3/ENSEMBL/genebuild-102/Equus_caballus.EquCab3.0.102.bed12" \
["horse2"]="/workdir/genomes/Equus_caballus/EquCab2/ENSEMBL/Equus_caballus.EquCab2.94.BED12" \
["ATCC_13047"]="/workdir/genomes/Enterobacter_cloacae/ATCC_13047/GCF_000025565.1_ASM2556v1_genomic.bed12" \
["grape"]="/workdir/genomes/Vitis_vinifera/GCA_000003745.2/ENSEMBL/Vitis_vinifera.star" \
["rat"]="/workdir/genomes/Rattus_norvegicus/rn6/ENSEMBL/Rattus_norvegicus.Rnor_6.0.bed12" \
["lonchura"]="/workdir/genomes/Lonchura_striata/LonStrDom1/ENSEMBL/Lonchura_striata_domestica.LonStrDom1.bed12" \
["goose"]="/workdir/genomes/Anser_brachyrhynchus/ASM259213v1/ENSEMBL/Anser_brachyrhynchus.ASM259213v1.bed12" \
["maize"]="/workdir/genomes/Zea_mays/B73_RefGen_v4/ENSEMBL/Zea_mays.B73_RefGen_v4.bed12" \
["finch"]="/workdir/genomes/Taeniopygia_guttata/taeGut3.2.4/ENSEMBL/UPDATED.ANNOTS/Taeniopygia_guttata.bTaeGut1_v1.p.bed12" \
["finch2"]="/workdir/genomes/Geospiza_fortis_ground_finch/GeoFor_1.0/NCBI/GCF_000277835.1_GeoFor_1.0_genomic.bed12" \
["dog"]="/workdir/genomes/Canis_familiaris/canFam3/ENSEMBL/CanFam3.1.101/Canis_lupus_familiaris.CanFam3.1.101.bed12" \
["aedes"]="/workdir/genomes/Aedes_aegypti/AaegL5.0/NCBI/GCF_002204515.2_AaegL5.0_genomic.bed12" \
["aedesVB"]="/workdir/genomes/Aedes_aegypti/AaegL5.0/Vectorbase/AaegyptiLVP_AGWG_release49/VectorBase-49_AaegyptiLVP_AGWG.BED12" \
["cow"]="/workdir/genomes/Bos_taurus/ARS-UCD1.2_GCA_002263795.2/ENSEMBL/Bos_taurus.ARS-UCD1.2.BED12" \
["BG8"]="/workdir/genomes/Methylomicrobium_album_BG8/ASM21427v3/NCBI/test/ncbi-genomes-2020-08-27/GCF_000214275.2_ASM21427v3_genomic.bed12" \
["ddSmed"]="/workdir/genomes/Schmidtea_mediterranea/dd_Smed_v6/NCBI/dd_Smed_v6.pcf.bed12" \
["cowUMD"]="/workdir/genomes/Bos_taurus/UMD_3.1.1/NCBI/GCF_000003055.6_Bos_taurus_UMD_3.1.1_genomic.bed12" \
["yeast"]="/workdir/genomes/Saccharomyces_cerevisiae/R64-1-1_GCA_000146045.2/ENSEMBL/Saccharomyces_cerevisiae.R64-1-1.bed12" )
printBED() {
for i in "${!bed12[@]}"; do echo "[${i}]=${bed12[$i]}"; done
}
geneBodyCov(){
# cd STAR*/*.BAMS
# for i in *.bam
# do
# BASE=`basename $(echo $i) .Aligned.sortedByCoord.out.bam `
# mv $i ${BASE}.bam
# done
#
# for i in *.bam
# do
# /programs/samtools-1.15.1-r/bin/samtools index -b $i
# done
# cd ..
# echo
# echo
# pwd
# echo
# echo
#source /programs/RSeQC2-2.6.1/setup.sh
/workdir/TREx_shared/projects/TREX_rna_1.sif geneBody_coverage.py -r ${bed12[${BED}]} -i *.BAMS/ -o ${PIN}
mkdir geneBodyCov
mv *geneBodyCoverage.* log.txt geneBodyCov
cd ..
}
geneBodyCov.split(){
cd STAR*/*.BAMS
for i in *.bam
do
BASE=`basename $(echo $i) .Aligned.sortedByCoord.out.bam `
mv $i ${BASE}.bam
done
for i in *.bam
do
/workdir/TREx_shared/projects/TREX_rna_1.sif samtools index -b $i
done
mkdir chr_${GBCOV}_BAMS
for i in *.bam
do
iSUB=`basename $(echo $i) .bam `
/workdir/TREx_shared/projects/TREX_rna_1.sif samtools view -b $i $GBCOV > ${iSUB}.chr${GBCOV}.bam
done
mv *.chr*.bam chr_${GBCOV}_BAMS
cd chr_${GBCOV}_BAMS
for i in *.bam
do
/workdir/TREx_shared/projects/TREX_rna_1.sif samtools index $i
done
cd ..
# export PYTHONPATH=/programs/RSeQC-5.0.1/lib64/python3.9/site-packages:/programs/RSeQC-5.0.1/lib/python3.9/site-packages
# export PATH=/programs/RSeQC-5.0.1/bin:$PATH
/workdir/TREx_shared/projects/TREX_rna_1.sif geneBody_coverage.py -r ${bed12[${BED}]} -i chr_${GBCOV}_BAMS -o ${PIN}
mkdir geneBodyCov_chr_${GBCOV}
mv *geneBodyCoverage.* log.txt geneBodyCov_chr_${GBCOV}
cd ..
}
while getopts "hp:g:c:" opt; do
case ${opt} in
h)
echo
echo
echo
usage
echo
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
printBED
echo
echo
exit 1
;;
p )
PIN=$OPTARG
echo "Project Identifier = " $PIN
;;
g )
BED=$OPTARG
echo "Bed file Selected = " $BED
;;
c)
GBCOV=$OPTARG
echo "Chromosome to subset on = " $GBCOV
geneBodyCov.split
;;
\? )
echo
echo
echo
usage
;;
esac
done
if [[ -z $1 ]] || [[ $1 = "--help" ]] ; then
#statements
echo
echo
echo
usage
echo
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
printBED
echo
echo
exit 1
fi