Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
5a1c1ae
Touch files for creating backend
ryan-preble Jul 16, 2025
86025f3
Rename and create field management regime dbpatch
ryan-preble Jul 16, 2025
f05b6e4
Create treatment CV dbpatch
ryan-preble Jul 16, 2025
f4cfb81
Suppress single trial upload
ryan-preble Jul 16, 2025
af57a2b
Add design subsection for field management regime
ryan-preble Jul 17, 2025
a2a4516
Add skeleton field management regime UI
ryan-preble Jul 18, 2025
6e6ce89
Merge branch 'master' into topic/change_treatment_backend
ryan-preble Jul 18, 2025
df5f918
Fixing display issue on plant dialogs and adding a bit more to field …
ryan-preble Jul 22, 2025
cf74815
Convert add management factor dialog to modal
ryan-preble Jul 23, 2025
98c1497
UI improvements. Tweaking treatments and management factors in trial …
ryan-preble Jul 23, 2025
b2e35ea
Rename dbpatch and move around
ryan-preble Jul 23, 2025
c0e7ee2
Tweak to UI and changing get_treatments function
ryan-preble Jul 24, 2025
64ac5f2
Adding spreadsheet treatment upload
ryan-preble Jul 25, 2025
e6b15a8
Add back old treatment project function and start conversion script
ryan-preble Jul 28, 2025
30772d1
First draft of treatment project conversion script
ryan-preble Jul 28, 2025
cbd36cc
Fixing conversion script
ryan-preble Jul 29, 2025
6faf2a7
More fixes to conversion script
ryan-preble Jul 29, 2025
6291bb4
Change trait search page title
ryan-preble Jul 29, 2025
1a22b3b
Starting management factor backend
ryan-preble Jul 29, 2025
10f39ee
Enable adding management factors through trial detail page
ryan-preble Jul 30, 2025
8b888b6
Finish management regime on trial detail page
ryan-preble Jul 31, 2025
5719e23
Rename treatment cv to experiment_treatment
ryan-preble Jul 31, 2025
9cab160
Add completions records to management factors
ryan-preble Jul 31, 2025
5abab73
Add edit button
ryan-preble Jul 31, 2025
4b06dca
Enable editing management factors and adding completion records
ryan-preble Aug 1, 2025
f8d1881
Fix pesky newline issue
ryan-preble Aug 1, 2025
dd62c2b
Fix dbpatch and script to have proper cvterm relationships
ryan-preble Aug 4, 2025
3252ced
First working version of dbpatch and script
ryan-preble Aug 5, 2025
08d7c9b
Revert trait search page to master
ryan-preble Aug 5, 2025
c7dc15c
Change conversion script to allow substocks to inherit treatments
ryan-preble Aug 6, 2025
8c098be
Tweak to edit plot accession dialog
ryan-preble Aug 6, 2025
573d336
Implement treatment search page
ryan-preble Aug 6, 2025
e3c66d3
Fix treatment definition search
ryan-preble Aug 6, 2025
a343038
Skeleton of treatment design page
ryan-preble Aug 6, 2025
ec21113
Add start and end dates to management factors
ryan-preble Aug 7, 2025
daf34c3
Backend and controller for new treatments
ryan-preble Aug 7, 2025
a573d36
Finish treatment designer
ryan-preble Aug 8, 2025
7aa3811
enforce no special characters in treatment names in conversion script
ryan-preble Aug 8, 2025
e32d7a8
Add new treatments to trial design section
ryan-preble Aug 11, 2025
b320313
Add file upload dialog for treatments
ryan-preble Aug 12, 2025
51fe8c5
Add extra param to upload_store function
ryan-preble Aug 12, 2025
b65cb54
Add some permissions checks
ryan-preble Aug 12, 2025
5fe2781
Fix formatting and generalize get_plot_contents to other stocks
ryan-preble Aug 13, 2025
6fb83ed
Implement delete treatments
ryan-preble Aug 13, 2025
03c52ad
Fix small window reload issue
ryan-preble Aug 13, 2025
8aaf5f9
Add flattened child stocks function
ryan-preble Aug 14, 2025
c056490
Add treatments and management regimes to label designer
ryan-preble Aug 15, 2025
ce28ce5
Change treatment conversion to make a legacy treatment group
ryan-preble Aug 18, 2025
23ec814
bug fixes in conversion and dbpatch
ryan-preble Aug 18, 2025
0002f15
dbpatch debugging
ryan-preble Aug 18, 2025
716696b
Bug fixes with treatment inheritance for new stocks
ryan-preble Aug 21, 2025
7053847
Bugfixes in stock uploads
ryan-preble Aug 22, 2025
1d2c75f
Make experiment treatments composable
ryan-preble Aug 28, 2025
ed96e12
Make composed exp treatments searchable on treatment search page
ryan-preble Aug 28, 2025
3b83e0b
Rework treatment designer
ryan-preble Aug 28, 2025
8791824
Deprecate treatment columns in trial upload
ryan-preble Aug 29, 2025
6c7c897
Allow ontology categories to have uppercase letters
ryan-preble Aug 29, 2025
27d3ac0
Merge branch 'master' into topic/change_treatment_backend
ryan-preble Aug 29, 2025
354eddb
Add trait designer and allow trait creation
ryan-preble Sep 2, 2025
8157a8a
Add autocomplete to trait and treatment designers
ryan-preble Sep 2, 2025
ff97ea3
Add ability to edit cvterm name and definition
ryan-preble Sep 2, 2025
9224b0e
Update user manual
ryan-preble Sep 2, 2025
927aae0
manual stuff
ryan-preble Sep 3, 2025
7e8a6fb
implement cvterm interactive delete
ryan-preble Sep 3, 2025
c18fbe5
tweak to javascript message
ryan-preble Sep 3, 2025
81c9cbf
Fixing an oopsie
ryan-preble Sep 3, 2025
a41641c
Add treatments to trial upload, misc fixes
ryan-preble Sep 5, 2025
e6df156
Adding treatments to splitplot design
ryan-preble Sep 9, 2025
34587b7
Finish treatments on splitplot UI design
ryan-preble Sep 10, 2025
6693e00
reworking trait designs
ryan-preble Sep 10, 2025
38c86a7
Add fieldbook trait formats to designer
ryan-preble Sep 11, 2025
5e3d3f5
enforce trait formats a bit better in StorePhenotypes.pm
ryan-preble Sep 11, 2025
478e3ce
Adding treatments to phenotype summary in trial detail page
ryan-preble Sep 12, 2025
dc1c308
Split server cvterm edit config into two keys
ryan-preble Sep 15, 2025
79a7910
Add trait_details to designer
ryan-preble Sep 15, 2025
1484b81
Fixing some tests
ryan-preble Sep 16, 2025
026d7ca
Fix label designer test
ryan-preble Sep 16, 2025
adbebb3
Fixing tests
ryan-preble Sep 18, 2025
de77d67
Merge branch 'master' into topic/change_treatment_backend
ryan-preble Sep 18, 2025
ca001cc
update bookdown docs
invalid-email-address Sep 18, 2025
01a9f0b
Make sure treatment upload works on single trial spreadsheet with pla…
ryan-preble Sep 18, 2025
550328b
update bookdown docs
invalid-email-address Sep 18, 2025
20504a5
Linting issues
ryan-preble Sep 19, 2025
f25b152
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 19, 2025
46831d3
update bookdown docs
invalid-email-address Sep 19, 2025
815da82
Fix unit fixture test
ryan-preble Sep 22, 2025
da47689
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 22, 2025
8620860
update bookdown docs
invalid-email-address Sep 22, 2025
55bcd1d
Add ontology downloads to trait and treatment designers
ryan-preble Sep 24, 2025
7cc0481
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 24, 2025
6f3c033
update bookdown docs
invalid-email-address Sep 24, 2025
7274df8
Move dbpatches up
ryan-preble Sep 24, 2025
9a56f00
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 24, 2025
b746e89
update bookdown docs
invalid-email-address Sep 24, 2025
ed25e68
Add selenium test for treatment designer
ryan-preble Sep 24, 2025
1bd7be6
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 24, 2025
bafd39b
update bookdown docs
invalid-email-address Sep 24, 2025
a1c983c
Add a fixture cleanup in test before failing test
ryan-preble Sep 26, 2025
fed19bf
update bookdown docs
invalid-email-address Sep 26, 2025
ed0dd39
Try to fix tests again
ryan-preble Sep 26, 2025
5a36f7a
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 26, 2025
0d5e7c9
update bookdown docs
invalid-email-address Sep 26, 2025
5fa7e5e
Fix selenium test
ryan-preble Sep 29, 2025
7deb37d
Merge branch 'topic/change_treatment_backend' of github.com:solgenomi…
ryan-preble Sep 29, 2025
4e2d2c2
update bookdown docs
invalid-email-address Sep 29, 2025
7f27c4d
testing different dbh statements
ryan-preble Oct 8, 2025
0f21751
Change dbh create statement
ryan-preble Oct 8, 2025
0f2441c
update bookdown docs
invalid-email-address Oct 8, 2025
701a731
change timing of label_designer selenium test
ryan-preble Oct 9, 2025
e5e9976
update bookdown docs
invalid-email-address Oct 9, 2025
5962642
Do a single storephenotypes instead of one per trial
ryan-preble Oct 9, 2025
cd42042
update bookdown docs
invalid-email-address Oct 9, 2025
bb62d76
Do long sleep again like master branch
ryan-preble Oct 10, 2025
33f4788
update bookdown docs
invalid-email-address Oct 10, 2025
4e5bedd
Fix value parsing in label designer
ryan-preble Oct 23, 2025
7dfe34c
Skip trials that are not phenotyping trials
ryan-preble Nov 11, 2025
fd7d54f
Merge branch 'master' into topic/change_treatment_backend. Lets hope …
ryan-preble Nov 11, 2025
14b26a6
update bookdown docs
invalid-email-address Nov 11, 2025
adfb765
Fix bug with blank stock name and fix treatment inheritance with addi…
ryan-preble Nov 12, 2025
44eb142
update bookdown docs
invalid-email-address Nov 12, 2025
f614f21
Fix error on trial detail page if treatments but no traits
Nov 13, 2025
d742805
update bookdown docs
invalid-email-address Nov 13, 2025
5be53d8
Fix gitignore problem with docs
ryan-preble Jan 9, 2026
d0ee960
Fixing conflicts
ryan-preble Jan 9, 2026
dfc98b2
Change CWD usage and fix broken test
ryan-preble Jan 9, 2026
fe8a2f2
Fix unit_mech test
ryan-preble Jan 9, 2026
dfb339f
Fix unit_mech test
ryan-preble Jan 9, 2026
0e83460
Merge branch 'master' into topic/change_treatment_backend
ryan-preble Jan 29, 2026
a030474
Merge branch 'master' into topic/change_treatment_backend
ryan-preble Jan 29, 2026
7680391
Fix messed up merge
ryan-preble Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ docs/_site/
.DS_Store
sgn.iml
docs/*
!docs/r_markdown_docs
.idea/
!docs/r_markdown_docs/
!docs/r_markdown_docs/**
.idea/
324 changes: 324 additions & 0 deletions bin/convert_treatment_projects_to_phenotypes.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
=head1 NAME

convert_treatment_projects_to_phenotypes.pl - a script to take deprecated treatment/field_management_factor projects and turn them into treatment observations. Treatment projects will be deleted, and any treatments that are seen will be added to the experiment_treatment ontology.

=head1 SYNOPSIS

perl convert_treatment_projects_to_phenotypes.pl -H dbhost -D dbname -U user -P password -e username -t

=over 4

=item -H

The host of the database.

=item -D

The name of the database.

=item -U

The user executing this action (postgres by default)

=item -P

The database password.

=item -e

The signing user. Must be a user in the database.

=item -t

Test mode. Changes not committed.

=back

=head1 AUTHOR

Ryan Preble <rsp98@cornell.edu>

=cut

use strict;

use Getopt::Std;
use Pod::Usage;
use Bio::Chado::Schema;
use CXGN::Metadata::Schema;
use CXGN::Phenome::Schema;
use CXGN::People::Person;
use CXGN::DB::InsertDBH;
use Data::Dumper;
use SGN::Model::Cvterm;
use CXGN::Trial;
use CXGN::Phenotypes::StorePhenotypes;
use DateTime;
use Cwd;
use File::Temp qw/tempfile/;
use List::Util qw/max/;

our ($opt_H, $opt_D, $opt_U, $opt_P, $opt_e, $opt_t);

if (!$opt_U){
$opt_U = "postgres";
}

getopts('H:D:U:P:e:t')
or pod2usage();

my $dsn = 'dbi:Pg:database='.$opt_D.";host=".$opt_H.";port=5432";
my $schema= Bio::Chado::Schema->connect( $dsn, $opt_U, $opt_P, {
AutoCommit => 0,
RaiseError => 1
} );
my $dbh = $schema->storage()->dbh();
my $metadata_schema = CXGN::Metadata::Schema->connect(
sub { $dbh },
{ on_connect_do => ['SET search_path TO public,metadata;'] }
);
my $phenome_schema = CXGN::Phenome::Schema->connect(
sub { $dbh },
{ on_connect_do => ['SET search_path TO public,phenome;'] }
);
my $site_basedir = getcwd()."/..";
my $temp_basedir_key = `cat $site_basedir/sgn.conf $site_basedir/sgn_local.conf | grep tempfiles_subdir`;
my (undef, $temp_basedir) = split(/\s+/, $temp_basedir_key);
$temp_basedir = "$site_basedir/$temp_basedir";
if (! -d "$temp_basedir/delete_nd_experiment_ids/"){
mkdir("$temp_basedir/delete_nd_experiment_ids/");
}
my $signing_user_id = CXGN::People::Person->get_person_by_username($dbh, $opt_e); #not the db user, but the name attached as operator of new phenotypes

#definition of trials view
my $all_trials_q = "SELECT trial.project_id AS trial_id, trial.name as trial_name
FROM (((project breeding_program
JOIN project_relationship ON (((breeding_program.project_id = project_relationship.object_project_id) AND (project_relationship.type_id = ( SELECT cvterm.cvterm_id
FROM cvterm
WHERE ((cvterm.name)::text = 'breeding_program_trial_relationship'::text))))))
JOIN project trial ON ((project_relationship.subject_project_id = trial.project_id)))
JOIN projectprop ON ((trial.project_id = projectprop.project_id)))
WHERE (NOT (projectprop.type_id IN ( SELECT cvterm.cvterm_id
FROM cvterm
WHERE (((cvterm.name)::text = 'cross'::text) OR ((cvterm.name)::text = 'trial_folder'::text) OR ((cvterm.name)::text = 'folder_for_trials'::text) OR ((cvterm.name)::text = 'folder_for_crosses'::text) OR ((cvterm.name)::text = 'folder_for_genotyping_trials'::text)))))
GROUP BY trial.project_id, trial.name;";

#Give a description to all new treatment cvterms
my $update_new_treatment_sql = "UPDATE cvterm
SET definition = \'Legacy treatment from BreedBase before sgn-416.0 release. Binary value for treatment was/was not applied.\'
WHERE cvterm_id IN (SELECT unnest(string_to_array(?, ',')::int[]));";

my $relationship_cv = $schema->resultset("Cv::Cv")->find({ name => 'relationship'});
my $rel_cv_id;
if ($relationship_cv) {
$rel_cv_id = $relationship_cv->cv_id ;
} else {
die "No relationship ontology in DB.\n";
}
my $variable_relationship = $schema->resultset("Cv::Cvterm")->find({ name => 'VARIABLE_OF' , cv_id => $rel_cv_id });
my $variable_id;
if ($variable_relationship) {
$variable_id = $variable_relationship->cvterm_id();
}

my $experiment_treatment_cv = $schema->resultset("Cv::Cv")->find({ name => 'experiment_treatment'});
my $experiment_treatment_cv_id;
if ($experiment_treatment_cv) {
$experiment_treatment_cv_id = $experiment_treatment_cv->cv_id ;
} else {
die "No experiment_treatment CV found. Has DB patch been run?\n";
}
my $legacy_experiment_treatment = $schema->resultset("Cv::Cvterm")->find({ name => 'Legacy experiment treatment' , cv_id => $experiment_treatment_cv_id });
my $legacy_experiment_treatment_root_id;
if ($legacy_experiment_treatment) {
$legacy_experiment_treatment_root_id = $legacy_experiment_treatment->cvterm_id();
} else {
die "No legacy EXPERIMENT_TREATMENT root term. Has DB patch been run?\n";
}

my $get_db_accessions_sql = "SELECT accession FROM dbxref JOIN db USING (db_id) WHERE db.name='EXPERIMENT_TREATMENT';";

my $h = $schema->storage->dbh->prepare($get_db_accessions_sql);
$h->execute();

my @accessions;

while (my $accession = $h->fetchrow_array()) {
push @accessions, int($accession =~ s/^0+//r);
}

my $accession_start = max(@accessions) + 1;

$h = $schema->storage->dbh->prepare($all_trials_q);
$h->execute();

my %new_treatment_cvterms = (); # name => cvterm_id
my %new_treatment_full_names = (); # name => full name (with ontology)
my $dbxref_id = $accession_start;

my %trial_treatments = (); # holds the full names of all treatments
my $treatment_values_hash = {};
my %phenotype_store_stock_list = ();

my $time = DateTime->now();
my $timestamp = $time->ymd()."_".$time->hms();

while(my ($trial_id, $trial_name) = $h->fetchrow_array()) {

my $trial = CXGN::Trial->new({
bcs_schema => $schema,
trial_id => $trial_id
});

next if (ref($trial) ne 'CXGN::PhenotypingTrial'); #Skip if this is not a phenotyping trial

my $treatment_trials = $trial->get_treatment_projects();

next if (! @{$treatment_trials}); #skip if there are no treatment trials. Don't waste time getting plots or anything.

my $parent_observation_units = $trial->get_plots(); #get all plots

my $has_treatments = 0;

foreach my $treatment_trial (@{$treatment_trials}) {

$has_treatments = 1;

my $treatment_trial_name = $treatment_trial->[1];
my $treatment_trial_id = $treatment_trial->[0];

print STDERR "Found a treatment trial with ID $treatment_trial_id \n";

$treatment_trial = CXGN::Trial->new({
bcs_schema => $schema,
trial_id => $treatment_trial->[0]
});

my $observation_units = $treatment_trial->get_plots();
my %observation_units_lookup = map {$_->[0] => 1} @{$observation_units};

my $treatment_name = $treatment_trial_name =~ s/^$trial_name\_//r;
# $treatment_name =~ s/_/ /g;
# $treatment_name =~ s/[^\p{Alpha} ]//g;
$treatment_name = lc($treatment_name); #enforce all lowercase

my $treatment_id;
my $treatment_full_name;

if (!exists($new_treatment_cvterms{$treatment_name})) { #if this is a new treatment name, make new db entries and get cvterm ids
my $zeroes = "0" x (7-length($dbxref_id));
eval {
$treatment_id = $schema->resultset("Cv::Cvterm")->create_with({
name => $treatment_name,
cv => 'experiment_treatment',
db => 'EXPERIMENT_TREATMENT',
dbxref => "$zeroes"."$dbxref_id"
})->cvterm_id();

$new_treatment_cvterms{$treatment_name} = $treatment_id;
$treatment_full_name = "$treatment_name|EXPERIMENT_TREATMENT:$zeroes"."$dbxref_id";
$new_treatment_full_names{$treatment_name} = $treatment_full_name;
$trial_treatments{$treatment_full_name} = 1;

$schema->resultset("Cv::CvtermRelationship")->find_or_create({
object_id => $legacy_experiment_treatment_root_id,
subject_id => $treatment_id,
type_id => $variable_id
});
};
if ($@) {
die "An error occurred trying to create a new treatment! $@\n";
}
$dbxref_id++;
} else { #if not new treatment, get the treatment cvterm_id and full names
$treatment_id = $new_treatment_cvterms{$treatment_name};
$treatment_full_name = $new_treatment_full_names{$treatment_name};
$trial_treatments{$treatment_full_name} = 1;
}

foreach my $obs_unit (@{$parent_observation_units}){ #Construct the phenotype values hash
my $plot_name = $obs_unit->[1];
my $plot_id = $obs_unit->[0];
my $treatment_val = exists($observation_units_lookup{$plot_id}) ? 1 : 0;

my $plot = CXGN::Stock->new({
schema => $schema,
stock_id => $plot_id
});

$treatment_values_hash->{$plot_name}->{$treatment_full_name} = [
$treatment_val,
$timestamp,
$opt_e,
'',
''
];

my $plot_contents = $plot->get_child_stocks_flat_list(); #treatment values are inherited by child stocks

$phenotype_store_stock_list{$plot_name} = 1;

foreach my $child (@{$plot_contents}) {
next if ($child->{type} eq "accession"); #dont want to assign a phenotype to an accession, that would be bad
next if (! $child->{name}); # skip if we have no name
$treatment_values_hash->{$child->{name}}->{$treatment_full_name} = $treatment_values_hash->{$plot_name}->{$treatment_full_name};
$phenotype_store_stock_list{$child->{name}} = 1;
}
}

# $trial->remove_treatment_project($treatment_trial_id); # delete the treatment trial;
}
}

my $phenotype_metadata = { #make phenotype metadata
archived_file => 'none',
archived_file_type => 'treatment project conversion patch',
operator => $opt_e,
date => $timestamp
};

my (undef, $tempfile) = tempfile("$temp_basedir/delete_nd_experiment_ids/fileXXXX"); #tempfile

my $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new({
basepath => $temp_basedir,
dbhost => $opt_H,
dbname => $opt_D,
dbuser => $opt_U,
dbpass => $opt_P,
temp_file_nd_experiment_id => $tempfile,
bcs_schema => $schema,
metadata_schema => $metadata_schema,
phenome_schema => $phenome_schema,
user_id => $signing_user_id,
stock_list => [grep {defined($_) && $_ ne ''} keys(%phenotype_store_stock_list)],
trait_list => [keys(%trial_treatments)],
values_hash => $treatment_values_hash,
metadata_hash => $phenotype_metadata
});

my ($verified_warning, $verified_error) = $store_phenotypes->verify();

if ($verified_warning) {
warn $verified_warning;
}
if ($verified_error) {
die $verified_error;
}

my ($stored_phenotype_error, $stored_phenotype_success) = $store_phenotypes->store();

if ($stored_phenotype_error) {
die "An error occurred converting treatments: $stored_phenotype_error\n";
}

$h = $schema->storage->dbh->prepare($update_new_treatment_sql);
$h->execute(join(",", values(%new_treatment_cvterms)));

if ($opt_t) {
print STDERR "Test mode. Changes not committed.\n";
$schema->txn_rollback();
} else {
$schema->txn_commit();
}

1;
31 changes: 15 additions & 16 deletions bin/download_obo.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ =head1 NAME

=head1 SYNOPSIS

perl download_obo.pl -i prefix -H host -D dbname
perl download_obo.pl -i prefix -o out_directory -H host -D dbname -U dbuser -P dbpass

=head1 DESCRIPTION

Expand Down Expand Up @@ -70,7 +70,7 @@ =head1 AUTHOR

use strict;

use Getopt::Std;
use Getopt::Long;
use Data::Dumper;
use Try::Tiny;
use DateTime;
Expand All @@ -79,26 +79,25 @@ =head1 AUTHOR
use CXGN::DB::InsertDBH;
use File::Slurp;

our ($opt_H, $opt_D, $opt_U, $opt_P, $opt_i);
my ($dbhost, $dbname, $dbuser, $dbpass, $prefix, $outdir);

getopts('H:D:U:P:i:');
GetOptions(
'H=s' => \$dbhost,
'D=s' => \$dbname,
'U=s' => \$dbuser,
'P=s' => \$dbpass,
'i=s' => \$prefix,
'o=s' => \$outdir
);

my $dbhost = $opt_H;
my $dbname = $opt_D;
my $dbuser = $opt_U;
my $dbpass = $opt_P;
my $prefix = $opt_i;
print STDERR "Beginning obo dump to $outdir...\n";

my $dbh = CXGN::DB::InsertDBH->new( { dbhost=>$dbhost,
dbname=>$dbname,
dbargs => {AutoCommit => 0,
RaiseError => 1}
} );
my $dsn = 'dbi:Pg:database='.$dbname.";host=".$dbhost.";port=5432";

print STDERR "Connecting to database...\n";
my $schema= Bio::Chado::Schema->connect( sub { $dbh->get_actual_dbh() } );
my $schema = Bio::Chado::Schema->connect($dsn, $dbuser, $dbpass);

my $obo_file = $prefix . ".breedbase.obo";
my $obo_file = "$outdir/$prefix.breedbase.obo";

#resultset of all cvterms
my $cvterm_rs = $schema->resultset("Cv::Cvterm")->search(
Expand Down
Loading