5 CXGN::SNP - a class to deal with SNP information.
9 This class deals with a single SNP (Simple Nucleotide Polymorphism) - it can be used to store, modify, or delete information about a SNP. The term SNP is interpreted broadly and includes indels as well as polymorphisms that may include several nucleotides.
11 For SNP querying of aggregate information, use the L<CXGN::SNP::Query> class [not yet implemented].
13 It inherits from L<CXGN::DB::ModifiableI>.
15 SNPs are linked to sequences and accessions, and specify the base change. In addition, SNPs can be linked to markers that exploit that SNP, and to other meta information, such as who submitted the information, if it is experimentally verified, and the method of discovery.
19 Lukas Mueller <lam87@cornell.edu>
23 This class implements the following methods:
32 use base qw
| CXGN
::DB
::ModifiableI
|;
49 my $self = $class->SUPER::new
($dbh);
51 $self->set_snp_id($id);
73 my $q = "SELECT snp_id,
78 reference_accession_id,
88 my $h = $self->get_dbh()->prepare($q);
90 $h->execute($self->get_snp_id());
92 my ($snp_id, $reference_unigene_id, $reference_position, $primer_left_id, $primer_right_id, $reference_accession_id, $snp_accession_id, $reference_nucleotide, $snp_nucleotide, $sp_person_id, $modified_date, $create_date, $obsolete) = $h->fetchrow_array();
94 $self->set_snp_id($snp_id);
95 $self->set_reference_unigene_id($reference_unigene_id);
96 $self->set_reference_position($reference_position);
97 $self->set_primer_left_id($primer_left_id);
98 $self->set_primer_right_id($primer_right_id);
99 $self->set_reference_accession_id($reference_accession_id);
100 $self->set_snp_accession_id($snp_accession_id);
101 $self->set_reference_nucleotide($reference_nucleotide);
102 $self->set_snp_nucleotide($snp_nucleotide);
103 $self->set_sp_person_id($sp_person_id);
104 $self->set_modified_date($modified_date);
105 $self->set_create_date($create_date);
106 $self->set_obsolete($obsolete);
127 if ($self->get_snp_id()) {
128 my $q = "UPDATE sgn.snp SET
129 reference_unigene_id=?,
130 reference_position=?,
133 reference_accession_id=?,
135 reference_nucleotide=?,
142 my $h = $self->get_dbh()->prepare($q);
144 $self->get_reference_unigene_id(),
145 $self->get_reference_position(),
146 $self->get_primer_left_id(),
147 $self->get_primer_right_id(),
148 $self->get_reference_accession_id(),
149 $self->get_snp_accession_id(),
150 $self->get_snp_nucleotide(),
151 $self->get_sp_person_id(),
152 $self->get_obsolete(),
157 my $q = "INSERT INTO sgn.snp
158 (reference_unigene_id,
162 reference_accession_id,
164 reference_nucleotide,
170 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW(), ?)";
171 my $h = $self->get_dbh()->prepare($q);
180 =Head2_snp_id
, set_snp_id
192 return $self->{snp_id
};
197 $self->{snp_id
} = shift;
200 =head2 accessors get_position, set_position
212 return $self->{position
};
217 $self->{position
} = shift;
219 =head2 accessors get_reference_nucleotide, set_reference_nucleotide
229 sub get_reference_nucleotide
{
231 return $self->{reference_nucleotide
};
234 sub set_reference_nucleotide
{
236 $self->{reference_nucleotide
} = shift;
238 =head2 accessors get_snp_nucleotide, set_snp_nucleotide
248 sub get_snp_nucleotide
{
250 return $self->{snp_nucleotide
};
253 sub set_snp_nucleotide
{
255 $self->{snp_nucleotide
} = shift;
259 =head2 accessors get_reference_accession_id, set_reference_accession_id
269 sub get_reference_accession_id
{
271 return $self->{reference_accession_id
};
274 sub set_reference_accession_id
{
276 $self->{reference_accession_id
} = shift;
279 =head2 accessors get_snp_accession_id, set_snp_accession_id
289 sub get_snp_accession_id
{
291 return $self->{snp_accession_id
};
294 sub set_snp_accession_id
{
296 $self->{snp_accession_id
} = shift;
300 =head2 accessors get_dbxrefs, set_dbxrefs
312 return $self->{dbxrefs
};
317 $self->{dbxrefs
} = shift;
369 CREATE TABLE sgn
.snp
(
370 snp_id serial primary key
,
371 reference_unigene_id bigint references sgn
.unigene
,
372 reference_position bigint
,
373 primer_left_id bigint references sgn
."sequence",
374 primer_right_id bigint references sgn
."sequence",
375 reference_accession_id bigint references sgn
.accession
,
376 snp_accession_id bigint references sgn
.accession
,
377 reference_nucleotide varchar
(1),
378 snp_nucleotide varchar
(1),
379 sp_person_id bigint REFERENCES sgn_people
.sp_person
,
380 modified_date timestamp with
time zone
,
381 create_date timestamp with
time zone
,
382 obsolete boolean
default false
389 $dbh->do("GRANT SELECT, UPDATE, INSERT ON sgn.snp TO web_usr");
390 $dbh->do("GRANT SELECT, UPDATE, INSERT ON snp_snp_id_seq TO web_usr");
393 CREATE TABLE sgn
.snp_marker
(
394 snp_marker_id serial primary key
,
395 snp_id bigint references sgn
.snp
,
396 marker_id bigint references sgn
.marker
402 $dbh->do("GRANT SELECT, UPDATE, INSERT ON sgn.snp_marker TO web_usr");
403 $dbh->do("GRANT SELECT, UPDATE, INSERT ON sgn.snp_marker_snp_marker_id_seq TO web_usr");
406 my $x = " CREATE TABLE sgn.snp_dbxref (
407 snp_dbxref_id serial primary key,
408 snp_id bigint references sgn.snp,
409 dbxref_id bigint references public.dbxref,
411 sp_person_id bigint references sgn_people.sp_person,
412 create_date timestamp with time zone,
413 modified_date timestamp with time zone
418 $dbh->do("GRANT SELECT, UPDATE, INSERT ON sgn.snp_dbxref TO web_usr");
419 $dbh->do("GRANT SELECT, UPDATE, INSERT ON sgn.snp_dbxref_snp_dbxref_id_seq TO web_usr");