Permalink
Browse files

updated corba-client for round trip corba transfer - SeqDB client bin…

…dings added

svn path=/bioperl-corba-client/trunk/; revision=33
  • Loading branch information...
1 parent a6bd2c6 commit a5799511949c0a3f363314178ed3d39ef2f4e267 birney committed May 6, 2001
Showing with 254 additions and 3 deletions.
  1. +21 −0 Bio/CorbaClient/PrimarySeq.pm
  2. +13 −1 Bio/CorbaClient/Seq.pm
  3. +188 −0 Bio/CorbaClient/SeqDB.pm
  4. +32 −2 Bio/CorbaClient/SeqFeature.pm
@@ -177,6 +177,27 @@ sub accession_number {
return $self->corbaref->accession_number();
}
+sub accession {
+ my $self = shift;
+
+ return $self->accession_number;
+}
+
+sub seq_version {
+ my $self = shift;
+
+ return $self->version;
+}
+
+sub species {
+ my $self = shift;
+
+ $self->warn("biocorba does not support species yet!");
+
+ return undef;
+}
+
+
=head2 display_id
Title : display_id
@@ -63,6 +63,7 @@ use vars qw(@ISA);
use strict;
use Bio::CorbaClient::PrimarySeq;
+use Bio::CorbaClient::SeqFeature;
use Bio::SeqI;
@ISA = qw(Bio::CorbaClient::PrimarySeq Bio::SeqI);
@@ -124,7 +125,7 @@ sub all_SeqFeatures {
sub primary_seq {
my ($self) = @_;
return new Bio::CorbaClient::PrimarySeq('-corbaref' =>
- $self->corbaref->get_Primary_Seq());
+ $self->corbaref->get_PrimarySeq());
}
=head2 feature_count
@@ -150,4 +151,15 @@ sub feature_count {
return $count;
}
+sub annotation {
+ my $self = shift;
+
+ $self->warn("Biocorba does not implement annotations yet");
+
+ my $a = Bio::Annotation->new();
+
+ return $a;
+}
+
+
1;
@@ -0,0 +1,188 @@
+
+#
+# BioPerl module for Bio::CorbaClient::SeqDB
+#
+# Cared for by Ewan Birney <birney@ebi.ac.uk>
+#
+# Copyright Ewan Birney
+#
+# You may distribute this module under the same terms as perl itself
+
+# POD documentation - main docs before the code
+
+=head1 NAME
+
+Bio::CorbaClient::SeqDB - DESCRIPTION of Object
+
+=head1 SYNOPSIS
+
+Give standard usage here
+
+=head1 DESCRIPTION
+
+ Client bindings to make BioCorba SeqDB look like Bioperl SeqDB
+
+=head1 FEEDBACK
+
+=head2 Mailing Lists
+
+User feedback is an integral part of the evolution of this
+and other Bioperl modules. Send your comments and suggestions preferably
+ to one of the Bioperl mailing lists.
+Your participation is much appreciated.
+
+ bioperl-l@bio.perl.org
+
+=head2 Reporting Bugs
+
+Report bugs to the Bioperl bug tracking system to help us keep track
+ the bugs and their resolution.
+ Bug reports can be submitted via email or the web:
+
+ bioperl-bugs@bio.perl.org
+ http://bio.perl.org/bioperl-bugs/
+
+=head1 AUTHOR - Ewan Birney
+
+Email birney@ebi.ac.uk
+
+Describe contact details here
+
+=head1 APPENDIX
+
+The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
+
+=cut
+
+
+# Let the code begin...
+
+
+package Bio::CorbaClient::SeqDB;
+use vars qw(@ISA);
+use strict;
+use Bio::CorbaClient::Seq;
+use Bio::DB::SeqI;
+
+# Object preamble - inherits from Bio::Root::RootI
+
+use Bio::CorbaClient::Base;
+@ISA = qw(Bio::CorbaClient::Base Bio::DB::SeqI);
+
+
+# new() can be inherited from Bio::Root::RootI
+
+=head2 get_Seq_by_id
+
+ Title : get_Seq_by_id
+ Usage : $seq = $db->get_Seq_by_id('ROA1_HUMAN')
+ Function: Gets a Bio::Seq object by its name
+ Returns : a Bio::Seq object
+ Args : the id (as a string) of a sequence
+ Throws : "id does not exist" exception
+
+
+=cut
+
+sub get_Seq_by_id {
+ my $self = shift;
+ my $acc = shift;
+
+ my $seq = Bio::CorbaClient::Seq->new(-corbaref => $self->corbaref->get_Seq($acc,0));
+
+ return $seq;
+}
+
+
+=head2 get_Seq_by_acc
+
+ Title : get_Seq_by_acc
+ Usage : $seq = $db->get_Seq_by_acc('X77802');
+ Function: Gets a Bio::Seq object by accession number
+ Returns : A Bio::Seq object
+ Args : accession number (as a string)
+ Throws : "acc does not exist" exception
+
+
+=cut
+
+sub get_Seq_by_acc {
+ my $self = shift;
+ my $acc = shift;
+
+ my $seq = Bio::CorbaClient::Seq->new(-corbaref => $self->corbaref->get_Seq($acc,0));
+
+ return $seq;
+}
+
+
+=head1 Methods [that were] specific for Bio::DB::SeqI
+
+=head2 get_PrimarySeq_stream
+
+ Title : get_PrimarySeq_stream
+ Usage : $stream = get_PrimarySeq_stream
+ Function: Makes a Bio::DB::SeqStreamI compliant object
+ which provides a single method, next_primary_seq
+ Returns : Bio::DB::SeqStreamI
+ Args : none
+
+
+=cut
+
+sub get_PrimarySeq_stream{
+ my ($self,@args) = @_;
+
+ $self->throw("Have not implemented PrimarySeq streams in Corba binding layer. Should be easy");
+}
+
+=head2 get_all_primary_ids
+
+ Title : get_all_ids
+ Usage : @ids = $seqdb->get_all_primary_ids()
+ Function: gives an array of all the primary_ids of the
+ sequence objects in the database. These
+ maybe ids (display style) or accession numbers
+ or something else completely different - they
+ *are not* meaningful outside of this database
+ implementation.
+ Example :
+ Returns : an array of strings
+ Args : none
+
+
+=cut
+
+sub get_all_primary_ids{
+ my ($self,@args) = @_;
+
+ my @a = @{$self->corbaref->accession_numbers};
+
+ return @a;
+}
+
+
+=head2 get_Seq_by_primary_id
+
+ Title : get_Seq_by_primary_id
+ Usage : $seq = $db->get_Seq_by_primary_id($primary_id_string);
+ Function: Gets a Bio::Seq object by the primary id. The primary
+ id in these cases has to come from $db->get_all_primary_ids.
+ There is no other way to get (or guess) the primary_ids
+ in a database.
+
+ The other possibility is to get Bio::PrimarySeqI objects
+ via the get_PrimarySeq_stream and the primary_id field
+ on these objects are specified as the ids to use here.
+ Returns : A Bio::Seq object
+ Args : accession number (as a string)
+ Throws : "acc does not exist" exception
+
+
+=cut
+
+sub get_Seq_by_primary_id {
+ my ($self,$id) = @_;
+
+ return $self->get_Seq_by_acc($id);
+}
@@ -168,6 +168,33 @@ sub all_tags{
return @tags;
}
+=head2 each_tag_value
+
+ Title : each_tag_value
+ Usage :
+ Function:
+ Example :
+ Returns :
+ Args :
+
+
+=cut
+
+sub each_tag_value{
+ my ($self,$tag) = @_;
+
+ my $quals = $self->corbaref->qualifiers();
+ return () unless defined $quals;
+
+ foreach my $qual ( @$quals ) {
+ if( $qual->{name} eq $tag ) {
+ return @{$qual->{values}};
+ }
+ }
+ return ();
+}
+
+
=head2 location
Title : location
@@ -182,16 +209,19 @@ sub location {
my ($self) = @_;
my $locations = $self->corbaref->locations();
my $location;
- if( ! defined $locations || @$locations > 0 ) {
+ if( ! defined $locations || @$locations == 0 ) {
+ #print STDERR "Empty location! [$locations] yikes!\n";
$location = new Bio::Location::Simple;
} elsif( scalar @$locations > 1 ) {
$location = new Bio::Location::Split();
foreach my $l ( @$locations ) {
- $location->add_Sub_Location(&_create_location_from_biocorba_loc($l));
+ $location->add_sub_Location(&_create_location_from_biocorba_loc($l));
}
} else {
$location = &_create_location_from_biocorba_loc($locations->[0]);
}
+ #print STDERR "Client $location from biocorba... with ",$location->start," ",$location->end,"]\n";
+
return $location;
}

0 comments on commit a579951

Please sign in to comment.