#!/bin/sh #Use this section to describe what goes on what line name=alllis # name.blc -> name.als -> name.ps nb=1 # number of lines before sequences na=5 # number of lines after sequences #ss=top # Comment out to have SS after sequences color=yes # "yes" for color gap=. # Gap character indent=9 # Indent width # Necessary Calculations -- no changes should be necessary ns=`grep -c ">" $name.blc` # number of seqs fs=`expr $nb + 1` # line of first sequence ls=`expr $nb + $ns` # line of last sequence if [ -z $ss ]; then # Decides where ss will be ss=`expr $nb + $ns + 2` # SS after sequence else ss=1 # SS at top fi ssl=`expr $ss + 1` # line of secondary sstructure labels ss2=`expr $ss + 2` # line of secondary structure ssl2=`expr $ss + 3` # line of secondary sstructure labels b11=`echo $b1 |awk '{print $2}'` # The seq# of block 1 b22=`echo $b2 |awk '{print $2}'` # The seq# of block 2 b33=`echo $b3 |awk '{print $2}'` # The seq# of block 3 # ab / ae = alignment begin / end ab=`grep -n "*" $name.blc |head -1 |awk -F ":" '{print $1}'` ae=`grep -n "*" $name.blc |tail -1 |awk -F ":" '{print $1}'` loa=`expr $ae - $ab - 1` #Length of alignment #nc defines the percentage of conservation nc=`expr $ns \* 6 / 10` #Generate Alscript Input cat << end-top > temp.als #Comments in ALscript command files start with a # #Commands are free format - separated by blank, tab or comma characters #But no blank lines. Blank lines must have a comment character # # BLOCK_FILE $name.blc OUTPUT_FILE $name.ps PORTRAIT POINTSIZE 7 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica-Bold DEFAULT DEFINE_FONT 2 Helvetica REL .2 DEFINE_FONT 3 Symbol REL 1.2 DEFINE_FONT 4 Courier-Bold DEFAULT IDENT_WIDTH $indent ADD_SEQ 0 $nb ADD_SEQ $ns $na SINGLE_PAGE bw#DEFINE_COLOUR 1 .2 .2 .2 bw#DEFINE_COLOUR 2 .4 .4 .4 bw#DEFINE_COLOUR 3 .8 .8 .8 col#DEFINE_COLOUR 1 1 0 0 col#DEFINE_COLOUR 2 0 0 1 col#DEFINE_COLOUR 3 0 1 0 col#DEFINE_COLOUR 4 0 1 1 col#DEFINE_COLOUR 5 1 0 1 col#DEFINE_COLOUR 6 1 .4 .4 col#DEFINE_COLOUR 7 .4 .4 1 col#DEFINE_COLOUR 8 .4 1 .4 # NUMBER_SEQS # DO_TICKS NO_NUMBERS SETUP #Tell the program to get on with the formatting. ID_FONT ALL 4 FONT_REGION ALL 1 FONT_REGION 1 $fs $loa $ls 0 RELATIVE_TO $fs #assumes your sequence on top end-top sed -e s/\$ssl/$ssl/g -e s/\$ss/$ss/g -e s/\$loa/$loa/g $name-c.ss >> temp.als sed -e s/\$ssl/$ssl2/g -e s/\$ss/$ss2/g -e s/\$loa/$loa/g $name-d.ss >> temp.als cat << end-bottom >> temp.als # # Mask for conservative substitution # Next line assumes your sequence is on top of the alignment RELATIVE_TO 0 SUB_CHARS 1 $fs $loa $ls SPACE "$gap" # Mask for conserved calcons 1 $fs $loa $ls #Last number on next line is % conserved (times ten) for conservative sub mask SETUP mask ILLEGAL "$gap" mask SETUP mask CONSERVATION 1 $fs $loa $ls 6 mask CCOL 1 $fs $loa $ls 100 mask FONT 1 $fs $loa $ls 1 mask SCOL 1 $fs $loa $ls 3 mask RESET #Last number on next line is #/total seqs for conserved mask SETUP mask ILLEGAL "$gap" mask ID 1 $fs $loa $ls $nc mask SCOL 1 $fs $loa $ls 2 mask CCOL 1 $fs $loa $ls 99 mask FONT 1 $fs $loa $ls 1 mask RESET # Mask for total identity mask CONSERVATION 1 $fs $loa $ls 10 mask SCOL 1 $fs $loa $ls 1 mask CCOL 1 $fs $loa $ls 99 # mask FONT 1 $fs $loa $ls 1 mask RESET #TEXT 36 30 "(2 - 35)" SUB_ID 2 "Mm 7305363" SUB_ID 3 "Hs 4557741" SUB_ID 4 "Ss 11276042" SUB_ID 5 "Bt 1170793" SUB_ID 6 "Mf 23574762" SUB_ID 7 "Gg 6601335" SUB_ID 8 "Xl 14132774" SUB_ID 9 "Dr 27882549" SUB_ID 10 "Dm 3983137" SUB_ID 11 "Ce 17554220" SUB_ID 12 "Dd 24210418" SUB_ID 13 "Ag 31240513" SUB_ID 14 "Ci 23575733" SUB_ID 15 "Pc 14599401" SUB_ID 16 "Nc 28950172" SUB_ID 17 "En 3024219" # Text commands created for numbering # Sequence Number: 1 # Starting Number: 1 # Interval: 10 # Position: 1 TEXT 20 1 "10" TEXT 30 1 "20" TEXT 40 1 "30" TEXT 55 1 "40" TEXT 65 1 "50" TEXT 75 1 "60" TEXT 85 1 "70" TEXT 95 1 "80" TEXT 108 1 "90" RELATIVE_TO 1 1 TEXT 71 1 "@fcircle" TEXT 72 1 "@fcircle" # End of Alscript input file end-bottom if [ $color == "yes" ] ; then grep -v "bw#" temp.als | sed 's/col#/ /g' > $name.als else grep -v "col#" temp.als | sed 's/bw#/ /g' > $name.als fi alscript $name.als > $name.ps && kghostview $name.ps & gs -dBATCH -dNOPAUSE -sDEVICE=jpeg -sOutputFile=$name.jpg -r100 $name.ps