Added eval; site now shows clean dataset missing message instead of server error...
[sgn.git] / db / 00163 / AddGenomicPredictionStatCvterms.pm
blob75f92d17378bb5edfb4d2d377634c0bf4b6c85f6
1 #!/usr/bin/env perl
3 =head1 NAME
5 AddGenomicPredictionStatCvterms.pm
7 =head1 SYNOPSIS
9 mx-run ThisPackageName [options] -H hostname -D dbname -u username [-F]
11 this is a subclass of L<CXGN::Metadata::Dbpatch>
12 see the perldoc of parent class for more details.
14 =head1 DESCRIPTION
15 This patch adds genomic prediction analysis statistics cvterms.
16 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
18 =head1 AUTHOR
20 Isaak Y Tecle<iyt2@cornell.edu>
22 =head1 COPYRIGHT & LICENSE
24 Copyright 2010 Boyce Thompson Institute for Plant Research
26 This program is free software; you can redistribute it and/or modify
27 it under the same terms as Perl itself.
29 =cut
32 package AddGenomicPredictionStatCvterms;
34 use Moose;
35 use Bio::Chado::Schema;
36 use Try::Tiny;
37 extends 'CXGN::Metadata::Dbpatch';
40 has '+description' => ( default => <<'' );
41 Description of this patch goes here
43 has '+prereq' => (
44 default => sub {
45 [],
50 sub patch {
51 my $self=shift;
53 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
55 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
57 print STDOUT "\nExecuting the SQL commands.\n";
58 my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );
61 print STDERR "INSERTING Genomic Prediction statistics TERMS...\n";
62 my $dbhost = $self->dbhost;
63 my $dbname = $self->dbname;
65 `perl ~/cxgn/chado_tools/chado/bin/gmod_load_cvterms.pl -H $dbhost -D $dbname -r postgres -s SGNSTAT -d Pg ~/cxgn/sgn/ontology/cxgn_statistics.obo`;
67 print "\nYou're done!\n\n";
72 ####
73 1; #
74 ####