$type ||= Maasha::Seq::seq_guess_type( $entry1->[ SEQ ] );
- $blosum = blosum_read() if $type =~ /protein/;
+ $blosum = blosum_read() if $type eq "PROTEIN";
for ( $i = 0; $i < length $entry1->[ SEQ ]; $i++ )
{
$type = Maasha::Seq::seq_guess_type( $seq1 );
- if ( $type =~ /rna/i ) {
+ if ( $type eq "RNA" ) {
$seq2 = Maasha::Seq::rna_revcomp( $seq1 );
- } elsif ( $type =~ /dna/i ) {
+ } elsif ( $type eq "DNA" ) {
$seq2 = Maasha::Seq::dna_revcomp( $seq1 );
} else {
Maasha::Common::error( qq(Bad sequence type->$type) );
Maasha::Common::error( 'BP_WWW not set in environment' ) if not $ENV{ 'BP_WWW' };
- @dirs = Maasha::Filesys::ls_dirs( "$ENV{ 'BP_WWW' }/Data/Users/$user/$clade/$genome" );
+ if ( $user and $clade and $genome ) {
+ @dirs = Maasha::Filesys::ls_dirs( "$ENV{ 'BP_WWW' }/Data/Users/$user/$clade/$genome" );
+ }
@assemblies = grep { $_ !~ /\/\.\.?$/ } @dirs;
Maasha::Common::error( 'BP_WWW not set in environment' ) if not $ENV{ 'BP_WWW' };
- @dirs = Maasha::Filesys::ls_dirs( "$ENV{ 'BP_WWW' }/Data/Users/$user/$clade/$genome/$assembly" );
+ if ( $user and $clade and $genome and $assembly ) {
+ @dirs = Maasha::Filesys::ls_dirs( "$ENV{ 'BP_WWW' }/Data/Users/$user/$clade/$genome/$assembly" );
+ }
@contigs = grep { $_ !~ /\/\.\.?$/ } @dirs;
$SIG{ 'TERM' } = \&sig_handler;
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
sub status_set
{
my ( $time_stamp, $script, $user, $pid, $file, $fh );
push @args, "-F";
push @args, "-l $options->{ 'word_size' }";
push @args, "-maxmatch";
- push @args, "-n" if not Maasha::Seq::seq_guess_type( $entries1->[ 0 ]->[ 1 ] ) eq "protein";
+ push @args, "-n" if not Maasha::Seq::seq_guess_type( $entries1->[ 0 ]->[ 1 ] ) eq "PROTEIN";
push @args, "-b" if $options->{ "direction" } =~ /^b/;
push @args, "-r" if $options->{ "direction" } =~ /^r/;
$type = Maasha::Seq::seq_guess_type( $entries->[ 0 ]->[ 1 ] );
- if ( $type =~ /^p/i ) {
+ if ( $type eq "PROTEIN" ) {
$bit_max = 4;
} else {
$bit_max = 2;
PROTEIN => [ qw(F L S Y C W P H Q R I M T N K V A D E G) ],
);
- if ( exists $alph_hash{ $type } ) {
- $alph = $alph_hash{ $type };
+ if ( exists $alph_hash{ uc $type } ) {
+ $alph = $alph_hash{ uc $type };
} else {
die qq(ERROR: Unknown alphabet type: "$type"\n);
}
package Maasha::XHTML;
-# Copyright (C) 2005 Martin A. Hansen.
+# Copyright (C) 2005-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ISA = qw( Exporter );
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SIGNAL HANDLERS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+use sigtrap qw( die normal-signals stack-trace any error-signals );
+
+my $WARNINGS = 0;
+
+$SIG{ '__DIE__' } = \&sig_die;
+$SIG{ '__WARN__' } = \&sig_warn;
+
+
+sub sig_die
+{
+ my ( $sig, # signal from the %SIG
+ ) = @_;
+
+ my ( @html );
+
+ push @html, &cgi_header;
+ push @html, p( txt => "ERROR: $sig" );
+
+ $WARNINGS++;
+
+ print "$_" for @html;
+}
+
+
+sub sig_warn
+{
+ my ( $sig, # signal from the %SIG
+ ) = @_;
+
+ my ( @html );
+
+ push @html, &cgi_header if $WARNINGS == 0;
+ push @html, p( txt => "WARNING: $sig" );
+
+ $WARNINGS++;
+
+ print "$_" for @html;
+}
+
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HEADERS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
my ( @html );
- push @html, &cgi_header if $args{ "cgi_header" };
+ push @html, &cgi_header if $args{ "cgi_header" } and $WARNINGS == 0;
push @html, &doc_type;
push @html, &head_beg;
push @html, &title( $args{ "title" } ) if $args{ "title" };
print "$_\n" foreach @html;
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<