Cellucidate/SimulationRun.pm

filter: Statementstmt 23.5% 4 / 17 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 16.6% 1 / 6 Podpod 0.0% 0 / 5 totaltotal 13.5% 5 / 37 CC 3 SCAR 17.3
CC
3
Cov
17%
complete
12.0
route
2.0
element
2.0
CRAP 5.6
↑ Summary Cellucidate/Request.pm »
1 package Bio::Cellucidate::SimulationRun;
2  
3 =pod
4  
5 =head1 NAME
6  
7 Bio::Cellucidate::SimulationRun
8  
9 =head1 SYNOPSIS
10  
11 # Set your authentication, see L<http://cellucidate.com/api> for more info.
12 $Bio::Cellucidate::AUTH = { login => 'email@server', api_key => '12334567890' };
13  
14 $params = {
15 model_id => 1, # : valid id of a model
16 rescale => 1.0, # : multiplier of each initial
17 # condition (typ. 1)
18 event_time_length => 10000, # : number of events that will
19 # occur before simulation
20 # ends (only if mode = 'EVENT')
21 bio_time_length => 100, # : simulation time length before
22 # simulation ends (only if
23 # mode = 'TIME')
24 event_num_points => 1000, # : number of points to collect
25 # (if mode = 'EVENT')
26 bio_num_points => 1000, # : number of data points to
27 # collect (if model = 'TIME')
28 mode => 'EVENT', # : either 'EVENT' or 'MODE'
29 num_iterations => 1, # : number of plots to create
30 simulation_method => 'STOCHASTIC' # : either 'STOCAHASTIC' or 'ODE'
31 };
32  
33 $simulation_run = Bio::Cellucidate::SimulationRun->create($params);
34  
35 $id = $simulation_run->{id};
36  
37 while ($simulation_run->{state} ne 'success') {
38 $simulation_run = Bio::Cellucidate::SimulationRun->get($simulation_run->{id});
39 print "Simulation Running: " . Bio::Cellucidate::SimulationRun->progress($id) . "% complete";
40 sleep(5);
41 }
42  
43 print "Simulation Complete, CSV data\n";
44  
45 # This is the CSV data for all series and plots.
46 if (Bio::Cellucidate::SimulationRun->get($id)->{state} eq 'succeeded') {
47 print Bio::Cellucidate::SimulationRun->get($id, 'csv');
48 }
49  
50 # The metadata for the plots
51 $plots = Bio::Cellucidate::SimulationRun->plots($id);
52  
53  
54 =head1 SEE ALSO
55  
56 L<http://cellucidate.com>
57  
58 =head1 AUTHOR
59  
60 Brian Kaney, E<lt>brian@vermonster.com<gt>
61  
62 =head1 COPYRIGHT AND LICENSE
63  
64 Copyright (C) 2010 by Plectix BioSystems Inc
65  
66 This library is free software; you can redistribute it and/or modify
67 it under the same terms as Perl itself, either Perl version 5.8.9 or,
68 at your option, any later version of Perl 5 you may have available.
69  
70 =cut
71  
72 7 ▶use base Bio::Cellucidate::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 0 ▶sub route { '/simulation_runs'; }
Subroutine route: not called CC=1 SCAR=6.9
Pod undocumented
75 0 ▶sub element { 'simulation-run'; }
Subroutine element: not called CC=1 SCAR=6.9
Pod undocumented
76  
77  
78 0 ▶sub plots {
Subroutine plots: not called CC=1 SCAR=6.9
Pod undocumented
79 0 my $self = shift;
80 0 my $id = shift;
81 0 my $format = shift;
82 0 $self->rest('GET', $self->route . "/$id" . Bio::Cellucidate::Plot->route, $format)->processResponseAsArray(Bio::Cellucidate::Plot->element);
83 }
84  
85 0 ▶sub progress {
Subroutine progress: not called CC=1 SCAR=6.9
Pod undocumented
86 0 my $self = shift;
87 0 my $id = shift;
88 0 Bio::Cellucidate::SimulationRun->get($id)->{progress};
89 }
90  
91 0 ▶sub complete {
Subroutine complete: not called CC=3 SCAR=24.8
Pod undocumented
92 0 my $self = shift;
93 0 my $id = shift;
94 0 my $state = Bio::Cellucidate::SimulationRun->get($id)->{state};
95 0 ▶ return ( ($state eq 'failed') || ($state eq 'succeeded') || ($state eq 'aborted') );
Condition0%0/6
$state eq 'failed' || $state eq 'succeeded' || $state eq 'aborted'
l!l&&r!l&&!r
000
$state eq "failed" or $state eq "succeeded"
l!l&&r!l&&!r
000
MC/DC0%0/3
$state eq 'failed' || $state eq 'succeeded' || $state eq 'aborted'
$state eq "failed" $state eq "succeeded" $state eq 'aborted'
Truth table0%0/4
A or B || C
A= $state eq "failed"B= $state eq "succeeded"C= $state eq 'aborted'
ABCresult
1XX1
01X1
0011
0000
96 }
97  
98 7 1;
↑ Summary Cellucidate/Request.pm »