-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathOrangeSpark
More file actions
executable file
·83 lines (58 loc) · 2.6 KB
/
OrangeSpark
File metadata and controls
executable file
·83 lines (58 loc) · 2.6 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
#!/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 "bash --version &> meta/bash.version"
DarkFishTechnology_runCommand 0 "samtools &> meta/samtools.version"
DarkFishTechnology_runCommand 0 "bcftools &> meta/bcftools.version"
DarkFishTechnology_runCommand 0 "bowtie2-build --version &> meta/bowtie2-build.version"
DarkFishTechnology_runCommand 0 "samstat -help &> meta/samstat.version"
DarkFishTechnology_runCommand 0 "date > meta/date"
DarkFishTechnology_runCommand 0 "uname -a > meta/uname"
DarkFishTechnology_runCommand 0 "hostname > meta/hostname"
DarkFishTechnology_runCommand 0 "bowtie2-build Reference/Reference.fasta Reference/Reference.fasta"
# for samtools
DarkFishTechnology_runCommand 0 "samtools faidx Reference/Reference.fasta"
DarkFishTechnology_moveReferenceCache
# we have <processors> processors
# and we have n files
# we have to generate some variables
fileNumber=0
DarkFishTechnology_runCommand 0 "mkdir SamAlignments"
# generate alignments
for fileR1 in $(ls Sample|grep _R1_)
do
fileR2=$(echo $fileR1|sed 's/_R1_/_R2_/g')
fileRX=$(echo $fileR1|sed 's/_R1_/_RX_/g')
processorNumber=$(($fileNumber%$processors))
randomFile=$(DarkFishTechnology_generateCacheEntry)
randomFiler1=$(DarkFishTechnology_generateCacheEntry)
randomFiler2=$(DarkFishTechnology_generateCacheEntry)
command="( zcat Sample/$fileR1 > $randomFiler1 ) ; "
command=$command" ( zcat Sample/$fileR2 > $randomFiler2 ) ; "
command=$command" DarkFishTechnology_linkCacheEntry $randomFiler1 SamAlignments $fileR1.fastq ; "
command=$command" DarkFishTechnology_linkCacheEntry $randomFiler2 SamAlignments $fileR2.fastq ; "
command=$command" ( bowtie2-align -x Reference/Reference.fasta -1 SamAlignments/$fileR1.fastq -2 SamAlignments/$fileR2.fastq | gzip > $randomFile ) ; "
command=$command" 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_finishAlignmentAnalysis