#!/usr/bin/perl # Program to generate the header for a GenePix GAL file # Chris Seidel December 2000 use CGI qw(:standard); $q = new CGI; if( $q->param() ){ #check for input if( $q->param('format') eq "tab" ){ print header, "
"; &processForm; print ""; }else{ print "Content-type: application/x-excel\n\n"; &processForm; } }else{ &myForm; } sub myForm { print header, h3('GenePix Header Generator'); print <
Chris Seidel ENDBLOCK } sub processForm { #I always feel compelled to exchange variables into more useful form, neurotic. $blocks = $q->param('blocks'); $blocks_across = $q->param('blocks_across'); $blocks_down = $q->param('blocks_down'); $data_columns = $q->param('data_columns'); $pin_offset = $q->param('pin_offset'); $x_origin = $q->param('x_origin'); $y_origin = $q->param('y_origin'); $feature_diam = $q->param('f_diam'); $x_features = $q->param('x_features'); $x_spacing = $q->param('x_spacing'); $y_features = $q->param('y_features'); $y_spacing = $q->param('y_spacing'); #I've left out the URL line for now. $header_records = 3 + $blocks; print "ATF\t1.0\n"; print $header_records, "\t", $q->param('data_columns'), "\n"; print "Type=GenePix ArrayList V1.0\n"; print "BlockCount=", $blocks, "\n"; print "BlockType=0", "\n"; #print out the grid descriptions and locations $i=1; $x_shift = 0; $y_shift = 0; for( $j=0; $j<$blocks_down; ++$j ){ for( $k=0; $k<$blocks_across; ++$k ){ print "Block", $i, "="; print $x_origin + $x_shift,", ", $y_origin + $y_shift, ", "; print $feature_diam, ", "; print $x_features, ", "; print $x_spacing, ", "; print $y_features, ", "; print $y_spacing; print "\n"; # $x_shift += $x_features * $x_spacing + $pin_offset; $x_shift = ($k+1) * $pin_offset; #print "x_shift: $x_shift\n"; ++$i; } $x_shift = 0; # $y_shift += $y_features * $y_spacing + $pin_offset; $y_shift = ($j+1) * $pin_offset; } # add place holders for extra columns $extra_columns = "\t*\t*"; # use * for place holders if($data_columns > 5){ for($i=5; $i<$data_columns; ){ ++$i; $extra_column_names .= "\tColumn$i"; $extra_columns .= "\t*"; } }else{ $extra_column_names = ""; } print "Block\tRow\tColumn\tID\tName", $extra_column_names, "\n"; #print out the block row col numbers if chosen if( $q->param('generate_list') eq "on" ){ $block = 1; $row = 1; $col = 1; for( $j=0; $j<$blocks_down; ++$j ){ for( $k=0; $k<$blocks_across; ++$k ){ for($l=0; $l<$y_features; ++$l){ for($m=0; $m<$x_features; ++$m){ print "$block", "\t", "$row", "\t", "$col", $extra_columns, "\n"; ++$col; } $col = 1; ++$row; } $row = 1; ++$block; } } } }