#!/usr/bin/perl # Description: This script runs the ProP 1.0.ws0 Web Service. It reads FASTA file from STDIN and produces predictions in a simple table. # Author: Edita Bartaseviciute # Email: edita@cbs.dtu.dk # Version: 1.0 ws0 # Date: 2010-03-11 # usage: perl prop.pl < example.fsa use strict; # include standard XML::Compile helper functions (used to initiate WSDL proxys) require "xml-compile.pl"; # downloadable from the same site as this script # create proxy to ProP Web Service my $prop = WSDL2proxy ( 'http://www.cbs.dtu.dk/ws/ProP/ProP_1_0_ws0.wsdl' ); # append schema definitions $prop = appendSchemas ( $prop , "http://www.cbs.dtu.dk/ws/common/ws_common_1_0b.xsd" , "http://www.cbs.dtu.dk/ws/ProP/ws_prop_1_0_ws0.xsd", "http://bioxsd.org/BioXSD-1.0.xsd" ); # create hash of operations from proxy my %ops = addOperations ( $prop ) ; # Get sequence in fasta format from STDIN my @fasta; my $entry = -1; while () { if (/^>(.*)/) { my ($id , $comment) = split (" ",$1); $entry++; $fasta[$entry]->{id} = $id; $fasta[$entry]->{comment} = $comment if defined $comment; } elsif (/^([A-Za-z]+)/) { $fasta[$entry]->{seq} .= $1; } } # Create sequence for request my @sequence; for ( my $i = 0 ; $i < scalar ( @fasta ) ; $i ++ ) { push @sequence , { sequence => $fasta[$i]->{seq}, formalReference => {accession => $fasta[$i]->{id} }}; } # Do the request my $response = $ops{runService}->( parameters => { parameters => { sequenceRecord => [@sequence]} } ); # uncomment the two following lines to inspect the structure of $response # use Data::Dumper; # print Dumper($response); # get job id which can be used to get the results later my $jobid; if ( ! defined ( $response->{parameters}->{queueentry}) ) { die "error obtaining jobid\n"; } else { $jobid = $response->{parameters}->{queueentry}->{jobid}; print STDERR "# waiting for job $jobid"; my $status = "UNKNOWN";; while ( $status =~ /ACTIVE|RUNNING|QUEUED|WAITING|PENDING|UNKNOWN/ ) { my $response = $ops{pollQueue}->( job => { job => { jobid => $jobid } }) ; $status = $response->{queueentry}->{queueentry}->{status}; print STDERR "."; } die "\nunexpected job status '$status'\n" unless $status eq "FINISHED"; print STDERR "\n# job has finished\n"; } # when the job is done, fetch the result $response = $ops{fetchResult}->(job => { jobid => $jobid }); # uncomment the two following lines to inspect the structure of $response # use Data::Dumper; # print Dumper($response); #printing the results my ($id, $pos, $score, $finding); print "##### ProP 1.0 ProPeptide Cleavage Site Prediction #####\n\n", "##### Furin-type cleavage site prediction (Arginine/Lysine residues) #####\n\n"; foreach my $annotatedSequence (@{$response->{parameters}->{annotatedSequence}}) { print "\nName\t\tPos\tScore\tPred\n", "________________________________________\n"; if (exists $annotatedSequence->{sequenceRecord}->{formalReference}) { $id = $annotatedSequence->{sequenceRecord}->{formalReference}->{accession}; } foreach my $cho (@{$annotatedSequence->{cho_annotation}}) { foreach my $occurence (@{$cho->{annotation}->{occurence}}) { $pos = $occurence->{position}->{point}->{_}; foreach my $evidence (@{$occurence->{evidence}}){ $score = sprintf ("%.3f", $evidence->{predicted}->{score}[0]->{value}); if ($evidence->{predicted}->{verdict} eq "Impossible") { $finding = "."; } elsif ($evidence->{predicted}->{verdict} eq "Present") { $finding = "*ProP*"; } print "$id\t$pos\t$score\t$finding\n"; } } } print "________________________________________\n"; }