Merge pull request #2754 from solgenomics/topic/fix_homepage_add_accessions_dialog
[sgn.git] / bin / ODK / ODK_ONA_get_crosses.pl
blobcfb735897844c07b071b94605ab055876cfbb1f6
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_n, $opt_m, $opt_o, $opt_f, $opt_l, $opt_c, $opt_q, $opt_y, $opt_D, $opt_U, $opt_p, $opt_H);
32 getopts('u:i:r:a:d:n:m:o:w:f:l:c:q:y:D:U:p:H:');
34 if (!$opt_u || !$opt_i || !$opt_r || !$opt_a || !$opt_d || !$opt_n || !$opt_m || !$opt_o || !$opt_f || !$opt_l || !$opt_c || !$opt_q || !$opt_y || !$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) -n (ODK username) -m (ODK password) -o (ODK form_id) -f (odk cross progress tree file dir) -l (ODK URL) -c (allowed cross properties) -q (temp cross wishlist file path for dl from ONA) -y (temp germplasm info file path for dl from ONA) -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 allowed_cross_properties=>$opt_c,
64 cross_wishlist_temp_file_path=>$opt_q,
65 germplasm_info_temp_file_path=>$opt_y,
66 odk_crossing_data_service_url=>$opt_l,
67 odk_crossing_data_service_username=>$opt_n,
68 odk_crossing_data_service_password=>$opt_m,
69 odk_crossing_data_service_form_id=>$opt_o,
70 odk_cross_progress_tree_file_dir=>$opt_f
71 });
72 my $result = $odk_crosses->save_ona_cross_info();