-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRedWave
More file actions
executable file
·100 lines (67 loc) · 2.68 KB
/
RedWave
File metadata and controls
executable file
·100 lines (67 loc) · 2.68 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
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
#!/bin/bash
# author: Sébastien Boisvert
# date: 2011-12-23
# this is some heavy scripting
# parallel machines in bash
# I use variable indirection
referenceFileOrigin=$1
# the argument must not be absolute paths.
sampleDirectoryOrigin=$2
processors=$3
output=$4
mkdir $output
cd $output
source $DARK_FISH_TECHNOLOGY
DarkFishTechnology_initializeDirectory
DarkFishTechnology_prepareReference $referenceFileOrigin
DarkFishTechnology_prepareSample $sampleDirectoryOrigin
DarkFishTechnology_runCommand 0 "samtools &> meta/samtools.version"
DarkFishTechnology_runCommand 0 "bcftools &> meta/bcftools.version"
DarkFishTechnology_runCommand 0 "bwa &> meta/bwa.version"
DarkFishTechnology_runCommand 0 "samstat -help &> meta/samstat.version"
# for bwa
DarkFishTechnology_runCommand 0 "bwa index Reference/Reference.fasta"
# for samtools
DarkFishTechnology_runCommand 0 "samtools faidx Reference/Reference.fasta"
DarkFishTechnology_moveReferenceCache
# we have <processors> processors
# and we have n files
# the command is bwa aln reference reads > sai
# we have to generate some variables
fileNumber=0
DarkFishTechnology_runCommand 0 "mkdir BinaryAlignments"
# generate alignments
for file in $(ls Sample)
do
processorNumber=$(($fileNumber%$processors))
randomFile=$(DarkFishTechnology_generateCacheEntry)
command="( bwa aln Reference/Reference.fasta Sample/$file > $randomFile ) ; "
command=$command" ( DarkFishTechnology_linkCacheEntry $randomFile BinaryAlignments $file.sai ) ; "
processorVariable=processor$processorNumber"BinaryAlignments"
oldValue=$(eval echo \$$processorVariable)
newValue=$oldValue$command
toEval="$processorVariable=\"$newValue\""
eval $toEval
fileNumber=$(($fileNumber+1))
done
DarkFishTechnology_runGroupCommands "BinaryAlignments"
fileNumber=0
DarkFishTechnology_runCommand 0 "mkdir SamAlignments"
# generate compressed sam files
for fileR1 in $(ls Sample|grep _R1_)
do
fileR2=$(echo $fileR1|sed 's/_R1_/_R2_/g')
fileRX=$(echo $fileR1|sed 's/_R1_/_RX_/g')
randomFile=$(DarkFishTechnology_generateCacheEntry)
processorNumber=$(($fileNumber%$processors))
command=" ( bwa sampe Reference/Reference.fasta BinaryAlignments/$fileR1.sai BinaryAlignments/$fileR2.sai Sample/$fileR1 Sample/$fileR2 |gzip > $randomFile ) ; ( DarkFishTechnology_linkCacheEntry $randomFile SamAlignments $fileRX.sam.gz ) ; "
processorVariable=processor$processorNumber"SamAlignments"
oldValue=$(eval echo \$$processorVariable)
newValue=$oldValue$command
toEval="$processorVariable=\"$newValue\""
eval $toEval
fileNumber=$(($fileNumber+1))
done
DarkFishTechnology_runGroupCommands "SamAlignments"
DarkFishTechnology_purgeGroupCache "BinaryAlignments"
DarkFishTechnology_finishAlignmentAnalysis