#!/usr/bin/perl # Description: This script runs the NetChop 3.1.ws0 Web Service. It requires no input; to be used for testing in the EMBRACE WS Registry. # Author: Edita Bartaseviciute # Email: edita@cbs.dtu.dk # Version: 3.1 ws0 # Date: 2009-07-06 # usage: perl test_netchop.pl [-v integer] [-t float] # include standard XML::Compile helper functions (used to initiate WSDL proxys) use strict; require "xml-compile.pl"; # downloadable from the same site as this script #taking options from a command line my ($method, $threshold); for (my $i = 0; $i <= $#ARGV; $i ++) { if ($ARGV[$i] eq "-v") { $method = $ARGV[$i+1]; } elsif ($ARGV[$i] eq "-t") { $threshold = $ARGV[$i+1]; } } # create proxy to NetChop Web Service my $netchop = WSDL2proxy ( 'http://www.cbs.dtu.dk/ws/NetChop/NetChop_3_1_ws0.wsdl' ); # append schema definitions $netchop = appendSchemas ( $netchop , "http://www.cbs.dtu.dk/ws/common/ws_common_1_0b.xsd" , "http://www.cbs.dtu.dk/ws/NetChop/ws_netchop_3_1_ws0.xsd" ); my %ops = addOperations ( $netchop ) ; 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; } } my @sequence; for ( my $i = 0 ; $i < scalar ( @fasta ) ; $i ++ ) { push @sequence , { id => $fasta[$i]->{id} , comment => $fasta[$i]->{comment} , seq => $fasta[$i]->{seq} }; } my $response; if ((defined $method) and (defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { method => $method , threshold => $threshold , sequencedata => {sequence => [@sequence]} } }); } elsif ((defined $method) and !(defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { method => $method , sequencedata => {sequence => [@sequence]} } }); $threshold = 0.5; } elsif (!(defined $method) and (defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { threshold => $threshold , sequencedata => {sequence => [@sequence]} } }); $method = 0; } else { $response = $ops{runService}->( parameters => { parameters => { sequencedata => {sequence => [@sequence]} } }); $method = 0; $threshold = 0.5; } 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"; } $response = $ops{fetchResult}->(job => { jobid => $jobid }); #printing the results (suitable for one sequence) my $version_name; if ($method == 0) { $version_name = 'C-term'; } elsif ($method == 1) { $version_name = '20S'; } print "NetChop-3.1 predictions using version $version_name. Threshold " . sprintf ("%.6f", $threshold) . "\n\n"; foreach my $ann (@{$response->{parameters}->{anndata}->{ann}}) { print "--------------------------------------\n pos AA C\t score", " Ident\n--------------------------------------\n"; my $sequence = $sequence[0]->{seq}; my $length = length ($sequence); my $no_cleavage = 0; my $no_aa = 0; foreach my $annrecord (@{$ann->{annrecords}->{annrecord}}) { my $pos = sprintf ("%4s", $annrecord->{pos}); my $aa = substr($sequence, $pos-1, 1); my $comment; if (exists $annrecord->{comment}) { $comment = "S"; $no_cleavage++; } else { $comment = "."; } my $score = sprintf ("%.6f", $annrecord->{score}[0]->{value}); print "$pos $aa $comment $score $ann->{sequence}->{id}\n"; } print "--------------------------------------\n\n". "Number of cleavage sites $no_cleavage. Number of amino acids $length. Protein name $ann->{sequence}->{id}\n\n". "--------------------------------------\n"; } __DATA__ >EGFR_HUMAN P00533 EPIDERMAL GROWTH FACTOR RECEPTOR PRECURSOR (EC 2.7.1.112). - Homo sapiens (Human). MRPSGTAGAALLALLAALCPASRALEEKKVCQGTSNKLTQLGTFEDHFLSLQRMFNNCEV VLGNLEITYVQRNYDLSFLKTIQEVAGYVLIALNTVERIPLENLQIIRGNM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