#!/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;