-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloneTophatOutputByGroup.sh
More file actions
executable file
·59 lines (41 loc) · 1.01 KB
/
Copy pathcloneTophatOutputByGroup.sh
File metadata and controls
executable file
·59 lines (41 loc) · 1.01 KB
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
#!/bin/bash
:<<'COMMENT'
#sampleGroup.txt
sampleGroups=( A B C )
A=( A1 A2 A3 )
B=( B1 B2 )
C=( C1 C2 C3 C4)
COMMENT
if [ $# -lt 2 ]; then
echo $0 "sampleGroupFile newTophatParent"
exit
fi
sampleGroupFile=$1
newTophatParent=$2
newTophatParent=`abspath.py $newTophatParent`
newTophatDir=$newTophatParent/tophatOutput
mkdir.py $newTophatDir
source $sampleGroupFile
cd ..
cd tophatOutput
for sampleGroup in ${sampleGroups[@]}; do
rm -Rf $newTophatDir/$sampleGroup
mkdir.py $newTophatDir/$sampleGroup
vname=${sampleGroup}
retriever="echo \${$vname[@]}"
sampleList=(`eval $retriever`)
for sample in ${sampleList[@]};do
echo $sample for $sampleGroup
ln $sample/accepted_hits.bam $newTophatDir/$sampleGroup/$sample.tophat.bam.00
done
ori=`pwd`
cd $newTophatDir/$sampleGroup/
#now merge
samtools merge accepted_hits.bam *.bam.00
samtools sort accepted_hits.bam accepted_hits.sorted
if [ -e accepted_hits.sorted.bam ]; then
rm accepted_hits.bam
fi
samtools index accepted_hits.sorted.bam
cd $ori
done