#!/tools/bin/perl ##################################################################### # grape.cgi - checks grid alignment between slides, works # with QuantArray, Dapple and DigitalGENOME output files # # Checks first line in quantitation file to determine spotfinder used, # should ID QuantArray and digitalGENOME correctly, assumes anything # else is dapple # # Determines if there is a better alignment by shifting the grid # up to 1/8 of total # of spots in each dimension x and y # # Created: 2001 Bruz Marzolf # # Last Modified: May 21, 2003 # ##################################################################### use Benchmark; use strict; use CGI qw(:standard); use PDL; use PDL::Fit::Polynomial; require 'quantitation.pl'; my $DEBUG = 0; # list of quantitation files my @quantFiles; $| = 1; # flush print output immediately print header, start_html( -title=>'Institute for Systems Biology - GrAPE'); print_grape_header(); if ( param("Check") ) { print_table(); } elsif ( param("Find Files") ) { get_quant_list(); choose_files(); } else { #print_grape_info(); print_login_page(); } print_grape_footer(); print end_html; ######################### # Form Subs ######################### sub print_grape_info { print << "EndInfo"

GrAPE is a tool that analyzes microarray quantitation data to check whether spotfinding has been done correctly. Spotfinding


EndInfo } # user either selects their APES account name, or just a # range of slide numbers to look at. sub print_login_page { print start_form; #print ""; print h3("Choose a range of slide numbers:"); print p("In this example, pick '5367-5370'
" . "Note that two of these are intentionally
" . "misaligned for demonstration purposes
"); print textfield("slide_range"); print p(submit("Find Files")); print end_form; } # choose reference and test files, either those in user's directory # or in /net/arrays/Quantitation by serial number sub choose_files { param("selected_files",""); #This now clears the list print start_form(); print hidden("slide_range",param("slide_range")); #print ""; print p("You should check one especially good slide for proper
", "grid alignment by eye, specify that slide here:
", "\(For this example, pick 05367.csv as the reference
", "and the other three for comparison\)
"); print popup_menu( -NAME => "ref_file", -VALUES => \@quantFiles, ); print p("Choose the files you want to compare with(for PC uses CTRL-click,
", "for MAC users APPLE-click):"); print scrolling_list( -NAME => "selected_files", -VALUES => \@quantFiles, -SIZE => 10, -MULTIPLE => 1, ); print p(submit("Check")), end_form; } # final page, outputs tables with grid info sub print_table { my @quant; my ( $t0, $t1 ); my @selectedFiles = param("selected_files"); my $refFile = param("ref_file"); unshift @selectedFiles, $refFile; $t0 = new Benchmark; for my $n ( 0..$#selectedFiles ) { readSpotFile( $selectedFiles[$n], \%{$quant[$n]} ); } $t1 = new Benchmark; showTimeDiff( $t0, $t1, "read files" ); $t0 = new Benchmark; findMaxRowCol( \@quant, $#selectedFiles ); $t1 = new Benchmark; showTimeDiff( $t0, $t1, "find max row & col" ); #print ""; $t0 = new Benchmark; checkAlign( \@quant, $#selectedFiles, \@selectedFiles, "html" ); $t1 = new Benchmark; showTimeDiff( $t0, $t1, "check alignment" ); print start_form(); print ""; my $db_name = time; my $opt = $#selectedFiles - 1; #for now, use opt as 1 less than # slides my $directory = param("directory"); print end_form; } ######################## # Subs that do the work ######################## # find files in /net/arrays/Quantitation sub get_quant_list { my $slide_range = param("slide_range"); my $low_slide; my $high_slide; if($slide_range =~ /\A(\d+)\-(\d+)\Z/) { $low_slide = $1; $high_slide = $2; } else { print "ERROR: you must enter a range of numbers!"; exit; } my $db_name = time; for my $i ($low_slide..$high_slide) { push @quantFiles, glob("../../html/software/GrAPE/grape_demo_files/*$i*"); } @quantFiles = sort alphanum @quantFiles; close LIST; } # sort ascending alphanumerically sub alphanum { $a <=> $b } # html header sub print_grape_header { print << "EndHdr" Middle School Science


Home


Demonstration

Download Source

EndHdr } sub print_grape_footer { print << "EndFtr"

EndFtr }