4 # New version of script as the original (OO perl) version
5 # doesn't work on the new cluster. As it's a very simple
6 # parser it can be easily re-implemented
21 $file or die "no --file argument\n";
23 open(my $FH, $file) or die "$!";
27 # jnet concise file is a series of outputs preceeded by
28 # a definition separated by ':' on each line e.g.:
30 # align1;QUERY:M,F,L,A,Q,E,I,I,R,K,K,R,D,G,H,A,L,S,D,E,E,I,...,
31 # jpred:-,-,H,H,H,H,H,H,H,H,H,H,-,-,-,-,-,-,H,H,H,H,H,H,H,...,
33 # Find the two lines above and extract the query sequence and the
38 my ($def, $data) = split /:/, $_ or next;
40 if ($def eq 'jnetpred') {
42 $pred =~ s/\,//g; # remove all the ',' in prediction
44 if ($def =~ /align1/) {
45 next if $query; # skip any hits to align1x sequences. We only want the 1st hit.
47 $query =~ s/\,//g; # remove all ',' in sequence
51 if (!$query || !$pred) {
52 die "no jpred output or query sequence found in $file";
55 # colour the predictions
56 $pred =~ s{([H]+)}{<font color="#e90055">$1</font>}g;
57 $pred =~ s{([E]+)}{<font color="#ffa800">$1</font>}g;
60 open(my $OUT, ">$out") or die "$out: $!";
65 my $html = '<?xml version="1.0" encoding="iso-8859-1"?>
66 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
67 <html lang="en-GB" xml:lang="en-GB">
68 <head><title>Simple JNet Output</title>
69 <link rel="stylesheet" type="text/css" href="http:/webservices:12345/jpred.css" />
70 </head><body><pre><code>';
73 $html .= "</code></pre>
74 $JPREDFOOT</body></html>";