forked from nmdp-bioinformatics/phycus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCohort-client.pl
53 lines (43 loc) · 1.2 KB
/
Cohort-client.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl
use strict;
use warnings;
use lib 'lib';
use Data::Dumper;
use Getopt::Long;
use File::Basename;
use WWW::SwaggerClient::CohortApi;
use WWW::SwaggerClient::Object::CohortRequest;
my $base = "http://phycus.b12x.org:8080";
my $opt_local;
my $prg = basename($0);
if (
!&GetOptions(
"local" => \$opt_local,
)
)
{
print "\n$prg: wrong option\n";
exit 1;
}
if($opt_local) {
$base = "http://localhost:8080";
}
my $api_instance = WWW::SwaggerClient::CohortApi->new();
my $genotype_list = WWW::SwaggerClient::Object::GenotypeList->new();
my $cohort_request = WWW::SwaggerClient::Object::CohortRequest->new();
my $cohort_data = WWW::SwaggerClient::Object::CohortData->new();
$cohort_data->{name} = "Cohort1";
$cohort_data->{genotype_list} = $genotype_list;
$cohort_request->{cohort_data} = $cohort_data;
$api_instance->{api_client}->{config}{base_url} = $base;
$api_instance->{api_client}->{ua}->env_proxy;
eval {
my $result = $api_instance->create_cohort(cohort_request => $cohort_request
);
print Dumper($result);
my $cohortId = $result->{id};
print "The Cohort ID is ${cohortId}\n";
};
if ($@) {
warn "Exception when calling CohortApi->create_cohort: $@\n";
}