#!/usr/local/bin/perl ################################################################# #Copyright: University of Utah Genome Center, University of Utah #Author:Andrew von Niederhausern #Email: avonnied@genetics.utah.edu #Created:01/02/2001 #Last Updated:07/14/2002 #Version: 1.3.2 #Purpose: Gene Model Image Distribution #WebSite: http://www.genome.utah.edu/genesnps #Unauthorized use is prohibited, this header may not be removed # or edited ################################################################# $genbank_dir = "genbank"; #### edit this to the path of the genbank files $version = "1.3.2"; use Bio::Seq; use Bio::SeqIO; use Bio::SeqI; use Bio::SeqFeatureI; use Bio::Tools::CodonTable; use CGI::Carp qw(carpout fatalsToBrowser); ######## Read parameters passed by web browser through QUERY_STRING $buffer = $ENV{'QUERY_STRING'}; # Form Variables\ @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($Fname, $Fvalue) = split(/=/, $pair); $Fvalue =~ tr/+/ /; #$Fvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$Fname} = $Fvalue; } if ( exists $FORM{organism} ) { $genbank_dir = "$FORM{organism}/$genbank_dir"; } #### Security Data ###### NOTE: Feature currently not working $refer_url = $ENV{"HTTP_REFERER"}; # Url of Referring page (@refer_url) = split(/\//,$refer_url); $refer_url= $refer_url[2]; $host=$ENV{"REMOTE_ADDR"}; # Address of remote computer ################################# ########## HTML HEADER DONOT REMOVE print "Content-type: text/html\n\n"; if ($FORM{"gene"}) { # gene name must be present $gene = $FORM{"gene"}; $seqobj = &get_seqobj($gene); # generate seqobj $dir="$genbank_dir/$gene"; #set working Directory use GD; ## Drawing Package $im = new GD::Image(750,150); # Initalize Image &color; # initialize color_pool ########## Feature Colors ########################### #### Set Gene Model Colors @exon_color = @realblue2; @intron_color = @cwhite; @utr_color = @green2; $background=$darkgrey; $im->filledRectangle(0,10,700,135,$background); ### Setting Colors of Legend Depending on Filters Chosen if ($FORM{"filter"} !~ "INTRON" && $FORM{"filter"} !~ "SYNON" && $FORM{"filter"} !~ "NONSYN" && $FORM{"filter"} !~ "EXON") { $flank_color = $black; } else { $flank_color = $lightgrey2; } if ($FORM{"filter"} !~ "NONSYN" && $FORM{"filter"} !~ "NONCODE" && $FORM{"filter"} !~ "INTRON") { $syn_color = $orange2; $syn_color_label = $black; } else { $syn_color = $lightgrey2; $syn_color_label = $lightgrey2; } if ($FORM{"filter"} !~ "SYNON" && $FORM{"filter"} !~ "NONCODE" && $FORM{"filter"} !~ "INTRON") { $nonsyn_color = $pinky; $nonsyn_color_label = $black; } else { $nonsyn_color = $lightgrey2; $nonsyn_color_label = $lightgrey2; } if ($FORM{"filter"} !~ "EXON" && $FORM{"filter"} !~ "INTRON" && $FORM{"filter"} !~ "NONSYN") { $utr_snp = $im->colorAllocate(0,100,0); $utr_color_label = $black; } else { $utr_snp = $lightgrey2; $utr_color_label = $lightgrey2; } if ($FORM{"filter"} !~ "SYNON" && $FORM{"filter"} !~ "EXON" && $FORM{"filter"} !~ "NONSYN") { $intron_color = $pbrown; $intron_color_label = $black; } else { $intron_color = $lightgrey2; $intron_color_label = $lightgrey2; } $term_color=$firebrick1; ########## End Color Setting ############################## if ($FORM{"version"}) { $im->string(gdTinyFont,4,138,"v$version",$black); ### Displays Current revision of gene_model.cgi Not Really Needed } #### Side Bar Lines and Labels ######################## $im->string(gdMediumBoldFont,708,1,"Gene",$blue); $im->string(gdMediumBoldFont,703,15,"$gene",$blue); ### SNP Side Bars if ($FORM{"frequency"} == 1) { # Low Frequency Scale $freq_quarter = ".025"; $freq_half = ".05"; $freq_3quarter = ".075"; $freq_full = ".1"; $freq_label = "Low"; $f_half_color = $red; } else { # High Frequency Scale $freq_quarter = ".12"; $freq_half = ".25"; $freq_3quarter = ".36"; $f_half_color = $blue; $freq_label = "High"; $freq_full = ".5"; } $im->string(gdTinyFont,703,82,"SNP Freq.",$f_half_color); # Snp Label ## Side Lines $im->line(700,93.75,705,93.75,$darkgrey5); $im->line(700,107.5,710,107.5,$darkgrey5); $im->line(700,120.5,705,120.5,$darkgrey5); $im->dashedLine(0,93.75,700,93.75, $darkgrey5); # 1/4 Line $im->dashedLine(0,107.5,700,107.5, $darkgrey5); # 1/2 Line $im->dashedLine(0,120.5,700,120.5, $darkgrey5); # 3/4 Line ## Scale Labels $im-> string(gdTinyFont,713,125,"$freq_full",$f_half_color); $im->string(gdTinyFont,713,103,"$freq_half",$f_half_color); ### Genomic Labels $im->line(700,40,750,40,$darkgrey5); $im->string(gdSmallFont,705,53,"Genomic",$blue); ##### Total Length ################### $start = 1; $end = $end = $seqobj->length(); $total_l = $end; $end_orig = $end; $dna_length = $end; $dna_length /= 1000; $dna_length = sprintf("%.0f kb",$dna_length); $im->line(700,81,750,81,$black); ######## Moving ############ if($FORM{"move"}) { ### Parameter passed from browser, as nucleotides $move = $FORM{"move"}; $start += $move; $end += $move; } ####### Zooming ########### if ($FORM{"zoom"} > 0) { #passed as a percentage $zoom = sprintf("%.0f",(($end - $start) * $FORM{"zoom"})/2); $newstart = $start; $newend = $end; # $zoom = $FORM{"zoom"}; $zoom_check = $end; $zoom_check -= $start; if ($zoom_check > $zoom) { $newstart += $zoom; $newend -= $zoom; if ($newstart < $newend) { $start = $newstart; $end = $newend; } } else { $im->arc(5,5,5,5,0,360,$red); $im-> fill(6,6,$red); } } ######### Displayed Genomic Size ###### $d_size = $end; $d_size -= $start; $dna_length = $d_size; if ($dna_length > 1000) { $dna_length /= 1000; $dna_length = sprintf("%.0fkb",$dna_length); } else { $dna_length = sprintf("%.0f",$dna_length); } $im->string(gdTinyFont,705,70,"$dna_length",$black); ##### Division Factor, All other data is divided by Factor ######### $factor = $d_size; $factor /= 700; $imagestart = $start; $imagestart /= $factor; $drawfactor = $factor; $factorcount = 0; $drawfactinterval = $factor; $drawfactinterval *= 4; $drawfactor += $drawfactinterval; ######### Coordinate Bars ############# $im->line(0,0,0,30,$black); $im->line(700,0,700,30,$black); $im->line(0,10,700,10,$black); ### Genomic Sequence if ($start < 1) { $genomic_start = $start * -1; $genomic_start /= $factor; $im->dashedLine(0,73,$genomic_start,73,$white); $im->dashedLine(0,77,$genomic_start,77,$white); $im->line($genomic_start,10,$genomic_start,25,$black); $im->string(gdTinyFont,$genomic_start,25,"1",$white); } elsif ($start == 1) { $genomic_start = 0; } else { $genomic_start = 0; } if ($end > $end_orig) { $genomic_end = $end - $end_orig; $genomic_end /= $factor; $genomic_end = 700 - $genomic_end; $im->dashedLine($genomic_end,73,700,73,$white); $im->dashedLine($genomic_end,77,700,77,$white); $im->line($genomic_end,10,$genomic_end,25,$black); $im->string(gdTinyFont,$genomic_end,25,"$dna_length",$white) } else { $genomic_end = "700"; } $im->rectangle($genomic_start,72,$genomic_end,78,$black); ### Set Bar Spacing ######### $firstfact = $factor; $firstfact += $start; $im->string(gdTinyFont,5,15,"$start",$white); $nol = $d_size; $nol /= $factor; $nol /= 10; # 10 Lines / image; $nolfactor = $nol; $grid = 100; while ($nol < 699) { $im->line($nol,0,$nol,10,$black); $factn = $nol; $factn *= $factor; $factn += $start; $factn = sprintf ("%.0f",$factn); $fontoff = $nol; $fontoff -= 30; $im->string(gdTinyFont,$fontoff,1,"$factn",$black); $nol += $nolfactor; } $im->string(gdTinyFont,670,1,"$end",$black); ####### Intron Coloring ######## @exons = &feature_array('exon'); my ($minstart, $maxend) = (0,0); # foreach my $exon (@exons) { # $minstart = $exon->start unless ($minstart < $exon->start); # $maxend = $exon->end unless ($maxend > $exon->end); # } $begin_int = $exons[0]->start; # get exon 1 $end_int = $exons[$#exons]->end; # get last exon # $begin_int = $minstart; # $end_int = $maxend; $begin_int -= $start; $end_int -= $start; $begin_int /= $factor; $end_int /= $factor; if ($begin_int < 0) { $bein_int = 0; } if ($end_int > 700) { $end_int = 700; } if ($begin_int < 0 && $end_int < 0) { $draw_intron = 1; } if ($begin_int > 700 && $end_int > 700) { $draw_intron = 1 } $i_start = 71; ## Start of Genomic if (!$draw_intron) { foreach (@intron_color) { $im->line($begin_int,$i_start,$end_int,$i_start,$_); $i_start++; } } ########## End Intron Coloring ########## ############## Gene Bar ############## @gene_tag = &feature_array("gene"); $ts = 0; if ($gene_tag[0] != -1) { foreach $g (@gene_tag) { my ($newgene) = $g->get_tag_values ("gene"); if ($newgene eq $gene) { if ($g->length >= $ts) { $ts = $g->length(); $gstart = $g->start(); $gend = $g->end(); } } } $gene_length = $gend; $gene_length -= $gstart; $gstart -= $start; $gend -= $start; $gstart /= $factor; $gend /= $factor; if ($gend > 700) { $gend = 700; } if ($gend > 700 && $gstart > 700) { $g_d = 1; } if ($gend < 0 && $gstart < 0) { $g_d = 1; } if (!$g_d) { $im->filledRectangle($gstart,10,$gend,13,$green); } $gene_length /= 1000; $gene_length = sprintf ("%.0f kb",$gene_length); $im->string(gdTinyFont,715,30,"$gene_length",$black); } ########### End Gene Bar ######################## ########### Zoom Pointer ########## $im->line(350,10,350,18,$black); $im->line(347,15,350,18,$black); $im->line(350,18,353,15,$black); ################################## ###################### Exon Info #################### my $isnewgene = 0; my $color = $white; my ($gene, $newgene) = ('', ''); if ($exons[0] != -1) { foreach my $ex (@exons) { $estart = $ex->start(); $eend = $ex->end(); my ($exoncount) = $ex->get_tag_values ("number"); my ($newgene) = $ex->get_tag_values ("gene"); if ($gene ne $newgene) { $color = ($color == $white) ? $black : $white; $gene = $newgene; } $estart -= 1; if ($estart > $end && $eend > $end) { next; } if ($estart < $start && $eend < $start) { next; } if ($eend > $end) { $eend = $end; } $elength = $eend; $estart -= $start; $eend -= $start; $estart /= $factor; $eend /= $factor; if ($eend > 700) { $eend = 700; } $np = $eend; # for printing exon number $ne = $estart; $np -= $ne; $np /= 2; $ne += $np; $exon_print_test = $ne; $exon_print_test -= $last_exon_end; if ($exon_print_test > 15 || $exon_print_test < -15 ) { ### If Spacing is OK print Number ( avoids number crowding) $im->string(gdTinyFont,$ne,45,$exoncount,$color); $last_exon_end = $ne; } ### Print the Exon itself #### $i_start = 68; foreach (@exon_color) { $im->line($estart,$i_start,$eend,$i_start,$_); $i_start++; } } } ################ End Exon Information ########################### ######################### UTR Info ######################## @utrs = &feature_array("UTR"); if ($utrs[0] != -1) { foreach $utr (@utrs) { ($utrs,$utre) = split(/,/,$utr); eval{ $location = $utr->location(); if ($location =~ /Simple/) { &draw_utr($utr->start(),$utr->end()); } elsif ($location =~ /Split/) { @subloc = $location->sub_Location(); if (@subloc) { foreach $sl (@subloc) { &draw_utr($sl->start(),$sl->end()); } } } }; } } ############### End UTR Info ############################################## ########### MASKED ####################### @masked = &feature_array("misc_feature","note","RepeatMask"); if ($FORM{"masked"} =~ /SHOW/ && $masked[0] != -1) { foreach (@masked) { # ($m_start,$m_end) = split(/,/,$_); $m_start = $_->start(); $m_end = $_->end(); $m_start -= $start; $m_end -= $start; $m_start /= $factor; $m_end /= $factor; if ($m_start <= 0 && $m_end >=0) { $m_start=0; } if ($m_start < 700 && $m_end >= 700) { $m_end = 700; } if ($m_end <= 0 || $m_start >= 700) {next;} $im->filledRectangle($m_start,73,$m_end,77,$purple); $m_start+=5; $m_end -= 2; $im->string(gdTinyFont,260,138,"(Repeats)",$blue); } } ######################################### ######################### SNP Info ###################################### $snpcount = 0; if ($FORM{"submitter"}) { $im->string(gdSmallFont,500,20,"Submitter:$FORM{submitter}",$white); } @snps = &feature_array("variation"); $snpcount++; if ($snps[0] != -1) { foreach (@snps) { undef($snp_frequency); undef($snp_chromosomes); undef($snp_implication); undef($snp_alleles); undef($snp_submitter); undef($snp_heterozygosity); undef($snp_ssnumber); undef($snp_position); eval{ $snp_position = $_->start(); }; if ($snp_position < $start || $snp_position > $end) {next;}; eval{ ($snp_implication) = $_->each_tag_value("implication"); }; eval{ ($snp_ssnumber) = $_->each_tag_value("standard_name"); }; eval{ ($snp_alleles) = $_->each_tag_value("allele"); }; eval{ ($snp_submitter) = $_->each_tag_value("submitter"); }; eval{ ($snp_frequency) = $_->each_tag_value("frequency"); }; eval{ ($snp_chromosomes) = $_->each_tag_value("chromosomes"); }; eval{ ($snp_heterozygosity) = $_->each_tag_value("heterozygosity"); }; if ($FORM{"submitter"}) { if ($FORM{"submitter"} !~ /^$snp_submitter$/) { next; } } $asnp = $snpp; $snp_position -= $start; $snp_position /= $factor; if ($snp_position > 700 || $snp < 0) {next;} ######### Confirmed SNP filter if ($FORM{"validate"} =~ "VERIFIED") { if ($snp_frequency == 0 && $snp_heterozygosity == 0) { next; } } if ($snp_frequency == 0 && $snp_heterozygosity != 0) { $snp_frequency = $snp_heterozygosity; } ##### Frequency Scaling ###### if ($FORM{"frequency"} == 1) { $freq_factor = 550; } else { $freq_factor = 110; } if ($FORM{"frequency"} == 1) { $snp_cutoff = .01; } else { $snp_cutoff = .05; } if ($snp_frequency < $snp_cutoff && $snp_frequency != 0) { $snp_frequency = $snp_cutoff; } $f2 = $snp_frequency; if ($snp_frequency != 0) { $snp_frequency *= $freq_factor; $snp_frequency += 80; } else { $snp_frequency = 85; } if ($FORM{"frequency"} && $snp_frequency > 130) { $snp_frequency = 130; } ########### SNP Implication Filters ########## if ($snp_implication =~ /nonsyn/) { if ($FORM{"filter"} =~ "INTRON" || $FORM{"filter"} =~ "SYNON" || $FORM{"filter"} =~ "NONCODE") {next;} $snpcolor = $nonsyn_color; } elsif ($snp_implication =~ "term") { if ($FORM{"filter"} =~ "INTRON" || $FORM{"filter"} =~ "NONSYN" || $FORM{"filter"} =~ "SYNON" || $FORM{"filter"} =~ "NONCODE"){next;} $snpcolor = $term_color; } elsif ($snp_implication =~ /synon/) { if ($FORM{"filter"} =~ "INTRON" || $FORM{"filter"} =~ "NONSYN" || $FORM{"filter"} =~ "NONCODE"){next;} $snpcolor = $syn_color; } elsif ($snp_implication =~ /intron/) { if ($FORM{"filter"} =~ "SYNON" || $FORM{"filter"} =~ "NONSYN" || $FORM{"filter"} =~ "EXON"){next;} $snpcolor = $intron_color; } elsif ($snp_implication =~ /UTR/) { if ($FORM{"filter"} =~ "NONSYN" || $FORM{"filter"} =~ "INTRON" || $FORM{"filter"} =~ "EXON") { next; } $snpcolor = $utr_snp; } else { if ($FORM{"filter"} =~ "SYNON" || $FORM{"filter"} =~ "NONSYN" || $FORM{"filter"} =~ "EXON" || $FORM{"filter"} =~ "INTRON"){next;} $snpcolor = $black; } $im->line($snp_position, 80, $snp_position, $snp_frequency, $snpcolor); ### Draw SNP Line $snpt = $snpp; $snpl = $snpp; $snpt -=1; $snpl +=1; } } ###################### END SNP Info ################################ ####################### Sequence Gaps ############################# @part = &feature_array("misc_feature","note","SequenceGap"); if ($part[0] != -1) { foreach (@part) { $p_start = $_->start(); $p_end = $_->end(); $p_size = $p_end; $p_size -= $p_start; if ($p_size < 20) {next;} if ($p_start < $start && $p_end < $start) {next;} if ($p_start > $end && $p_end > $end) {next;} if ($p_start < $start && $p_end > $end) { $p_draw = 1; } else { $p_draw = 0; } if ($p_start < $start) { $p_start = $start; } if ($p_end > $end) { $p_end = $end; } $p_start -= $start; $p_end -= $start; $p_start /= $factor; $p_end /= $factor; $im->filledRectangle($p_start,70,$p_end,80,$background); ### clear Area $im->line($p_start,70,$p_start,80,$black); # Cap End $im->line($p_end,70,$p_end,80,$black); ### cap end } } ############### End Sequence Holes ###################################### ############################### Legend ################################### $im->line(0,135,750,135,$black); $im->string(gdSmallFont,710,135,"Legend", $black); #################### Gene Legend ####################### $im->string(gdTinyFont,50,138,"Gene",$black); ####### Exons ###### $im->line(75,135,75,150,$black); $im->string (gdTinyFont,84,138,"CDS",$black); $i_start = 137; foreach (@exon_color) { if ($i_start > 147) { next; } $im->line(105,$i_start,115,$i_start,$_); $i_start++; } ###### UTRS #### $im->line(125,135,125,150,$black); $im->string(gdTinyFont,130,138,"UTR",$utr_color_label); $i_start = 137; foreach (@utr_color) { $im->line(150,$i_start,160,$i_start,$_); $i_start++; } ###### Introns ####### $im->line(165,135,165,150,$black); $im->string(gdTinyFont,170,138,"Intron",$black); $i_start = 138; foreach (@intron_color) { $im->line(205,$i_start,215,$i_start,$_); $i_start++; } ####################### SNPs Legend #################### if ($FORM{"validate"} =~ "VERIFIED") { $im->string(gdTinyFont,325,138,"(Validated)",$blue); } $im->string(gdTinyFont,385,138,"SNPs",$black); #flank $im->line(412,135,412,150,$black); $im->string(gdTinyFont,417,138,"Flank",$flank_color); $im->filledRectangle(447,137,457,147,$flank_color); #intron $im->line(462,135,462,150,$black); $im->string(gdTinyFont,467,138,"Intron",$intron_color_label); $im->filledRectangle(500,137,510,147,$intron_color); #nonsyn $im->line(515,135,515,150,$black); $im->string(gdTinyFont,520,138,"Nonsyn",$nonsyn_color_label); $im->filledRectangle(553,137,563,147,$nonsyn_color); #Syn $im->line(568,135,568,150,$black); $im->string(gdTinyFont,573,138,"Synon",$syn_color_label); $im->filledRectangle(600,137,610,147,$syn_color); #UTR $im->line(615,135,615,150,$black); $im->string(gdTinyFont,620,138,"UTR",$utr_color_label); $im->filledRectangle(640,137,650,147,$utr_snp); #Border Image $im->rectangle(0,0,749,149,$black); $im->line(700,0,700,150, $black); binmode STDOUT; ### Binmode ( For DOS mainly) print $im->gif; ### Print the Image Dynamically ( not to file handle) } ################################## End Gene Model Image ######################### ############################################################### ##################### SUB ROUTINES ############################ ############################################################### sub draw_utr { ($utrs,$utre) = @_; $utrs -= 1; if ($utrs > $end && $utre > $end) { next; } if ($utrs < $start && $utre < $start) { next; } if ($utrs < $start) { $utrs = $start; } if ($utre > $end) { $utre = $end; } $utrs -= $start; $utre -= $start; $utre /= $factor; $utrs /= $factor; $im->filledRectangle($utrs, 66, $utre, 84, $background); ### clear anything already drawn at that position $i_start = 70; foreach (@utr_color) { $im->line($utrs,$i_start,$utre,$i_start,$_); $i_start++; } } sub get_seqobj { $in = Bio::SeqIO->new("-file"=>"$genbank_dir/$gene.gb","-format"=>"Genbank"); $seqobj = $in->next_seq(); } sub feature_array { undef(@returns); ($tag) = $_[0]; ($subtag) = $_[1]; ($subvalue) = $_[2]; @all = $seqobj->all_SeqFeatures(); foreach (@all) { if ($_->primary_tag =~ /$tag/) { if ($subtag && $subvalue) { eval{ ($cvalue) = $_->each_tag_value("$subtag"); if ($cvalue =~ /$subvalue/) { push(@returns,$_); } }; } else { push(@returns,$_); } } } if ($returns[0]) { return(@returns); } else { return(-1); } } sub color { ################### Color Pool ##################### $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); $lightgrey = $im->colorAllocate(240,240,240); $lightgrey2 = $im->colorAllocate(180,180,180); $darkgrey = $im->colorAllocate(165,165,165); $darkgrey2 = $im->colorAllocate(150,150,150); $darkgrey3 = $im->colorAllocate(140,140,140); $darkgrey4 = $im->colorAllocate(130,130,130); $darkgrey5 = $im->colorAllocate(120,120,120); $darkgrey6 = $im->colorAllocate(180,180,180); ########## Browns ############ $saddle = $im->colorAllocate(200, 140, 105); $tan = $im->colorAllocate(238,154,73); $lightgoldenrod4=$im->colorAllocate(139,129,76); $peru=$im->colorAllocate(205,133,63); $bisque3=$im->colorAllocate(205,183,158); $sienna4=$im->colorAllocate(139,71,38); $khaki2=$im->colorAllocate(238,230,133); $beige=$im->colorAllocate(245,245,220); $pbrown=$im->colorAllocate(120,80,70); ########## Reds ############## $red = $im->colorAllocate(255,0,0); $lightred = $im->colorAllocate(255,0,0); $red4=$im->colorAllocate(139,0,0); $darkjedired=$im->colorAllocate(150,100,70); $red3=$im->colorAllocate(205,0,0); $orange3=$im->colorAllocate(205,133,0); $darkorange4=$im->colorAllocate(139,69,0); $maroon = $im->colorAllocate(180,100,100); $mediumvioletred=$im->colorAllocate(199,21,133); $indianred4=$im->colorAllocate(139,58,58); $orangered2=$im->colorAllocate(238,64,0); $indianred1=$im->colorAllocate(255,106,106); $firebrick1=$im->colorAllocate(255,48,48); $pinky =$im->colorAllocate(255,0,120); $orange2=$im->colorAllocate(255,215,0); ########## Blues ############# $blue = $im->colorAllocate(0,0,200); $azure1=$im->colorAllocate(240,255,255); $lightsteelblue=$im->colorAllocate(176,196,222); $royalblue1=$im->colorAllocate(72,118,255); $royalblue2=$im->colorAllocate(67,110,238); $slateblue3=$im->colorAllocate(105,89,205); $slateblue2=$im->colorAllocate(122,103,238); $blueviolet=$im->colorAllocate(138,43,226); $dodgerblue=$im->colorAllocate(30,144,255); $midnightblue=$im->colorAllocate(25,25,112); $snpblue = $im->colorAllocate(100,200,255); $darkjedigreen=$im->colorAllocate(30,100,70); $dgreen2=$im->colorAllocate(70,150,60); $utrc1 = $im->colorAllocate(200,100,255); ########## Greens ############ $lightgreen = $im->colorAllocate(100,180,100); $green = $im->colorAllocate(0,255,0); $darkgreen = $im->colorAllocate(180,100,100); $green_yellow=$im->colorAllocate(173,255,47); $darkseagreen1=$im->colorAllocate(193,255,193); $darkolivegreen2=$im->colorAllocate(188,238,104); $olive_drab=$im->colorAllocate(107,142,35); $forest_green=$im->colorAllocate(34,139,34); $lawngreen=$im->colorAllocate(124,252,0); $bgreen = $im->colorAllocate(50,255,150); ########## Yellows ########### $gold2=$im->colorAllocate(255,240,0); $gold = $im->colorAllocate(240,194,0); $yellow=$im->colorAllocate(255,255,0); $lemon_chiffon=$im->colorAllocate(255,250,205); ########## Purples ########### $lightviolet=$im->colorAllocate(240,200,255); $purple = $im->colorAllocate(139,123,139); $darkviolet=$im->colorAllocate(148,0,211); $violetred4=$im->colorAllocate(139,34,82); $violetred2=$im->colorAllocate(200,60,120); $darkjedipurple=$im->colorAllocate(150,70,170); ##################### Scaled Colors ######### $darkblue1 = $im->colorAllocate(65, 145, 172); # 8998 $darkblue2 = $im->colorAllocate(64, 143, 171); # 8668 $darkblue4 = $im->colorAllocate(60, 134, 160); # 5445 $darkblue6 = $im->colorAllocate(53, 121, 143); # 22 $darkblue9 = $im->colorAllocate(63, 141, 166); # 1111 $darkblue10 = $im->colorAllocate(45, 88, 103); # 66 @darkblue = ("$darkblue10","$darkblue9","$darkblue6","$darkblue6","$darkblue4","$darkblue2","$darkblue1","$darkblue6","$darkblue10",); $blue1 = $im->colorAllocate(112, 204, 227); # 1111 $blue2 = $im->colorAllocate(110, 202, 225); # 66 $blue4 = $im->colorAllocate(102, 188, 210); # $blue6 = $im->colorAllocate(89, 167, 186); # $blue9 = $im->colorAllocate(109, 198, 222); # $blue10 = $im->colorAllocate(68, 115, 125); # @blue = ("$blue10", "$blue9", "$blue6", "$blue6", "$blue4", "$blue2", "$blue1", "$blue6", "$blue10"); $deepblue1 = $im->colorAllocate(150, 150, 255); # 1111 $deepblue2 = $im->colorAllocate(120, 120, 225); # 66 $deepblue4 = $im->colorAllocate(100,100, 200); # $deepblue6 = $im->colorAllocate(100, 100, 150); # $deepblue9 = $im->colorAllocate(70, 70, 125); # $deepblue10 = $im->colorAllocate(50, 50, 100); # @deepblue = ("$deepblue10", "$deepblue9", "$deepblue6", "$deepblue6", "$deepblue4", "$deepblue2", "$deepblue1", "$deepblue6", "$deepblue10"); $cblue1 = $im->colorAllocate(200, 200, 255); # 1111 $cblue2 = $im->colorAllocate(180, 180, 240); # 66 $cblue3 = $im->colorAllocate(180, 180, 230); # $cblue4 = $im->colorAllocate(180, 180, 220); # $cblue5 = $im->colorAllocate(180, 180, 210); # $cblue6 = $im->colorAllocate(170, 170, 200); # $cblue7 = $im->colorAllocate(150, 150, 190); # 66 $cblue8 = $im->colorAllocate(150,150, 180); # $cblue9 = $im->colorAllocate(130, 130, 170); # $cblue10 = $im->colorAllocate(120, 120, 160); # $cblue11 = $im->colorAllocate(120, 120, 150); # $cblue12 = $im->colorAllocate(100, 100, 140); # 66 $cblue13 = $im->colorAllocate(100,100, 130); # $cblue14 = $im->colorAllocate(90, 90, 120); # $cblue15 = $im->colorAllocate(70, 70, 110); # $cblue16 = $im->colorAllocate(70, 70, 100); # $cblue17 = $im->colorAllocate(30, 30, 90); # 66 $cblue18 = $im->colorAllocate(30,30, 80); # $cblue19 = $im->colorAllocate(30, 30, 70); # @cblue = ("$cblue1","$cblue2","$cblue3","$cblue4","$cblue5","$cblue6","$cblue7","$cblue8","$cblue9","$cblue10","$cblue11","$cblue12","$cblue13","$cblue14","$cblue15","$cblue16","$cblue17"); @cblue = reverse(@cblue); $sblue1 = $im->colorAllocate(100, 180, 240); # 1111 $sblue2 = $im->colorAllocate(99, 180, 225); # 66 $sblue4 = $im->colorAllocate(80, 160, 240); # $sblue6 = $im->colorAllocate(50, 140, 180); # $sblue9 = $im->colorAllocate(95, 150, 225); # $sblue10 = $im->colorAllocate(50, 90, 118); # @sblue = ("$sblue10", "$sblue9", "$sblue6", "$sblue6", "$sblue4", "$sblue2", "$sblue1", "$sblue6", "$sblue10"); $white1 = $im->colorAllocate(248, 248, 248); # 8998 $white2 = $im->colorAllocate(245, 245, 245); # 8668 $white4 = $im->colorAllocate(227, 227, 227); # 5445 $white6 = $im->colorAllocate(203, 203, 203); # 22 $white9 = $im->colorAllocate(237, 237, 237); # 1111 $white10 = $im->colorAllocate(121, 121, 121); # @white = ("$white10", "$white9", " $white6", " $white6", " $white4", " $white2", " $white1", " $white6", " $white10"); $cwhite1 = $im->colorAllocate(255, 255, 255); # 8998 $cwhite2 = $im->colorAllocate(230, 230, 230); # 8668 $cwhite4 = $im->colorAllocate(200, 200, 200); # 5445 $cwhite6 = $im->colorAllocate(175, 175, 175); # 22 $cwhite9 = $im->colorAllocate(150, 150, 150); # 1111 $cwhite10 = $im->colorAllocate(125, 125, 125); # @cwhite = ("$cwhite9", "$cwhite4", " $cwhite1", " $cwhite2", " $cwhite4", " $cwhite4", " $cwhite6", " $cwhite6", " $cwhite10"); @cwhite = reverse(@cwhite); $grey11 = $im->colorAllocate(180, 180, 180); $grey1 = $im->colorAllocate(150, 150, 150); # 8998c $grey2 = $im->colorAllocate(130, 130, 130); # 8668 $grey4 = $im->colorAllocate(100, 100, 100); # 5445 $grey6 = $im->colorAllocate(70, 70, 70); # 22 $grey9 = $im->colorAllocate(30, 30, 30); # 1111 $grey10 = $im->colorAllocate(0, 0, 0); # @grey = ("$grey9", " $grey6", " $grey4", " $grey2", " $grey1", " $grey1", "$grey2"); # @grey = reverse(@grey); $green1 = $im->colorAllocate(147, 219, 151); # 8998 $green2 = $im->colorAllocate(145, 218, 149); # 8668 $green4 = $im->colorAllocate(135, 204, 140); # 5445 $green6 = $im->colorAllocate(121, 182, 124); # 22 $green9 = $im->colorAllocate(143, 212, 147); # 1111 $green10 = $im->colorAllocate(89, 126, 91); # 66 @green = ("$green10", " $green9", " $green6", " $green6", " $green4", " $green2", " $green1", " $green1", "$green2"); $green1 = $im->colorAllocate(100, 255, 100); # 8998 $green2 = $im->colorAllocate(100, 225, 100); # 8668 $green4 = $im->colorAllocate(100, 200, 100); # 5445 $green6 = $im->colorAllocate(100, 175, 100); # 22 $green9 = $im->colorAllocate(100, 150, 100); # 1111 $green10 = $im->colorAllocate(89, 125, 91); # 66 @green2 = ("$green10", " $green10", " $green9", " $green9", " $green6", " $green4", " $green2", "$green2", "$green1", "$green1", "$green4"); # @green2 = reverse(@green2); $purple1 = $im->colorAllocate(200, 150, 200); # 8998 $purple2 = $im->colorAllocate(180, 140, 180); # 8668 $purple4 = $im->colorAllocate(160, 130, 160); # 5445 $purple6 = $im->colorAllocate(140, 120, 140); # 22 $purple9 = $im->colorAllocate(120, 75, 120); # 1111 $purple10 = $im->colorAllocate(100, 50, 100); # 66 @purple = ("$purple10", " $purple9", " $purple6", " $purple6", " $purple4", " $purple2", " $purple1", " $purple6", " $purple10"); $realblue1 = $im->colorAllocate(55, 63, 138); # $realblue2 = $im->colorAllocate(140,150,180); # $realblue2 = $im->colorAllocate(124, 132, 207); # $realblue3 = $im->colorAllocate(158, 185, 202); # $realblue4 = $im->colorAllocate(174, 201, 218); # $realblue5 = $im->colorAllocate(186, 216, 227); # $realblue6 = $im->colorAllocate(177, 208, 254); # $realblue7 = $im->colorAllocate(161, 192, 238); # $realblue8 = $im->colorAllocate(149, 183, 220); # $realblue7 = $im->colorAllocate(161, 192, 238); # $realblue9 = $im->colorAllocate(170, 202, 249); # $realblue10 = $im->colorAllocate(188, 224, 246); # $realblue11 = $im->colorAllocate(203, 241, 254); # $realblue12 = $im->colorAllocate(210, 250, 255); # $realblue13 = $im->colorAllocate(204, 241, 249); # $realblue14 = $im->colorAllocate(192, 229, 237); # $realblue15 = $im->colorAllocate(120, 143, 151); $realblue16 = $im->colorAllocate(146, 169, 177); # $realblue17 = $im->colorAllocate(187, 189, 201); # $realblue18 = $im->colorAllocate(213, 215, 227); # # @realblue = ("$realblue1","$realblue2","$realblue3","$realblue4","$realblue5","$realblue6","$realblue7","$realblue8","$realblue7","$realblue9","$realblue10","$realblue11","$realblue12","$realblue13","$realblue14","$realblue15","$realblue16","$realblue17","$realblue18"); #@realblue2 = ("$realblue1","$realblue2","$realblue3","$realblue4","$realblue5","$realblue6","$realblue7","$realblue8","$realblue7","$realblue9","$realblue10","$realblue11","$realblue12","$realblue13","$realblue14"); @realblue2 = ("$realblue2","$realblue2","$realblue2","$realblue3","$realblue8","$realblue7","$realblue6","$realblue10","$realblue10","$realblue11","$realblue11","$realblue12","$realblue13","$realblue18","$realblue8"); $greyblue = $im->colorAllocate(140,150,180); }