[Bio] / FortyEight / WebPage / MetaGenome.pm Repository:
ViewVC logotype

Annotation of /FortyEight/WebPage/MetaGenome.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (view) (download) (as text)

1 : paarmann 1.1 package WebPage::MetaGenome;
2 :    
3 :     use warnings;
4 :     use strict;
5 :    
6 :     use Carp qw( confess );
7 : paarmann 1.4 use base qw( WebApp::WebPage WebPage::JobDetails );
8 : paarmann 1.1
9 :     use Table;
10 :    
11 :     use Job48;
12 :    
13 :     1;
14 :    
15 :     =pod
16 :    
17 :     =head1 NAME
18 :    
19 :     MetaGenome - an instance of WebPage which displays a detailed description of a MetaGenome job
20 :    
21 :     =head1 DESCRIPTION
22 :    
23 :     TODO
24 :    
25 :     =head1 METHODS
26 :    
27 :     =over 4
28 :    
29 :     =item * B<output> ()
30 :    
31 :     Returns the html output of the page.
32 :    
33 :     =cut
34 :    
35 :     sub output {
36 :     my ($self) = @_;
37 :    
38 :     $self->title('Annotation Server - Jobs Details');
39 :    
40 :     my $cgi = $self->application->cgi;
41 :     my $content = '';
42 :    
43 :     # sanity check on job
44 :     my $id = $self->application->cgi->param('job');
45 : paarmann 1.6 my $job = Job48->new( $id, $self->application->session->user );
46 : paarmann 1.1 unless ($job) {
47 :     $self->application->error("Invalid job id given (id='$id').");
48 :     return $content;
49 :     }
50 :    
51 :     # check if a user is logged in
52 :     if ($self->application->authorized(1)) {
53 :    
54 :     $self->title('Annotation Server - Job Details #'.$id);
55 :     $content = $self->details( $job );
56 :     }
57 :    
58 :     # catch errors
59 :     if ($self->application->error) {
60 :     $content = "<p>An error has occured: ".$self->application->error().
61 : paarmann 1.2 "<br/>Please return to the <a href='".$self->application->url."?page=Login'>login page</a>.</p>";
62 : paarmann 1.1 }
63 :    
64 :     return $content;
65 :     }
66 :    
67 :    
68 :    
69 :     sub details {
70 :     my ($self, $job) = @_;
71 :    
72 :     # start content
73 :     my $content = "<h1>Job Details #".$job->id."</h1>";
74 :    
75 :     my ($img, $status_text);
76 :    
77 :     my $formats = { 'genbank' => 'GenBank',
78 :     'embl' => 'embl',
79 :     'GTF' => 'GTF',
80 :     'gff' => 'GFF3' };
81 :     my @values = keys(%$formats);
82 :    
83 :     # add a few final urls
84 :     if ($job->meta->get_metadata('status.final') and
85 :     $job->meta->get_metadata('status.final') eq 'complete') {
86 :     $content .= '<p> &raquo; <a target="_blank" href="index.cgi?action=ShowOrganism&initial=1&genome='.
87 :     $job->genome_id.'&job='.$job->id.'">Browse annoted genome in SEED Viewer</a></p>';
88 :     $content .= '<form action="'.$self->application->url.'" method="post">'.
89 :     '<p> &raquo; Export the annotated genome as '.
90 :     "<input type=hidden name=page value=ExportGenome >".
91 :     "<input type=hidden name=job value=".$job->id." >".
92 :     $self->application->cgi->popup_menu( -name => 'format', -default => 'genbank',
93 :     -values => \@values, -labels => $formats, ).
94 :     $self->application->cgi->submit( -name => 'Go!' ).
95 :     '</form></p>';
96 : paarmann 1.5 $content .= '<p> &nbsp; <em> (Exporting the genome may take a while. A save file dialog will appear once it is done.)</em></p>';
97 : paarmann 1.1 }
98 : paarmann 1.5
99 :     $content .= "<p> &raquo <a href='".$self->application->url."?page=Jobs'>Back to the Jobs Overview</a></p>";
100 : paarmann 1.1
101 :     # upload
102 :     ($img, $status_text) = $self->get_image_and_text_for_status($job->meta->get_metadata('status.uploaded'),
103 :     'Genome Upload');
104 :     $content .= "<p id='section_bar'><img src='$img'>$status_text</p>";
105 :     $content .= "<table>";
106 :     $content .= "<tr><th>Genome:</th><td>".$job->genome_id." - ".$job->genome_name."</td></tr>";
107 :     $content .= "<tr><th>Job:</th><td> #".$job->id."</td></tr>";
108 :     $content .= "<tr><th>User:</th><td>".$job->user."</td></tr>";
109 :     $content .= "<tr><th>Date:</th><td>".localtime($job->meta->get_metadata('upload.timestamp'))."</td></tr>";
110 :     $content .= "</table>";
111 :    
112 :     # preprocessing
113 :     ($img, $status_text) = $self->get_image_and_text_for_status($job->meta->get_metadata('status.preprocess'),
114 :     'Preprocessing');
115 :     $content .= "<p id='section_bar'><img src='$img'>$status_text</p>";
116 : paarmann 1.3
117 :     # build table with preprocess statistics data
118 :     my $stats = [[ 'preprocess.count_proc.num_seqs', 'Number of sequences' ],
119 :     [ 'preprocess.count_proc.total', 'Total sequence length' ],
120 :     [ 'preprocess.count_proc.average', 'Average read length' ],
121 :     [ 'preprocess.count_proc.longest_seq', 'Longest sequence id' ],
122 :     [ 'preprocess.count_proc.longest_len', 'Longest sequence length' ],
123 :     [ 'preprocess.count_proc.shortest_seq', 'Shortest sequence id' ],
124 :     [ 'preprocess.count_proc.shortest_len', 'Shortest sequence length' ],
125 :     ];
126 :    
127 :     my $statistics = '';
128 :     foreach my $s (@$stats) {
129 :     my $value = $job->meta->get_metadata($s->[0]);
130 :     if ($value) {
131 :     $statistics .= "<tr><th>".$s->[1].":</th><td>".$value."</td></tr>";
132 :     }
133 :     }
134 :    
135 :     if ($statistics) {
136 :     $content .= "<table> $statistics </table>";
137 :     }
138 : paarmann 1.1
139 :     # blast sim
140 : paarmann 1.2 ($img, $status_text) = $self->get_image_and_text_for_status($job->meta->get_metadata('status.sims'),
141 :     'Similarity computation');
142 : paarmann 1.1 $content .= "<p id='section_bar'><img src='$img'>$status_text</p>";
143 :    
144 :     # blast phylo
145 : paarmann 1.2 ($img, $status_text) = $self->get_image_and_text_for_status($job->meta->get_metadata('status.sims_postprocess'),
146 :     'Similarity postprocessing');
147 : paarmann 1.1 $content .= "<p id='section_bar'><img src='$img'>$status_text</p>";
148 :    
149 :     ($img, $status_text) = $self->get_image_and_text_for_status($job->meta->get_metadata('status.final'),
150 :     'Final Assigment');
151 :     $content .= "<p id='section_bar'><img src='$img'>$status_text</p>";
152 :    
153 :     return $content;
154 :    
155 :     }
156 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3