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 is a patch for creating a new sgn.snp table for storing snps ...
18 Motivation is the new genotyping data from the SolCAP project
20 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
24 Naama Menda<nm249@cornell.edu>
26 =head1 COPYRIGHT & LICENSE
28 Copyright 2010 Boyce Thompson Institute for Plant Research
30 This program is free software; you can redistribute it and/or modify
31 it under the same terms as Perl itself.
36 package CreateSnpTable
;
39 extends
'CXGN::Metadata::Dbpatch';
41 use Bio
::Chado
::Schema
;
45 my $name = __PACKAGE__
;
46 print "dbpatch name is ':" . $name . "\n\n";
47 my $description = 'Adding new sgn snp table';
48 my @previous_requested_patches = (); #ADD HERE
50 $self->description($description);
51 $self->prereq(\
@previous_requested_patches);
57 print STDOUT
"Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
59 print STDOUT
"\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
61 print STDOUT
"\nExecuting the SQL commands.\n";
63 $self->dbh->do(<<EOSQL);
66 CREATE TABLE sgn.snp (
67 snp_id serial PRIMARY KEY,
68 marker_id integer REFERENCES sgn.marker(marker_id),
69 reference_nucleotide varchar(4),
70 snp_nucleotide varchar(4) NOT NULL,
71 confirmed boolean DEFAULT false,
72 sequence_left_id integer REFERENCES sgn.sequence(sequence_id),
73 sequence_right_id integer REFERENCES sgn.sequence(sequence_id),
74 reference_stock_id integer REFERENCES public.stock(stock_id),
75 stock_id integer NOT NULL REFERENCES public.stock(stock_id),
76 metadata_id integer REFERENCES metadata.md_metadata(metadata_id)
78 CREATE TABLE sgn.snpprop (
79 snpprop_id serial PRIMARY KEY,
80 snp_id integer REFERENCES sgn.snp(snp_id),
81 value varchar(255) NOT NULL,
83 type_id integer REFERENCES public.cvterm(cvterm_id)
87 CREATE TABLE sgn.snp_file (
88 snp_file_id serial PRIMARY KEY,
89 snp_id integer NOT NULL REFERENCES sgn.snp(snp_id),
90 file_id integer NOT NULL REFERENCES metadata.md_files(file_id)
93 --grant permissions to web_usr
94 grant SELECT on sgn.snp to web_usr ;
95 grant SELECT on sgn.snp_snp_id_seq TO web_usr ;
97 grant SELECT on sgn.snpprop to web_usr ;
98 grant SELECT on sgn.snpprop_snpprop_id_seq TO web_usr ;
100 grant SELECT on sgn.snp_file to web_usr ;
101 grant SELECT on sgn.snp_file_snp_file_id_seq TO web_usr ;
105 print "You're done!\n";