10 mx-run ThisPackageName [options] -H hostname -D dbname -u username [-F]
12 this is a subclass of L<CXGN::Metadata::Dbpatch>
13 see the perldoc of parent class for more details.
17 This patch creates the system cvterms that are needed for the cxgn databases.
18 Without these many pages and functions would not work since we are not using anymore the create_with BCS function for auto-creating new cvterms.
19 Instead all the needed cvterms need to be predefined in the databases.
20 This is important for the functionality and integrity of the databases, and for preventing overloading with redundant or obscure cvterms.
22 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
26 Naama Menda<nm249@cornell.edu>
28 =head1 COPYRIGHT & LICENSE
30 Copyright 2010 Boyce Thompson Institute for Plant Research
32 This program is free software; you can redistribute it and/or modify
33 it under the same terms as Perl itself.
38 package AddSystemCvterms
;
42 use Bio
::Chado
::Schema
;
44 extends
'CXGN::Metadata::Dbpatch';
47 has
'+description' => ( default => <<'' );
48 This patch will add
system cvterms required
for the functionality of the cxgn databases
59 print STDOUT
"Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
61 print STDOUT
"\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
63 print STDOUT
"\nExecuting the SQL commands.\n";
68 'calendar' => ['Planning Event',
75 'Presentation Event' ],
77 'experiment_type' => [ 'cross_experiment',
79 'genotyping_experiment',
81 'phenotyping_experiment' ],
82 'genotype_property' => ['igd number',
85 'local' => ['sp_person_id',
88 'nd_experiment_property' => [ 'cross_name',
90 'genotyping_project_name',
95 'organism_property' => [ 'organism_synonym' ],
97 'project_property' => [ 'breeding_program',
102 'project_relationship' => [ 'breeding_program_trial_relationship' ] ,
104 'project_type' => ['Advance Yield Trial',
105 'Preliminary Yield Trial',
106 'Uniform Yield Trial' ],
108 'stock_property' => ['block',
123 'stock_relationship' => [ 'cross_relationship',
130 'tissue_sample_of' ],
132 'stock_type' => ['accession',
133 'backcross population',
141 'training population',
142 'vector_construct' ],
144 'trait_property' => [ 'trait_categories',
145 'trait_default_value',
154 my $schema = Bio
::Chado
::Schema
->connect( sub { $self->dbh->clone } );
160 foreach my $cv_name ( keys %cvterms ) {
161 print "\nKEY = $cv_name \n\n";
162 my @cvterm_names = @
{$cvterms{ $cv_name } } ;
164 foreach my $cvterm_name ( @cvterm_names ) {
165 print "cvterm= $cvterm_name \n";
166 my $new_cvterm = $schema->resultset("Cv::Cvterm")->create_with(
168 name
=> $cvterm_name,
176 $schema->txn_do($coderef);
179 die "Load failed! " . $_ . "\n" ;
182 print "You're done!\n";