#!/usr/bin/perl # Description: This script runs the NetCTL 1.2.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: 1.2 ws0 # Date: 2009-05-29 # usage: perl test_netctl.pl [-s supertype] [-thr 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 ($supertype, $threshold); for (my $i = 0; $i <= $#ARGV; $i ++) { if ($ARGV[$i] eq "-s") { $supertype = $ARGV[$i+1]; } elsif ($ARGV[$i] eq "-thr") { $threshold = $ARGV[$i+1]; } } # create proxy to NetCTL Web Service my $netctl = WSDL2proxy ( 'http://www.cbs.dtu.dk/ws/NetCTL/NetCTL_1_2_ws0.wsdl' ); # append schema definitions $netctl = appendSchemas ( $netctl , "http://www.cbs.dtu.dk/ws/common/ws_common_1_0b.xsd" , "http://www.cbs.dtu.dk/ws/NetCTL/ws_netctl_1_2_ws0.xsd" ); my %ops = addOperations ( $netctl ) ; 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 $supertype) and (defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { supertype => $supertype , threshold => $threshold , sequencedata => {sequence => [@sequence]} } }); } elsif ((defined $supertype) and !(defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { supertype => $supertype , sequencedata => {sequence => [@sequence]} } }); $threshold = 0.75; } elsif (!(defined $supertype) and (defined $threshold)) { $response = $ops{runService}->( parameters => { parameters => { threshold => $threshold , sequencedata => {sequence => [@sequence]} } }); $supertype = "A1"; } else { $response = $ops{runService}->( parameters => { parameters => { sequencedata => {sequence => [@sequence]} } }); $supertype = "A1"; $threshold = 0.75; } 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 print "NetCTL-1.2 predictions using MHC supertype $supertype. Threshold " . sprintf ("%.6f", $threshold) ."\n\n"; foreach my $ann (@{$response->{parameters}->{anndata}->{ann}}) { my $sequence = $sequence[0]->{seq}; my $no_ligands = 0; my $no_peptides = 0; foreach my $annrecord (@{$ann->{annrecords}->{annrecord}}) { my $pos = sprintf ("%4s", $annrecord->{range}->{begin}->numify); my $pep = substr($sequence, $annrecord->{range}->{begin}->numify-1, 9); my $aff_score = sprintf ("%.4f", $annrecord->{score}[0]->{value}); my $rescale_score = sprintf ("%.4f", $annrecord->{score}[1]->{value}); my $cle_score = sprintf ("%.4f", $annrecord->{score}[2]->{value}); my $tap_score = sprintf ("%.4f", $annrecord->{score}[3]->{value}); $tap_score = sprintf ("%7s", $tap_score); my $comb_score = sprintf ("%.4f", $annrecord->{score}[4]->{value}); $comb_score = sprintf ("%7s", $comb_score); my $comment; if (defined ($annrecord->{comment})){ $comment = "<-E"; $no_ligands++; } $no_peptides++; print "$pos ID $ann->{sequence}->{id} pep $pep $annrecord->{score}[0]->{key} $aff_score $annrecord->{score}[1]->{key} ", "$rescale_score $annrecord->{score}[2]->{key} $cle_score $annrecord->{score}[3]->{key} $tap_score $annrecord->{score}[4]->{key} ", "$comb_score $comment\n"; } print "\n----------------------------\n\n". "Number of MHC ligands $no_ligands identified. Number of peptides $no_peptides. 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 VLGNLEITYVQRNYDLSFLKTIQEVAGYVLIALNTVERIPLENLQIIRGNMYYENSYALA VLSNYDANKTGLKELPMRNLQEILHGAVRFSNNPALCNVESIQWRDIVSSDFLSNMSMDF QNHLGSCQKCDPSCPNGSCWGAGEENCQKLTKIICAQQCSGRCRGKSPSDCCHNQCAAGC TGPRESDCLVCRKFRDEATCKDTCPPLMLYNPTTYQMDVNPEGKYSFGATCVKKCPRNYV VTDHGSCVRACGADSYEMEEDGVRKCKKCEGPCRKVCNGIGIGEFKDSLSINATNIKHFK NCTSISGDLHILPVAFRGDSFTHTPPLDPQELDILKTVKEITGFLLIQAWPENRTDLHAF ENLEIIRGRTKQHGQFSLAVVSLNITSLGLRSLKEISDGDVIISGNKNLCYANTINWKKL FGTSGQKTKIISNRGENSCKATGQVCHALCSPEGCWGPEPRDCVSCRNVSRGRECVDKCN LLEGEPREFVENSECIQCHPECLPQAMNITCTGRGPDNCIQCAHYIDGPHCVKTCPAGVM GENNTLVWKYADAGHVCHLCHPNCTYGCTGPGLEGCPTNGPKIPSIATGMVGALLLLLVV ALGIGLFMRRRHIVRKRTLRRLLQERELVEPLTPSGEAPNQALLRILKETEFKKIKVLGS GAFGTVYKGLWIPEGEKVKIPVAIKELREATSPKANKEILDEAYVMASVDNPHVCRLLGI CLTSTVQLITQLMPFGCLLDYVREHKDNIGSQYLLNWCVQIAKGMNYLEDRRLVHRDLAA RNVLVKTPQHVKITDFGLAKLLGAEEKEYHAEGGKVPIKWMALESILHRIYTHQSDVWSY GVTVWELMTFGSKPYDGIPASEISSILEKGERLPQPPICTIDVYMIMVKCWMIDADSRPK FRELIIEFSKMARDPQRYLVIQGDERMHLPSPTDSNFYRALMDEEDMDDVVDADEYLIPQ QGFFSSPSTSRTPLLSSLSATSNNSTVACIDRNGLQSCPIKEDSFLQRYSSDPTGALTED SIDDTFLPVPEYINQSVPKRPAGSVQNPVYHNQPLNPAPSRDPHYQDPHSTAVGNPEYLN TVQPTCVNSTFDSPAHWAQKGSHQISLDNPDYQQDFFPKEAKPNGIFKGSTAENAEYLRV APQSSEFIGA