4 use CXGN
::DB
::InsertDBH
;
5 use Bio
::Chado
::Schema
;
9 use vars qw
| $opt_H $opt_D |;
13 my $dbh = CXGN
::DB
::InsertDBH
->new( {
20 my $schema = Bio
::Chado
::Schema
->connect( sub { $dbh->get_actual_dbh() } );
22 my $q = "SELECT distinct(project_id), nd_geolocation.nd_geolocation_id, nd_geolocation.description FROM nd_experiment_project JOIN nd_experiment USING (nd_experiment_id) JOIN nd_geolocation USING (nd_geolocation_id) ";
23 my $h = $dbh->prepare($q);
25 while (my ($project_id, $location_id, $description) = $h->fetchrow_array()) {
26 my $trial = CXGN
::Trial
->new( { bcs_schema
=> $schema, trial_id
=>$project_id });
28 print STDERR
"Adding location $description ($location_id) to trial $project_id... ";
30 my $current_location = $trial->get_location();
31 if ( $current_location->[0]) { # whatever it is
32 print STDERR
" (already associated) ";
35 $trial->set_location($location_id);
37 print STDERR
"Done.\n";