X-Git-Url: http://source.jalview.org/gitweb/?p=jpred.git;a=blobdiff_plain;f=websoft%2Fbin%2Fconcise2simplehtml;fp=websoft%2Fbin%2Fconcise2simplehtml;h=fbdc770daca7666ca9e11703d34dba11320eff75;hp=0000000000000000000000000000000000000000;hb=443c228bf0712d71e7fa34b5a2dc4b2b2e79f13f;hpb=9aa768067094f24f46f273077f867348e6143711 diff --git a/websoft/bin/concise2simplehtml b/websoft/bin/concise2simplehtml new file mode 100755 index 0000000..fbdc770 --- /dev/null +++ b/websoft/bin/concise2simplehtml @@ -0,0 +1,78 @@ +#!/usr/bin/perl + +## CC 18/05/2006 +# New version of script as the original (OO perl) version +# doesn't work on the new cluster. As it's a very simple +# parser it can be easily re-implemented + +use strict; +use warnings; +use Getopt::Long; +use Jpred; + +my $file; +my $out; + +GetOptions( + 'file=s' => \$file, + 'out=s' => \$out +) or die $!; + +$file or die "no --file argument\n"; + +open(my $FH, $file) or die "$!"; +my $query; +my $pred; +while(<$FH>) { + # jnet concise file is a series of outputs preceeded by + # a definition separated by ':' on each line e.g.: + # + # align1;QUERY:M,F,L,A,Q,E,I,I,R,K,K,R,D,G,H,A,L,S,D,E,E,I,..., + # jpred:-,-,H,H,H,H,H,H,H,H,H,H,-,-,-,-,-,-,H,H,H,H,H,H,H,..., + # + # Find the two lines above and extract the query sequence and the + # jpred prediction. + + chomp; + + my ($def, $data) = split /:/, $_ or next; + + if ($def eq 'jnetpred') { + $pred = $data; + $pred =~ s/\,//g; # remove all the ',' in prediction + } + if ($def =~ /align1/) { + next if $query; # skip any hits to align1x sequences. We only want the 1st hit. + $query = $data; + $query =~ s/\,//g; # remove all ',' in sequence + } +} +close($FH); +if (!$query || !$pred) { + die "no jpred output or query sequence found in $file"; +} + +# colour the predictions +$pred =~ s{([H]+)}{$1}g; +$pred =~ s{([E]+)}{$1}g; + +if ($out) { + open(my $OUT, ">$out") or die "$out: $!"; + select($OUT); +} + + +my $html = ' + + +Simple JNet Output + +
';
+$html .= "$query\n";
+$html .= "$pred\n";
+$html .= "
+$JPREDFOOT"; +print $html; + +exit; +