remove variable attribute section for traits.
[sgn.git] / db / 00119 / AddAnalysisAndMixedModelCvterms.pm
bloba415ee9485fd50c9e44e0a47c0f0e3e318350ef6
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddAnalysisAndMixedModelCvterms
8 =head1 SYNOPSIS
10 mx-run AddAnalysisAndMixedModelCvterms [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.
15 =head1 DESCRIPTION
17 This dbpatch adds cvterms required for mixed models and analysis features.
19 =head1 AUTHOR
21 Lukas Mueller <lam87@cornell.edu>
23 =head1 COPYRIGHT & LICENSE
25 Copyright 2019 Boyce Thompson Institute for Plant Research
27 This program is free software; you can redistribute it and/or modify
28 it under the same terms as Perl itself.
30 =cut
33 package AddAnalysisAndMixedModelCvterms;
35 use Moose;
36 use Bio::Chado::Schema;
37 extends 'CXGN::Metadata::Dbpatch';
40 has '+description' => ( default => <<'' );
41 Adds cvterms required for mixed models and analysis features
43 has '+prereq' => (
44 default => sub {
45 [],
49 sub patch {
50 my $self=shift;
52 print STDERR "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
54 print STDERR "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
56 print STDERR "\nExecuting the SQL commands.\n";
58 my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );
62 print STDERR "INSERTING CV TERMS...\n";
64 $self->dbh->do("INSERT INTO nd_geolocation (description) values ('[Computation]')");
66 my $terms = {
67 project_property =>
69 "analysis_project",
70 "project_sp_person_id",
71 "analysis_metadata_json",
74 stock_type =>
76 "analysis_instance",
78 experiment_type =>
80 "analysis_experiment",
82 stock_relationship =>
84 "analysis_of",
90 foreach my $t (sort keys %$terms){
91 foreach (@{$terms->{$t}}){
92 $schema->resultset("Cv::Cvterm")->create_with(
94 name => $_,
95 cv => $t
96 });
99 print STDERR "Patch complete\n";
103 ####
104 1; #
105 ####