UsingTheWSInterface: Difference between revisions
Jump to navigation
Jump to search
imported>MichaelDondrup No edit summary |
imported>MichaelDondrup No edit summary |
||
Line 28: | Line 28: | ||
print $soap-> fetchAllExperimentalFactorsByExperiment ('EMMA2.Coryne-Center','GlucoseAcetat'); | print $soap-> fetchAllExperimentalFactorsByExperiment ('EMMA2.Coryne-Center','GlucoseAcetat'); | ||
print $soap-> fetchAllExperimentalFactorValuesByFactorAndExperiment ('EMMA2.Coryne-Center','GlucoseAcetat','Carbon Source'); | print $soap-> fetchAllExperimentalFactorValuesByFactorAndExperiment ('EMMA2.Coryne-Center','GlucoseAcetat','Carbon Source'); | ||
print Dumper $soap->fetchMultipleMvalues('EMMA2.Coryne-Center', 'GlucoseAcetat' ['R:cg0001', 'R:cg0012'], 'Carbon Source', 'Glucose'); | print Dumper $soap->fetchMultipleMvalues('EMMA2.Coryne-Center', 'GlucoseAcetat',['R:cg0001', 'R:cg0012'], 'Carbon Source', 'Glucose'); | ||
</nowiki></pre> | </nowiki></pre> |
Revision as of 10:18, 8 July 2008
Using TheWeb-Services Interface
Synopsis
Web-services allow for interchange of structured data via the internet. EMMA provides a SOAP-based web-service layer to query for expression data.
Sample Perl-client
Have a look at the a very simple :-) SOAP::Lite client written in perl.
#!/usr/bin/env perl use strict; use warnings; use SOAP::Lite; use Data::Dumper; my $soap = SOAP::Lite-> service('https://www.cebitec.uni-bielefeld.de/groups/brf/software/emma/web_service_emma.wsdl'); print Dumper $soap->fetchAllProjects(); print Dumper $soap->fetchAllExperiments('EMMA2.Coryne-Center'); print Dumper $soap->fetchAllReporterByName('EMMA2.Coryne-Center', 'Smeliloti DEMO Project', "sm00001"); print $soap-> fetchAllExperimentalFactorsByExperiment ('EMMA2.Coryne-Center','GlucoseAcetat'); print $soap-> fetchAllExperimentalFactorValuesByFactorAndExperiment ('EMMA2.Coryne-Center','GlucoseAcetat','Carbon Source'); print Dumper $soap->fetchMultipleMvalues('EMMA2.Coryne-Center', 'GlucoseAcetat',['R:cg0001', 'R:cg0012'], 'Carbon Source', 'Glucose');
Here is a more sophisticated client, that can produce a heatmap web-page for some genes of interest:
#!/usr/bin/env perl use strict; use Getopt::Std; use SOAP::Lite; use Data::Dumper; use CGI qw/:standard/; my $soap = SOAP::Lite-> service('https://www.cebitec.uni-bielefeld.de/groups/brf/software/emma/web_service_emma.wsdl'); my @vals = (); my $min = my $max = 0; print "<html><head></head><body><table><tr><th>Gene name</th><th>WT</th><th>Delta hspR (cg3097)</th></tr>"; foreach (('0001'..'0020')) { #print "cg$_"; my $reps = $soap->fetchAllReporterByName('EMMA2:Coryne','Heat Shock',"cg$_"); next unless ref ($reps) and scalar @$reps; my $wt = $soap->fetchLatestSignificantMeanM1WithBestQualityByExperimentAndReporterAndFactorAndFactorValue('EMMA2:Coryne','Heat Shock',$reps->[0],'Strains','WT'); my $hspr = $soap->fetchLatestSignificantMeanM1WithBestQualityByExperimentAndReporterAndFactorAndFactorValue('EMMA2:Coryne','Heat Shock',$reps->[0],'Strains','Delta hspR (cg3097)'); push @vals ,["cg$_",$wt,$hspr]; $min = $wt if $wt < $min;$min = $hspr if $hspr < $min; $max = $wt if $wt > $max; $max = $hspr if $hspr > $max; print STDERR '.'; }; foreach (@vals) { my ($v1,$v2,$v3) = (@$_); my $red1 = my $red2 = my $green1 = my $green2 = 0; if ($max > 0) { $red1 = ($v2 > 0)?100*$v2 /$max : 0; $red2 = ($v3 > 0)?100*$v3 /$max : 0; }; if ($min < 0) { $green1 = ($v2 < 0)? 100*$v2 / $min : 0; $green2 = ($v3 < 0)? 100*$v3 / $min : 0; }; print qq| <tr> <td >$v1 </td> <td style="background-color:rgb($red1%,$green1%,0%)" > <span style="color:white">$v2 </span></td> <td style="background-color:rgb($red2%,$green2%,0%)" > <span style="color:white">$v3</span> </td></tr> | ; } print "</table></body></html>\n"; __END__
And here ist the resulting output: