#!/bin/bash ###################################################################### # gff2ps # ###################################################################### # # Converting GFF files to PostScript. # # Copyright (C) 1999/2003 - Josep Francesc ABRIL FERRANDO # Roderic GUIGO SERRA # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ###################################################################### # # Creation Date: 01.03.1999 # Last Update: # $Id: gff2ps,v 1.99 2003/05/27 15:31:20 lopep Exp $ # # Autor : Josep Francesc ABRIL FERRANDO # e-mail: jabril@imim.es # # ( ./gff2ps -vC mygffcustomfile -- samples/data.gff > samples/.ps ) > & samples/report. # # SECONDS=0; # For timing purposes # Only for testing (only works in bash) # set -o xtrace GAWK="/usr/local/bin/gawk"; ############################################################## #################### PROGRAM DEFINITIONS ##################### # # TT_start=`date +%T`; CMDLine=$0" "$*; PID=$$; TEMP="/tmp"; if [ $GFF2PS_TMP ]; then if [ -d "$GFF2PS_TMP" ]; ###### Environment variable for temporary files directory. then TEMP="$GFF2PS_TMP"; fi; fi; PSHEAD=$TEMP/HEADPS.$PID; PSMAIN=$TEMP/MAINPS.$PID; GWKPRG=$TEMP/GAWKCODE.$PID; GWKOPT=$TEMP/GAWKOPTS.$PID; # # To delete temporary files if program breaks... trap "rm -f $GWKPRG $GWKOPT $PSHEAD $PSMAIN 2>/dev/null; exit 1" 0 1 2 3 9 15 ; # # Defining Default Values... RCSVERSION='$Id: gff2ps,v 1.99 2003/05/27 15:31:20 lopep Exp $'; AAA=`echo $RCSVERSION | $GAWK '{ print substr($0,2,length($0)-2); }'`; # Defaults () { # # Constants: PROGRAM="gff2ps"; GAWK_PROG="gff2ps.awk"; VERSION="v0.98d"; CREATIONDATE="1999/03/01"; # PSCREATION="1999/03/01" REVISION=`echo $RCSVERSION | $GAWK '{print $3}'`; DATERELEASE=`echo $RCSVERSION | $GAWK '{print $3,$4}'`; PSPROGRAM="PostScript Output from gff2ps"; AUTHOR="Josep Francesc ABRIL FERRANDO"; EMAIL="jabril@imim.es"; USAGE=$PROGRAM" [-h] [ ...(See available options with -h)... ] -- gff_files"; COLORS=" Basic Colors: black white Variable Colors: grey magenta violet blue skyblue cyan seagreen green limegreen yellow orange red brown You can get five color shades from Variable Colors with \"verydark\", \"dark\", \"light\" and \"verylight\" prefixes. An example: verydarkseagreen darkseagreen seagreen lightseagreen verylightseagreen"; PAGES=" From A0 to A10, from B0 to B10, 10x14, executive, folio, ledger, legal, letter, quarto, statement and tabloid."; # # Default User-Defined Options: CFDIR=`pwd`; if [ $GFF2PS_CFDIR ]; then if [ -d "$GFF2PS_CFDIR" ]; ###### Environment variable for custom file directory. then CFDIR="$GFF2PS_CFDIR"; fi; fi; bgcolor="white"; fgcolor="black"; v01=0; n01="load_customfile"; v02=""; n02="customfile_name"; if [ $GFF2PS_CUSTOMFILE ]; ###### Environment variable for default custom file name. then v03="$CFDIR/$GFF2PS_CUSTOMFILE"; else v03="$CFDIR/.gff2psrc"; fi; n03="customfile_name_default"; v04=0; n04="exist_default_customfile"; v04_1=0; n04_1="create_default_customfile"; v05=0; n05="print_report"; v06="!!!???"; n06="page_orientation"; # "Landscape" v07="!!!???"; n07="page_size"; # "a4" v08="!!!???"; n08="page_number"; # 1 v09="!!!???"; n09="blocks_x_page"; # 1 v10="!!!???"; n10="nucleotides_x_line"; # 0 v11="!!!???"; n11="show_blocks_top-bottom"; # 1 v12="!!!???"; n12="page_bbox"; # "auto,0,0" v13="!!!???"; n13="major_tickmarks_num"; # 10 v14="!!!???"; n14="major_tickmarks_nucleotides"; # -1 v15="!!!???"; n15="minor_tickmarks_num"; # 10 v16="!!!???"; n16="minor_tickmarks_nucleotides"; # -1 v17="!!!???"; n17="show_positions"; # "false" v18_s='*'; v18_e='*'; n18="zoom_cmdln"; v19="!!!???"; n19="foreground_color"; # "FGcolor" v20="!!!???"; n20="background_color"; # "BGcolor" v21="!!!???"; n21="header_style"; # "default" v22="!!!???"; n22="show_page_numbers"; # "on" v23="!!!???"; n23="show_date"; # "on" v24="!!!???"; n24="show_time"; # "on" v25="!!!???"; n25="title"; # "default" v26="!!!???"; n26="subtitle"; # "default" v27="!!!???"; n27="strand_show_forward"; # "on" v28="!!!???"; n28="strand_show_reverse"; # "on" v29="!!!???"; n29="strand_show_independent"; # "on" v30="!!!???"; n30="frame0_color"; # "blue" v31="!!!???"; n31="frame1_color"; # "red" v32="!!!???"; n32="frame2_color"; # "green" v33="!!!???"; n33="frame_unknown_color"; # "orange" v34=1; n34="quiet_mode"; v35=1; n35="Show_Credits"; v36="!!!???"; n36="page_bbox"; # "name,width,height" # CHOSFLG=0; CHOSFILE="none"; } # End of Defaults # # Default ColorDefinition: # colorDef () { # still not defined seagreen and limegreen (now same as green) cat <<'@@@COLORS@@@' % % COLORS.gff2ps,v 1.3 1999/12/14 09:20:05 jabril Exp jabril % % black+grey+white black 0.00 0.00 0.00 1.00 greyd 0.00 0.00 0.00 0.90 verydarkgrey 0.00 0.00 0.00 0.80 greyc 0.00 0.00 0.00 0.70 darkgrey 0.00 0.00 0.00 0.60 greyb 0.00 0.00 0.00 0.50 grey 0.00 0.00 0.00 0.40 greya 0.00 0.00 0.00 0.30 lightgrey 0.00 0.00 0.00 0.20 verylightgrey 0.00 0.00 0.00 0.10 white 0.00 0.00 0.00 0.00 % magenta verydarkmagenta 0.00 1.00 0.00 0.30 darkmagenta 0.00 0.80 0.00 0.05 magenta 0.00 0.60 0.00 0.00 lightmagenta 0.00 0.40 0.00 0.00 verylightmagenta 0.00 0.20 0.00 0.00 % violet verydarkviolet 0.45 0.85 0.00 0.00 darkviolet 0.30 0.65 0.00 0.00 violet 0.22 0.55 0.00 0.00 lightviolet 0.15 0.40 0.00 0.00 verylightviolet 0.10 0.20 0.00 0.00 % blue verydarkblue 1.00 1.00 0.00 0.20 darkblue 0.90 0.90 0.00 0.00 blue 0.75 0.75 0.00 0.00 lightblue 0.50 0.50 0.00 0.00 verylightblue 0.30 0.30 0.00 0.00 % skyblue verydarkskyblue 0.90 0.50 0.00 0.15 darkskyblue 0.75 0.45 0.00 0.00 skyblue 0.60 0.38 0.00 0.00 lightskyblue 0.45 0.25 0.00 0.00 verylightskyblue 0.30 0.15 0.00 0.00 % cyan verydarkcyan 1.00 0.00 0.00 0.10 darkcyan 0.80 0.00 0.00 0.00 cyan 0.60 0.00 0.00 0.00 lightcyan 0.40 0.00 0.00 0.00 verylightcyan 0.20 0.00 0.00 0.00 % seagreen verydarkseagreen 0.75 0.00 0.45 0.00 darkseagreen 0.62 0.00 0.38 0.00 seagreen 0.50 0.00 0.30 0.00 lightseagreen 0.38 0.00 0.22 0.00 verylightseagreen 0.25 0.00 0.15 0.00 % green verydarkgreen 1.00 0.00 1.00 0.25 darkgreen 0.80 0.00 0.80 0.00 green 0.60 0.00 0.60 0.00 lightgreen 0.40 0.00 0.40 0.00 verylightgreen 0.20 0.00 0.20 0.00 % limegreen verydarklimegreen 0.50 0.00 1.00 0.10 darklimegreen 0.40 0.00 0.95 0.00 limegreen 0.30 0.00 0.80 0.00 lightlimegreen 0.20 0.00 0.65 0.00 verylightlimegreen 0.10 0.00 0.50 0.00 % yellow verydarkyellow 0.00 0.00 1.00 0.25 darkyellow 0.00 0.00 1.00 0.10 yellow 0.00 0.00 1.00 0.00 lightyellow 0.00 0.00 0.50 0.00 verylightyellow 0.00 0.00 0.25 0.00 % orange verydarkorange 0.00 0.50 0.80 0.10 darkorange 0.00 0.40 0.80 0.00 orange 0.00 0.30 0.80 0.00 lightorange 0.00 0.20 0.75 0.00 verylightorange 0.00 0.15 0.70 0.00 % red verydarkred 0.00 1.00 1.00 0.15 darkred 0.00 0.80 0.80 0.00 red 0.00 0.60 0.60 0.00 lightred 0.00 0.40 0.40 0.00 verylightred 0.00 0.20 0.20 0.00 % brown verydarkbrown 0.35 0.85 1.00 0.40 darkbrown 0.30 0.70 1.00 0.35 brown 0.25 0.75 1.00 0.25 lightbrown 0.20 0.60 0.70 0.15 verylightbrown 0.15 0.45 0.55 0.00 @@@COLORS@@@ } # End of colorDef ############################################################## ################### SHELL MAIN FUNCTIONS ##################### # # Defining Help... Help () { # echo "" # echo "12345678901234567890123456789012345678901234567890123456789012345678901234567890" # echo " 1 2 3 4 5 6 7 8" echo ""; echo "NAME $PROGRAM"; echo "VERSION $VERSION"; echo ""; echo "Creation DATE: $CREATIONDATE"; echo "Last REVISION: $DATERELEASE"; echo ""; echo "SYNOPSIS"; echo ""; echo " $USAGE"; echo ""; echo "DESCRIPTION"; echo ""; echo " This program draws color-filled DotPlots"; echo " from files with gff-formatted data fields."; echo ""; echo ""; echo "OPTIONS"; echo ""; echo " -h Shows this help."; echo " -H