#!/usr/local/bin/perl
###############################################################################
# $Id: peptideSearch.cgi 4670 2006-04-22 01:54:05Z dcampbel $
#
# SBEAMS is Copyright (C) 2000-2005 Institute for Systems Biology
# This program is governed by the terms of the GNU General Public License (GPL)
# version 2 as published by the Free Software Foundation. It is provided
# WITHOUT ANY WARRANTY. See the full description of GPL terms in the
# LICENSE file distributed with this software.
###############################################################################
###############################################################################
# Get the script set up with everything it will need
###############################################################################
use strict;
use vars qw ($q $sbeams $sbeamsMOD $PROG_NAME
$current_contact_id $current_username $glyco_query_o);
use lib qw (../../lib/perl);
use CGI::Carp qw(fatalsToBrowser croak);
use Data::Dumper;
use SBEAMS::Connection qw($q $log);
use SBEAMS::Connection::Settings;
use SBEAMS::Connection::Tables;
use SBEAMS::Connection::DataTable;
use SBEAMS::Glycopeptide;
use SBEAMS::Glycopeptide::Settings;
use SBEAMS::Glycopeptide::Tables;
use SBEAMS::Glycopeptide::Get_glyco_seqs;
use SBEAMS::Glycopeptide::Glyco_query;
###############################################################################
# Global Variables
###############################################################################
#
$sbeams = new SBEAMS::Connection;
$sbeamsMOD = new SBEAMS::Glycopeptide;
$sbeamsMOD->setSBEAMS($sbeams);
$glyco_query_o = new SBEAMS::Glycopeptide::Glyco_query;
$glyco_query_o->setSBEAMS($sbeams);
$sbeams->setSBEAMS_SUBDIR($SBEAMS_SUBDIR);
my $base_url = "$CGI_BASE_DIR/$SBEAMS_SUBDIR/massSearch";
{ # Main
# Authenticate or exit
exit unless ($current_username = $sbeams->Authenticate(
# permitted_work_groups_ref=>['Glycopeptide_user','Glycopeptide_admin', 'Glycopeptide_readonly'],
# connect_read_only=>1,
allow_anonymous_access=>1,
));
#### Read in the default input parameters
my %params;
$sbeams->parse_input_parameters( q=>$q, parameters_ref=>\%params );
$sbeams->processStandardParameters(parameters_ref=>\%params);
if ( $params{unipep_build_id} ) {
my $build_id = $sbeamsMOD->get_current_build( build_id => $params{unipep_build_id} );
if ( $build_id != $params{unipep_build_id} ) {
$sbeams->set_page_message( type => 'Error', msg => 'You must log in to access specified build' );
}
}
## get project_id to send to HTMLPrinter display
my $project_id = $sbeams->getCurrent_project_id();
my $page = $sbeams->getGifSpacer( 800 ) . " \n";
#### Decide what action to take based on information so far
if( $params{action} =~ /^search$/ ) {
$page .= print_form( \%params );
$page .= run_search( \%params );
} elsif( $params{action} =~ /^download$/ ) {
my $header = $sbeams->get_http_header( mode => 'tsvfull', filename => 'search_results.xls' );
print $header;
print run_search( \%params );
exit;
} else {
$page .= print_form( \%params );
}
# Display page
$sbeamsMOD->display_page_header(project_id => $project_id);
# $sbeams->printStyleSheet();
print $page;
my $url = $q->self_url();
$sbeamsMOD->display_page_footer();
} # end main
sub get_download_form {
my $params = shift;
my $url = $q->url( -full => 1 );
my $form = "