#! /usr/bin/perl use strict; use warnings; use lib '/homes/www-jpred/new_site/jpred_new/lib'; use Concise; use Concise::File; use Getopt::Long; use Pod::Usage; my $file; my $out; my $help; my $man; GetOptions ( 'file=s' => \$file, 'out=s' => \$out, 'help|?' => \$help, 'man' => \$man ) or pod2usage(0); pod2usage(-verbose => 1) if $help; pod2usage(-verbose => 2) if $man; pod2usage(-msg => 'Please give a concise file to read', -verbose => 0) if (!$file); ## Hash of description lines for concise data types my %desc = ( jnetpred => 'Final secondary structure prediction by Jnet', JNETHMM => 'Jnet prediction using HMMer profiles', JNETPSSM => 'Jnet prediction using PSSM profiles', JNETJURY => 'Positions where Jnet predictions do not agree', JNETSOL0 => 'Jnet solvent relative accessibility prediction at 0% cut-off', JNETSOL5 => 'Jnet solvent relative accessibility prediction at 5% cut-off', JNETSOL25 => 'Jnet solvent relative accessibility prediction at 25% cut-off', JNETCONF => 'Confidence of Jnet prediction 0 (low) -> 9 (high)', Lupas_14 => 'Coiled-coil prediction windowed over 14 residues', Lupas_21 => 'Coiled-coil prediction windowed over 21 residues', Lupas_28 => 'Coiled-coil prediction windowed over 28 residues', ); ## If an output file is given open it and select it as the default output my $FH; if ($out) { open($FH, ">$out") or die "ERROR - unable to open '$out' for writing: $!\nDied"; select($FH); } ## Create a Concise::File object and fill it with the contents of the input file my $concise = Concise::File->new(read_file => $file); ## Write the Jalview Annotation file to the default output print "JALVIEW_ANNOTATION\n"; print "# Created by concise2jalview using '$file' as input\n\n"; for my $data ($concise->get_entries) { my $string = join("|", $data->seq); if ($data->id =~ /prop|align/i) { # skip sequence alignments and PROPH|C|E fields next; } elsif ($data->id =~ /jnetconf/i) { # treat Jnet confidence as a bar graph as contains real numbers print "BAR_GRAPH\t", $data->id,"\t",$desc{$data->id}, "\t$string\n"; next; } elsif ($data->id =~ /jnet(pred|hmm|align|pssm)/i) { # strip out '-' chars from prediction fields as unrequired by Jalview $string =~ s/-//g; } # By default don't treat fields as graphable data and add a description line print "NO_GRAPH\t",$data->id,"\t",$desc{$data->id}, "\t$string\n"; } exit; =head1 NAME concise2jalview -- covert Jnet concise files to Jalview annotation files =head1 SYNOPSIS concise2jalview --file [--help] [--man] > =head1 DESCRIPTION This script takes a Jnet concise file as input and returns a Jalview annotation file as output. This allows Jalview to better view Jnet/Jpred prediction complete with descriptions of the various predictions. All data types are included in the Jalview file except for 'JNETPROP*' and any sequence alignments. =head1 OPTIONS =over 4 =item B<--file> Give the path and name to the Jnet concise file. =item B<--help> Displays brief help. =item B<--man> Displays the full manpage. =back =head1 AUTHOR Chris Cole =cut