11 package CXGN
::Insitu
::Probe
;
13 use CXGN
::Insitu
::Experiment
;
15 use base qw
/ CXGN::Insitu::DB /;
33 my $self = $class->SUPER::new
($dbh);
36 $self->set_probe_id($id);
56 my $query = "SELECT probe_id,
70 WHERE insitu.probe.probe_id=?";
71 my $sth = $self->get_dbh()->prepare($query);
72 $sth->execute($self->get_probe_id());
73 my ($probe_id, $name, $sequence, $clone, $link_desc, $link, $dbxref_type_id, $identifier, $primer1,
74 $primer1_seq, $primer2, $primer2_seq, $user_id) =
75 $sth->fetchrow_array();
76 $self->set_probe_id($probe_id);
77 $self->set_name($name);
78 $self->set_sequence($sequence);
79 $self->set_clone($clone);
80 $self->set_link_desc($link_desc);
81 $self->set_link($link);
82 $self->set_dbxref_type_id($dbxref_type_id);
83 $self->set_identifier($identifier);
84 $self->set_primer1($primer1);
85 $self->set_primer1_seq($primer1_seq);
86 $self->set_primer2($primer2);
87 $self->set_primer2_seq($primer2_seq);
88 $self->set_user_id($user_id);
93 if ($self->get_probe_id()) {
94 my $query = "UPDATE insitu.probe SET
109 my $sth = $self->get_dbh()->prepare($query);
110 $sth->execute($self->get_name(),
111 $self->get_sequence(),
113 $self->get_link_desc(),
115 $self->get_dbxref_type_id(),
116 $self->get_identifier(),
117 $self->get_primer1(),
118 $self->get_primer1_seq(),
119 $self->get_primer2(),
120 $self->get_primer2_seq(),
121 $self->get_user_id(),
122 $self->get_probe_id()
124 return $self->get_probe_id();
127 my $query = "INSERT INTO insitu.probe (
128 name, sequence, clone, link_desc, link, dbxref_type_id, identifier, primer1, primer1_seq, primer2, primer2_seq, user_id
130 ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?)";
131 my $sth = $self->get_dbh()->prepare($query);
132 $sth->execute($self->get_name(),
133 $self->get_sequence(),
135 $self->get_link_desc(),
137 $self->get_dbxref_type_id(),
138 $self->get_identifier(),
139 $self->get_primer1(),
140 $self->get_primer1_seq(),
141 $self->get_primer2(),
142 $self->get_primer2_seq(),
143 $self->get_user_id(),
145 return $self->get_dbh()->last_insert_id("probe");
152 if (!$self->get_probe_id()) { # can't delete if not in db
155 if ($self->get_experiments()) { # can't delete if has experiments
158 my $query = "UPDATE insitu.probe SET
160 WHERE probe.probe_id =?";
161 my $sth = $self->get_dbh()->prepare($query);
162 $sth->execute($self->get_probe_id());
180 return $self->{probe_id
};
197 $self->{probe_id
}=shift;
215 return $self->{name
};
248 return $self->{sequence
};
265 $self->{sequence
}=shift;
281 return $self->{clone
};
298 $self->{clone
}=shift;
314 return $self->{link_desc
};
331 $self->{link_desc
}=shift;
347 return $self->{link};
367 =head2 get_dbxref_type_id
378 sub get_dbxref_type_id
{
380 return $self->{dbxref_type_id
};
384 =head2 set_dbxref_type_id
395 sub set_dbxref_type_id
{
397 $self->{dbxref_type_id
}=shift;
401 =head2 get_identifier
414 return $self->{identifier
};
418 =head2 set_identifier
431 $self->{identifier
}=shift;
447 return $self->{primer1
};
464 $self->{primer1
}=shift;
467 =head2 get_primer1_seq
478 sub get_primer1_seq
{
480 return $self->{primer1_seq
};
484 =head2 set_primer1_seq
495 sub set_primer1_seq
{
497 $self->{primer1_seq
}=shift;
513 return $self->{primer2
};
530 $self->{primer2
}=shift;
533 =head2 get_primer2_seq
544 sub get_primer2_seq
{
546 return $self->{primer2_seq
};
550 =head2 set_primer2_seq
561 sub set_primer2_seq
{
563 $self->{primer2_seq
}=shift;
581 return $self->{antibody
};
598 $self->{antibody
}=shift;
614 return $self->{comments
};
631 $self->{comments
}=shift;
650 return $self->{user_id
};
667 $self->{user_id
}=shift;
670 =head2 get_experiments
681 sub get_experiments
{
683 my $query = "SELECT experiment_id
684 FROM insitu.experiment
687 WHERE probe.probe_id=?";
689 my $sth = $self->get_dbh()->prepare($query);
690 $sth->execute($self->get_probe_id());
691 my @experiments = ();
692 while (my ($experiment_id) = $sth->fetchrow_array()) {
693 print STDERR
"Instantiating experiment with id = $experiment_id\n";
694 my $experiment = CXGN
::Insitu
::Experiment
->new($self->get_dbh(),$experiment_id);
695 push @experiments, $experiment;
696 print STDERR
"experiment: ".$experiment->get_experiment_id()."\n";
719 # "Name: ". $self->get_name() ."<br />".
720 # "Sequence: ".$self->get_sequence()."<br />".
721 # "Link: ".$self->get_link()."<br />\n";
725 =head2 get_all_probes
728 Desc: static function that retrieves two lists,
729 one with probe names and one with probe ids.
730 Ret: ($names_array_ref, $ids_array_ref)
739 my $query = "SELECT probe_id, name
741 my $sth = $dbh->prepare($query);
746 while (my ($probe_id, $name) = $sth->fetchrow_array()) {
748 push @ids, $probe_id;
750 return (\
@names, \
@ids);