go_cds.csh 1.58 KB
Newer Older
1
#!/usr/bin/env tcsh -f
alain viari's avatar
alain viari committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15
#
#                           Annotate CDS 
#
#========================================================================================
#
#  Annotate CDS
#
#  go_cds.sh <FASTAFILE>
#
#		- <FASTAFILE> : The fasta file containing the genome to annotate
#
#  Results are printed to the standard output
#
#========================================================================================
Alain Viari's avatar
Alain Viari committed
16
# usage: go_cds.sh fasta [db_root]
alain viari's avatar
alain viari committed
17
#
alain viari's avatar
alain viari committed
18
unsetenv ORG_SOURCED
alain viari's avatar
alain viari committed
19 20 21 22 23 24

setenv ORG_HOME `dirname $0`/../../..
source $ORG_HOME/scripts/csh_init.sh

NeedArg 1

alain viari's avatar
alain viari committed
25
set Fasta = $Argv[1]; Shift
alain viari's avatar
alain viari committed
26 27 28 29 30

NeedFile $Fasta

set Genome = `basename $Fasta:r`

Alain Viari's avatar
Alain Viari committed
31
set DbRoot = $CDS_DATA_DIR/chlorodb
alain viari's avatar
alain viari committed
32 33

if ($#Argv > 0) then
Alain Viari's avatar
Alain Viari committed
34
  set DbRoot = $Argv[1]; Shift
alain viari's avatar
alain viari committed
35 36
endif

Alain Viari's avatar
Alain Viari committed
37 38 39 40
NeedDir $DbRoot/core
NeedFile $DbRoot/core/Annot.lst

NeedDir $DbRoot/models
alain viari's avatar
alain viari committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

#
# run everything into temporary place
#

set temp = $Genome.tmp
if (! -d $temp) then
  Notify "making directory $temp"
  mkdir $temp
endif

#
# pass1: run exonerate
#

Alain Viari's avatar
Alain Viari committed
56 57
foreach dir ("core" "shell" "dust")
  if (-d $DbRoot/$dir) then
58
    set fams = `ls $DbRoot/$dir/*.clean.fst`
Alain Viari's avatar
Alain Viari committed
59 60
    Notify "running pass1:$dir exonerate of $Genome on $DbRoot"
    foreach f ($fams)
61
      tcsh -f $PROG_DIR/do_exonerate.csh $Fasta $f $DbRoot/models $temp
Alain Viari's avatar
Alain Viari committed
62 63
    end
  endif
alain viari's avatar
alain viari committed
64 65
end

66 67
cp $temp/ $Genome.cds.fasta $Genome.cds.fasta 

alain viari's avatar
alain viari committed
68 69 70 71 72 73 74 75
#
# pass2: transsplicing
#

#
# pass3: prokov
#

76 77
$PROG_DIR/do_prokov.sh $Fasta $Genome.cds.fasta $temp

alain viari's avatar
alain viari committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#
# end : output on stdout
#

cat $temp/*.res

# cleanup everything

AssignUndef TMP_CLEANUP 1

if ($TMP_CLEANUP != 0) then
  Notify "  cleanup $temp"
  (\rm -r $temp) >& /dev/null
endif

Exit 0