Merge pull request #4846 from solgenomics/topic/another_merge_script_fix
[sgn.git] / db / 00164 / AddVectorStockProps.pm
blobc2a6089952abab3d3230a7f6de2615736e1a63cb
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddVectorStockProps.pm
8 =head1 SYNOPSIS
10 mx-run AddVectorStockProps [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 is a test dummy patch.
18 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
20 =head1 AUTHOR
22 Mirella Flores <mrf252@cornell.edu>
24 =head1 COPYRIGHT & LICENSE
26 Copyright 2010 Boyce Thompson Institute for Plant Research
28 This program is free software; you can redistribute it and/or modify
29 it under the same terms as Perl itself.
31 =cut
34 package AddVectorStockProps;
36 use Moose;
37 use Bio::Chado::Schema;
38 use Try::Tiny;
39 extends 'CXGN::Metadata::Dbpatch';
42 has '+description' => ( default => <<'' );
43 This patch will find_or_create a cvterm for vectors
45 has '+prereq' => (
46 default => sub {
47 [],
51 sub patch {
52 my $self=shift;
54 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
56 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
58 print STDOUT "\nExecuting the SQL commands.\n";
60 my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );
62 my $coderef = sub {
64 my $vector_stockprop_SelectionMarker_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
65 name => 'SelectionMarker',
66 cv => 'stock_property',
67 });
68 my $vector_stockprop_CloningOrganism_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
69 name => 'CloningOrganism',
70 cv => 'stock_property',
71 });
72 my $vector_stockprop_CassetteName_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
73 name => 'CassetteName',
74 cv => 'stock_property',
75 });
77 my $vector_stockprop_InherentMarker_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
78 name => 'InherentMarker',
79 cv => 'stock_property',
80 });
81 my $vector_stockprop_Strain_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
82 name => 'Strain',
83 cv => 'stock_property',
84 });
85 my $vector_stockprop_Backbone_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
86 name => 'Backbone',
87 cv => 'stock_property',
88 });
90 my $vector_stockprop_Gene_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
91 name => 'Gene',
92 cv => 'stock_property',
93 });
94 my $vector_stockprop_Promotors_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
95 name => 'Promotors',
96 cv => 'stock_property',
97 });
98 my $vector_stockprop_Terminators_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
99 name => 'Terminators',
100 cv => 'stock_property',
106 try {
107 $schema->txn_do($coderef);
109 } catch {
110 die "Load failed! " . $_ . "\n" ;
113 print "You're done!\n";
117 ####
118 1; #
119 ####