File: g3-iterated.csh

package info (click to toggle)
tigr-glimmer 3.02-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,952 kB
  • ctags: 2,530
  • sloc: cpp: 24,376; awk: 232; csh: 220; makefile: 155; sh: 36
file content (132 lines) | stat: -rwxr-xr-x 3,802 bytes parent folder | download | duplicates (12)
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
#!/bin/csh

if ($#argv < 2) then
  echo "Usage:  g3-iterated.csh  <genome> <tag>"
  echo "           [step<i>  [only]]"
  echo ""
  echo "Run Glimmer3 on the sequence in file <genome> using program"
  echo " long-orfs  to find a training set.  Use those predictions as a"
  echo "training set for a second run of Glimmer3.  Use <tag> to prefix"
  echo "output files, which are:"
  echo "<tag>.longorfs is coordinate file of training sequences"
  echo "<tag>.train is the multifasta file of training sequences"
  echo "<tag>.icm is the model"
  echo "<tag>.run1.detail is the first Glimmer3 output detail"
  echo "<tag>.run1.predict is the first Glimmer3 predictions"
  echo "<tag>.coords are the training coordinates for starts and the PWM"
  echo "<tag>.upstream are the regions before the starts in <tag>.coords"
  echo "<tag>.motif is a PWM of the upstream regions"
  echo "<tag>.detail is the final Glimmer3 output detail"
  echo "<tag>.predict is the final Glimmer3 predictions"
  echo ""
  echo "If the 6th argument is filled in, then jump to that step"
  echo "If the 7th argument is also set to 'only', then do only that step"

  exit -1;
endif


set genome = $1
set tag = $2
set step = $3
set onestep = $4

set awkpath = /fs/szgenefinding/Glimmer3/scripts
set glimmerpath = /fs/szgenefinding/Glimmer3/bin
set elphbin = /nfshomes/adelcher/bin/elph

# add/change glimmer options here
set glimmeropts = "-o50 -g110 -t30"

set numsteps = 8

if  ($step != "")  goto $step
    

step1:
# Find long, non-overlapping orfs to use as a training set
echo "Step 1 of ${numsteps}:  Finding long orfs for training"
$glimmerpath/long-orfs -n -t 1.15 $genome $tag.longorfs
if  ($status != 0)  then
  echo "Failed to find long-orf training set"
  exit
endif
if  ($onestep == "only")  exit


step2:
# Extract the training sequences from the genome file
echo "Step 2 of ${numsteps}:  Extracting training sequences"
$glimmerpath/extract -t $genome $tag.longorfs > $tag.train
if  ($status != 0)  then
  echo "Failed to extract training sequences"
  exit
endif
if  ($onestep == "only")  exit


step3:
# Build the icm from the training sequences
echo "Step 3 of ${numsteps}:  Building ICM"
$glimmerpath/build-icm -r $tag.icm < $tag.train
if  ($status != 0)  then
  echo "Failed to build ICM"
  exit
endif
if  ($onestep == "only")  exit


step4:
# Run first Glimmer
echo "Step 4 of ${numsteps}:  Running first Glimmer3"
$glimmerpath/glimmer3 $glimmeropts $genome $tag.icm $tag.run1
if  ($status != 0)  then
  echo "Failed to run Glimmer3"
  exit
endif
if  ($onestep == "only")  exit


step5:
# Get training coordinates from first predictions
echo "Step 5 of ${numsteps}:  Getting training coordinates"
tail -n +2 $tag.run1.predict > $tag.coords
if  ($status != 0)  then
  echo "Failed to get training coordinates"
  exit
endif
if  ($onestep == "only")  exit


step6:
# Create a position weight matrix (PWM) from the regions
# upstream of the start locations in $tag.coords
echo "Step 6 of ${numsteps}:  Making PWM from upstream regions"
$awkpath/upstream-coords.awk 25 0 $tag.coords \
   | $glimmerpath/extract $genome - > $tag.upstream
$elphbin $tag.upstream LEN=6 | $awkpath/get-motif-counts.awk > $tag.motif
if  ($status != 0)  then
  echo "Failed to create PWM"
  exit
endif
if  ($onestep == "only")  exit


step7:
# Determine the distribution of start-codon usage in $tag.coords
echo "Step 7 of ${numsteps}:  Getting start-codon usage"
set startuse = `$glimmerpath/start-codon-distrib -3 $genome $tag.coords`
if  ($onestep == "only")  exit


step8:
# Run second Glimmer
echo "Step 8 of ${numsteps}:  Running second Glimmer3"
$glimmerpath/glimmer3 $glimmeropts -b $tag.motif -P $startuse $genome $tag.icm $tag
if  ($status != 0)  then
  echo "Failed to run Glimmer3"
  exit
endif
if  ($onestep == "only")  exit