2
# $Id: UpdateableSeqI.pm,v 1.4 2001/06/18 08:27:51 heikki Exp $
4
# BioPerl module for Bio::DB::UpdateableSeqI
6
# Cared for by Jason Stajich <jason@chg.mc.duke.edu>
8
# Copyright Jason Stajich
10
# You may distribute this module under the same terms as perl itself
13
# June 18, 2000 - module begun
15
# POD Doc - main docs before code
19
Bio::DB::UpdateableSeqI - An interface for writing to a database of sequences.
23
# get a Bio::DB::UpdateableSeqI somehow
25
my ( @updatedseqs, @newseqs, @deadseqs);
26
my $seq = $db->get_Seq_by_id('ROA1_HUMAN');
27
$seq->desc('a new description');
29
push @updatedseqs, $seq;
31
$db->write_seq(\@updatedseqs, \@newseqs, \@deadseqs);
34
print STDERR "an error when trying to write seq : $@\n";
39
This module seeks to provide a simple method for pushing sequence changes
40
back to a Sequence Database - which can be an SQL compliant database, a file
41
based database, AceDB, etc.
45
Jason Stajich E<lt>jason@chg.mc.duke.eduE<gt>
49
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and
50
their resolution. Bug reports can be submitted via email or the web:
52
bioperl-bugs@bioperl.org
53
http://www.bioperl.org/bioperl-bugs/
57
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
63
package Bio::DB::UpdateableSeqI;
71
@ISA = qw(Bio::DB::SeqI);
76
Usage : write_seq(\@updatedseqs, \@addedseqs, \@deadseqs)
77
Function: updates sequences in first array,
78
adds sequences in the second array,
79
and removes sequences in the third array.
82
Args : arrays of sequence objects that must be obtained from
83
Bio::DB::UpdateableSeqI.
90
$self->throw("Abstract database call of write_seq. Your database has not implemented this method!");
97
Usage : _add_seq($seq)
98
Function: Adds a new sequence
100
Returns : will throw an exception if
101
sequences accession number already exists
102
Args : a new seq object - should have an accession number
109
$self->throw("Abstract database call of _add_seq. Your database has not implemented this method!");
116
Usage : _remove_seq($seq)
117
Function: Removes an existing sequence
119
Returns : will throw an exception if
120
sequence does not exists for the primary_id
121
Args : a seq object that was retrieved from Bio::DB::UpdateableSeqI
128
$self->throw("Abstract database call of _remove_seq. Your database has not implemented this method!");
135
Usage : _update_seq($seq)
136
Function: Updates a sequence
138
Returns : will throw an exception if
139
sequence is out of sync from expected val.
140
Args : a seq object that was retrieved from Bio::DB::UpdateableSeqI
147
$self->throw("Abstract database call of _update_seq. Your database has not implemented this method!");
152
=head1 Methods inherieted from Bio::DB::RandomAccessI
156
Title : get_Seq_by_id
157
Usage : $seq = $db->get_Seq_by_id('ROA1_HUMAN')
158
Function: Gets a Bio::Seq object by its name
159
Returns : a Bio::Seq object
160
Args : the id (as a string) of a sequence
161
Throws : "id does not exist" exception
166
=head2 get_Seq_by_acc
168
Title : get_Seq_by_acc
169
Usage : $seq = $db->get_Seq_by_acc('X77802');
170
Function: Gets a Bio::Seq object by accession number
171
Returns : A Bio::Seq object
172
Args : accession number (as a string)
173
Throws : "acc does not exist" exception
178
=head1 Methods inheirited from Bio::DB::SeqI
180
=head2 get_PrimarySeq_stream
182
Title : get_PrimarySeq_stream
183
Usage : $stream = get_PrimarySeq_stream
184
Function: Makes a Bio::DB::SeqStreamI compliant object
185
which provides a single method, next_primary_seq
186
Returns : Bio::DB::SeqStreamI
192
=head2 get_all_primary_ids
195
Usage : @ids = $seqdb->get_all_primary_ids()
196
Function: gives an array of all the primary_ids of the
197
sequence objects in the database. These
198
maybe ids (display style) or accession numbers
199
or something else completely different - they
200
*are not* meaningful outside of this database
203
Returns : an array of strings
209
=head2 get_Seq_by_primary_id
211
Title : get_Seq_by_primary_id
212
Usage : $seq = $db->get_Seq_by_primary_id($primary_id_string);
213
Function: Gets a Bio::Seq object by the primary id. The primary
214
id in these cases has to come from $db->get_all_primary_ids.
215
There is no other way to get (or guess) the primary_ids
218
The other possibility is to get Bio::PrimarySeqI objects
219
via the get_PrimarySeq_stream and the primary_id field
220
on these objects are specified as the ids to use here.
221
Returns : A Bio::Seq object
222
Args : accession number (as a string)
223
Throws : "acc does not exist" exception