Merge pull request #42 from solgenomics/topic/duplicate_image_warning
[cxgn-corelibs.git] / lib / SGN / Schema / Unigene.pm
blobdc8c67d7a7fd06c4abf2b4649dd4249b5e7bb166
1 package SGN::Schema::Unigene;
3 # Created by DBIx::Class::Schema::Loader
4 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6 use strict;
7 use warnings;
9 use base 'DBIx::Class::Core';
12 =head1 NAME
14 SGN::Schema::Unigene
16 =cut
18 __PACKAGE__->table("unigene");
20 =head1 ACCESSORS
22 =head2 unigene_id
24 data_type: 'integer'
25 is_auto_increment: 1
26 is_nullable: 0
27 sequence: 'unigene_unigene_id_seq'
29 =head2 unigene_build_id
31 data_type: 'integer'
32 is_foreign_key: 1
33 is_nullable: 1
35 =head2 consensi_id
37 data_type: 'integer'
38 is_foreign_key: 1
39 is_nullable: 1
41 =head2 cluster_no
43 data_type: 'bigint'
44 is_nullable: 1
46 =head2 contig_no
48 data_type: 'bigint'
49 is_nullable: 1
51 =head2 nr_members
53 data_type: 'bigint'
54 is_nullable: 1
56 =head2 database_name
58 data_type: 'text'
59 default_value: 'SGN'
60 is_nullable: 0
61 original: {data_type => "varchar"}
63 =head2 sequence_name
65 data_type: 'bigint'
66 is_nullable: 0
68 =cut
70 __PACKAGE__->add_columns(
71 "unigene_id",
73 data_type => "integer",
74 is_auto_increment => 1,
75 is_nullable => 0,
76 sequence => "unigene_unigene_id_seq",
78 "unigene_build_id",
79 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
80 "consensi_id",
81 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
82 "cluster_no",
83 { data_type => "bigint", is_nullable => 1 },
84 "contig_no",
85 { data_type => "bigint", is_nullable => 1 },
86 "nr_members",
87 { data_type => "bigint", is_nullable => 1 },
88 "database_name",
90 data_type => "text",
91 default_value => "SGN",
92 is_nullable => 0,
93 original => { data_type => "varchar" },
95 "sequence_name",
96 { data_type => "bigint", is_nullable => 0 },
98 __PACKAGE__->set_primary_key("unigene_id");
100 =head1 RELATIONS
102 =head2 blast_annotations
104 Type: has_many
106 Related object: L<SGN::Schema::BlastAnnotation>
108 =cut
110 __PACKAGE__->has_many(
111 "blast_annotations",
112 "SGN::Schema::BlastAnnotation",
113 { "foreign.apply_id" => "self.unigene_id" },
114 { cascade_copy => 0, cascade_delete => 0 },
117 =head2 cds
119 Type: has_many
121 Related object: L<SGN::Schema::Cd>
123 =cut
125 __PACKAGE__->has_many(
126 "cds",
127 "SGN::Schema::Cd",
128 { "foreign.unigene_id" => "self.unigene_id" },
129 { cascade_copy => 0, cascade_delete => 0 },
132 =head2 primer_unigene_matches
134 Type: has_many
136 Related object: L<SGN::Schema::PrimerUnigeneMatch>
138 =cut
140 __PACKAGE__->has_many(
141 "primer_unigene_matches",
142 "SGN::Schema::PrimerUnigeneMatch",
143 { "foreign.unigene_id" => "self.unigene_id" },
144 { cascade_copy => 0, cascade_delete => 0 },
147 =head2 rflp_unigene_associations
149 Type: has_many
151 Related object: L<SGN::Schema::RflpUnigeneAssociation>
153 =cut
155 __PACKAGE__->has_many(
156 "rflp_unigene_associations",
157 "SGN::Schema::RflpUnigeneAssociation",
158 { "foreign.unigene_id" => "self.unigene_id" },
159 { cascade_copy => 0, cascade_delete => 0 },
162 =head2 ssr_primer_unigenes_matches
164 Type: has_many
166 Related object: L<SGN::Schema::SsrPrimerUnigeneMatches>
168 =cut
170 __PACKAGE__->has_many(
171 "ssr_primer_unigenes_matches",
172 "SGN::Schema::SsrPrimerUnigeneMatches",
173 { "foreign.unigene_id" => "self.unigene_id" },
174 { cascade_copy => 0, cascade_delete => 0 },
177 =head2 consensi
179 Type: belongs_to
181 Related object: L<SGN::Schema::UnigeneConsensi>
183 =cut
185 __PACKAGE__->belongs_to(
186 "consensi",
187 "SGN::Schema::UnigeneConsensi",
188 { consensi_id => "consensi_id" },
190 is_deferrable => 1,
191 join_type => "LEFT",
192 on_delete => "CASCADE",
193 on_update => "CASCADE",
197 =head2 unigene_build
199 Type: belongs_to
201 Related object: L<SGN::Schema::UnigeneBuild>
203 =cut
205 __PACKAGE__->belongs_to(
206 "unigene_build",
207 "SGN::Schema::UnigeneBuild",
208 { unigene_build_id => "unigene_build_id" },
210 is_deferrable => 1,
211 join_type => "LEFT",
212 on_delete => "CASCADE",
213 on_update => "CASCADE",
217 =head2 unigene_members
219 Type: has_many
221 Related object: L<SGN::Schema::UnigeneMember>
223 =cut
225 __PACKAGE__->has_many(
226 "unigene_members",
227 "SGN::Schema::UnigeneMember",
228 { "foreign.unigene_id" => "self.unigene_id" },
229 { cascade_copy => 0, cascade_delete => 0 },
233 # Created by DBIx::Class::Schema::Loader v0.07002 @ 2012-03-03 12:35:39
234 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HYSA+SrdRkUswvQeCSfweQ
236 use Carp ();
238 sub seq {
239 my ($self) = @_;
241 if( $self->nr_members > 1 ) {
242 return $self->consensi->seq;
243 } elsif( $self->nr_members == 1 ) {
244 return $self->unigene_members->single->est->hqi_seq;
245 } else {
246 Carp::confess( 'unigene SGN-U'.$self->unigene_id.' has invalid nr_members ('.$self->nr_members.')' );
251 # You can replace this text with custom content, and it will be preserved on regeneration