11 use CXGN
::Page
::FormattingHelpers qw
/page_title_html/;
12 use SGN
::IntronFinder
::Homology
;
14 my $d = CXGN
::Debug
->new();
16 my $page = CXGN
::Page
->new( "Intron Finder Results", "Emil" );
18 my $temp_file_path = $page->path_to($page->tempfiles_subdir('intron_detection'));
20 $page->add_style( text
=> <<EOS );
27 my ( $input, $blast_e_val ) = $page->get_arguments( "genes", "blast_e_value" );
28 $input =~ s/\r//g; #remove weird line endings
29 $input =~ s/^\s+|\s+$//g; #< trim whitespace
30 $input = ">web_sequence\n$input" unless $input =~ /^>/;
32 $blast_e_val =~ s/(^\s*|\s*)//g;
33 if ( $blast_e_val !~ m/^\d+(e-\d+)?$/ ) {
39 'unfound_seq_id' => ''
44 my $out_file = File
::Temp
->new(
45 TEMPLATE
=> 'intron-finder-output-XXXXXX',
46 DIR
=> $temp_file_path,
48 $out_file->close; #< can't use this filehandle
51 print page_title_html
("Intron Finder Results");
53 $d->d("Runninge the intron finder command...\n");
55 my ($protein_db) = CXGN
::BlastDB
->search( file_base
=> 'ath/ATH_pep' ) or die "could not find ath/ATH_pep BLAST database";
57 my $gene_feature_file =
58 ( $page->get_conf('intron_finder_database')
59 || die 'no conf var intron_finder_database defined!' )
60 . "/SV_gene_feature.data";
62 -f
$gene_feature_file or die "gene feature file '$gene_feature_file' not found";
66 open my $input_fh, '<', \
$input or die $!;
67 open my $output_fh, '>', \
$output or die $!;
69 SGN
::IntronFinder
::Homology
::find_introns_txt
75 $protein_db->full_file_basename,
79 print qq|<a href
="find_introns.pl">Return to search page
</a><br /><br
/>|;
83 # show there was an error and link back to the entry page
84 # possible arguments: e_bad => 0|1, seq_bad => 0|1, seq_notindb => 0|1,
85 # unfound_seq_id => seq_id
88 my ( $page, %errors ) = @_;
90 $page->add_style( text
=> "p.error {font-weight: bold}" );
92 print page_title_html
("Bad Input");
93 if ( $errors{e_bad
} ) {
95 "<p class=\"error\">E-value for blast should be an integer or in xe-xx format.</p>";
97 if ( $errors{seq_bad
} ) {
98 print "<p class=\"error\">Please enter your query in FASTA format.</p>";
100 elsif ( $errors{seq_notindb
} ) {
102 "<p class=\"error\">EST identifier $errors{unfound_seq_id} could not be found in the database. Please enter a DNA sequence for it.</p>";
105 print "<p><a href=\"find_introns.pl\">Go back</a> and try again.</p>";