fix commented out code.
[sgn.git] / bin / ODK / ODK_ONA_get_crosses.pl
blob2c20c6db33c32264a50fb42edd8382ba2d9af619
1 #!/usr/bin/perl
3 =head1
4 ODK/ODK_ONA_get_crosses.pl
6 =head1 SYNOPSIS
7 ODK_ONA_get_crosses.pl
9 =head1 COMMAND-LINE OPTIONS
10 ARGUMENTS
12 =head1 DESCRIPTION
14 =head1 AUTHOR
15 Nicolas Morales (nm529@cornell.edu)
16 =cut
18 use strict;
20 use Getopt::Std;
21 use Data::Dumper;
22 use Carp qw /croak/ ;
23 use Pod::Usage;
24 use CXGN::ODK::Crosses;
25 use JSON;
26 use Bio::Chado::Schema;
27 use CXGN::Metadata::Schema;
28 use CXGN::Phenome::Schema;
30 our ($opt_u, $opt_i, $opt_r, $opt_a, $opt_d, $opt_t, $opt_n, $opt_m, $opt_o, $opt_w, $opt_x, $opt_f, $opt_l, $opt_c, $opt_D, $opt_U, $opt_p, $opt_H);
32 getopts('u:i:r:a:d:t:n:m:o:w:x:f:c:D:U:p:H:');
34 if (!$opt_u || !$opt_i || !$opt_r || !$opt_a || !$opt_d ||!$opt_t || !$opt_n || !$opt_m || !$opt_o || !$opt_w || !$opt_f || !$opt_l || !$opt_D || !$opt_U || !$opt_p || !$opt_H) {
35 die "Must provide options -u (sp_person_id) -i (sp_person_username )-r (sp_role) -a (archive_path) -d (temp_files_dir) -t (temp_file_path) -n (ODK username) -m (ODK password) -o (ODK form_id) -w (cross wishlist md_file_id) -x (cross_wishlist_file_name) -f (odk cross progress tree file dir) -l (ODK URL) -c (allowed cross properties) -D (database name) -U (db user) -p (dbpass) -H (dbhost) \n";
38 my $bcs_schema = Bio::Chado::Schema->connect(
39 "dbi:Pg:database=$opt_D;host=$opt_H", # DSN Line
40 $opt_U, # Username
41 $opt_p # Password
43 my $metadata_schema = CXGN::Metadata::Schema->connect(
44 "dbi:Pg:database=$opt_D;host=$opt_H", # DSN Line
45 $opt_U, # Username
46 $opt_p # Password
48 my $phenome_schema = CXGN::Phenome::Schema->connect(
49 "dbi:Pg:database=$opt_D;host=$opt_H", # DSN Line
50 $opt_U, # Username
51 $opt_p # Password
54 my $odk_crosses = CXGN::ODK::Crosses->new({
55 bcs_schema=>$bcs_schema,
56 metadata_schema=>$metadata_schema,
57 phenome_schema=>$phenome_schema,
58 sp_person_id=>$opt_u,
59 sp_person_username=>$opt_i,
60 sp_person_role=>$opt_r,
61 archive_path=>$opt_a,
62 temp_file_dir=>$opt_d,
63 temp_file_path=>$opt_t,
64 allowed_cross_properties=>$opt_c,
65 cross_wishlist_md_file_id=>$opt_w,
66 cross_wishlist_file_name=>$opt_x,
67 odk_crossing_data_service_url=>$opt_l,
68 odk_crossing_data_service_username=>$opt_n,
69 odk_crossing_data_service_password=>$opt_m,
70 odk_crossing_data_service_form_id=>$opt_o,
71 odk_cross_progress_tree_file_dir=>$opt_f
72 });
73 my $result = $odk_crosses->save_ona_cross_info();