#!/usr/local/bin/perl ############################################################################### # $Id: peptideSearch.cgi 4280 2006-01-13 06:02:10Z 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 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::TabMenu; use SBEAMS::Glycopeptide; use SBEAMS::Glycopeptide::Settings; use SBEAMS::Glycopeptide::Tables; use SBEAMS::Glycopeptide::Get_glyco_seqs; use SBEAMS::Glycopeptide::Glyco_query; # Global Variables ############################################################################### # my $sbeams = new SBEAMS::Connection; $sbeams->setSBEAMS_SUBDIR($SBEAMS_SUBDIR); my $sbeamsMOD = new SBEAMS::Glycopeptide; $sbeamsMOD->setSBEAMS($sbeams); #my $glyco_query_o = new SBEAMS::Glycopeptide::Glyco_query; #$glyco_query_o->setSBEAMS($sbeams); main(); ############################################################################### # Main Program: # # Call $sbeams->Authentication and stop immediately if authentication # fails else continue. ############################################################################### sub main { my $current_username; # Authenticate and exit if a username is not returned $current_username = $sbeams->Authenticate( permitted_work_groups_ref => ['Glycopeptide_user', 'Glycopeptide_admin', 'Glycopeptide_readonly'], allow_anonymous_access=>0 ) || exit; my $current = $sbeamsMOD->get_current_build(); $log->debug( "Current build is $current" ); #### Read in the default input parameters my $params = process_params(); ## get project_id to send to HTMLPrinter display my $project_id = $sbeams->getCurrent_project_id(); my $content; if ( !$params->{apply_action} ) { $content = get_settings_form( $params ); } elsif ( $params->{apply_action} eq 'save_settings' ) { $content = process_form( $params ); } else { $sbeams->set_page_message( type => 'Error', msg => 'Unknown action specified' ); $content = get_settings_form( $params ); } $sbeamsMOD->display_page_header(project_id => $project_id); print "$content"; $sbeamsMOD->display_page_footer(); } # end main sub process_form { my $params = shift; my $build_id = $params->{unipep_build_id}; $log->debug( "Do we have a build_id? $build_id" ); if ( $build_id ) { $sbeamsMOD->set_current_build( build_id => $build_id ); $sbeams->set_page_message( type => 'Info', msg => 'Build settings were saved, build_id is ' . $build_id ); } else { $sbeams->set_page_message( type => 'Error', msg => 'Must specify build_id' ); } return ( get_settings_form( $params ) ); } # Generates a form to allow user to choose various UniPep settings sub get_settings_form { my $params = shift; my $build_id = $params->{unipep_build_id} || $sbeamsMOD->get_current_build(); my $content = $sbeams->getGifSpacer(800) . "\n"; $content .= "