annotate JunctionDiff-vs-background.sh @ 1:1c6710924e80 draft

Uploaded
author saskia-hiltemann
date Mon, 03 Aug 2015 05:03:16 -0400
parents 1209f18a5a83
children 885ba15c2564
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
1 #!/bin/bash
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
2
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
3 #JunctionDiff-vs-background.sh $variants $genomes ${reference.fields.crr_path} ${reference.fields.31G_var_paths} ${reference.54G_var_paths} $output_filtered $output_report $scoreThresholdA $scoreThresholdB $distance $minlength
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
4
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
5 #set some defaults
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
6 output_report="output_reports.tsv"
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
7
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
8 set -- `getopt -n$0 -u -a --longoptions="variants: reference: VN_junctions: cgatools_binary: outputfile_filtered: outputfile_report: scoreThresholdA: scoreThresholdB: distance: minlength: " "h:" "$@"` || usage
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
9 [ $# -eq 0 ] && usage
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
10
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
11 while [ $# -gt 0 ]
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
12 do
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
13 case "$1" in
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
14 --variants) variants=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
15 --reference) crr=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
16 --VN_junctions) VN_junctionfiles_list=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
17 --cgatools_binary) cgatools_binary=$2;shift;; #cgatools binary to use
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
18 --outputfile_filtered) output_filtered=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
19 --outputfile_report) output_report=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
20 --scoreThresholdA) scoreThresholdA=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
21 --scoreThresholdB) scoreThresholdB=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
22 --distance) distance=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
23 --minlength) minlength=$2;shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
24 -h) shift;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
25 --) shift;break;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
26 -*) usage;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
27 *) break;;
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
28 esac
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
29 shift
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
30 done
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
31
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
32
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
33 # make copy of input junctions file, as this file will be altered
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
34 junctions="junctions.tsv"
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
35 cp $variants $junctions
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
36
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
37
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
38 ### run JunctionDiff against all of the VN junctionfiles
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
39
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
40 echo "running JunctionDiff against each of the VN genomes"
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
41
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
42 # for each line in VN genomes list of junctionfiles, run junctiondiff
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
43 count=0
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
44 while read line
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
45 do
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
46 if [[ $line != "" ]] # catch empty lines
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
47 then
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
48 count=$[$count+1]
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
49 ${cgatools_binary} junctiondiff \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
50 --beta \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
51 --statout \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
52 --reference $crr \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
53 --junctionsA $junctions \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
54 --junctionsB $line \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
55 --scoreThresholdA $scoreThresholdA \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
56 --scoreThresholdB $scoreThresholdB \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
57 --distance $distance \
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
58 --minlength $minlength
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
59
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
60 #concatenate all reports
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
61 echo -e "report of run $count:\n----------------------" >> $output_report
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
62 cat report.tsv >> $output_report
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
63 echo "" >> $output_report
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
64
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
65
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
66 #rename output file to junctions file for next iteration
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
67 rm $junctions
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
68 mv "diff-$junctions" $junctions
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
69 fi
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
70 done < $VN_junctionfiles_list
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
71
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
72 cp $junctions $output_filtered
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
73
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
74
1209f18a5a83 Uploaded
saskia-hiltemann
parents:
diff changeset
75