[BioSQL-l] Adding qualifers to features on a stored sequence

Hilmar Lapp hlapp@gnf.org
Mon, 21 Oct 2002 11:44:05 -0700


Yes, that's not handled very nicely. The problem is that tag/values are on-the-fly turned into Bio::Annotation::SimpleValue pairs (by using Bio::SeqFeature::AnnotationAdaptor), which are then stored. I.e., they are not retained as persistent objects.

I'll check your log and see whether I can fix this. In the meantime, what should work is

	$cds->remove();
	$cds->add_tag_value('foo', 'This is an added qualifier');
	$cds->create();

Let me know if it doesn't.

	-hilmar

> -----Original Message-----
> From: Tim Henderson [mailto:tjh@alodar.com]
> Sent: Saturday, October 19, 2002 11:21 PM
> To: biosql-l@open-bio.org
> Subject: [BioSQL-l] Adding qualifers to features on a stored sequence
> 
> 
> I've got a sequence stored in a mysql based BioSQL database, 
> and I want 
> to add a qualifier to one of the features on it.
> 
> By looking at the code in bioperl-db/t/seqfeature.t I was 
> able to figure 
> out how to add a new feature to an existing sequence; however, when I 
> tried to do a similar thing to add a new qualifier to an existing 
> feature, I got an error. What I tried was this:
> 
> # Assume these exist
> my $pseq;       # Sequence of interest, fetched from the database.
> my $cds;        # CDS feature on $pseq, got by searching
>                  # $pseq->top_SeqFeatures().
> 
> $cds->add_tag_value('foo', 'This is an added qualifier');
> $cds->store;
> 
> 
> I've included the debug output from my script below. The 
> problem seems 
> to be that insert statements are being generated for feature 
> qualifiers 
> that are already in the database. The new qualifier does make it into 
> the database, but the errors leave the feature in an 
> inconsistent state. 
> When I look in the database, its row in the seqfeature table has its 
> ontology_term_id field set to NULL.
> 
> I'm using the main trunk of bioperl-db. If this is one of 
> those things 
> that is broken for the time being, I'll jury rig something to 
> do what I 
> want by talking directly to the underlying tables. I just 
> wanted to use 
> the BioPerl API if I could.
> 
> 
> -- Tim
> 
> 
> attempting to load adaptor class for Bio::Location::Split
>          attempting to load module Bio::DB::BioSQL::SplitAdaptor
> attempting to load adaptor class for Bio::Location::Atomic
>          attempting to load module Bio::DB::BioSQL::AtomicAdaptor
> attempting to load adaptor class for Bio::Root::Root
>          attempting to load module Bio::DB::BioSQL::RootAdaptor
> attempting to load adaptor class for Bio::Root::RootI
>          attempting to load module Bio::DB::BioSQL::RootIAdaptor
>          attempting to load module Bio::DB::BioSQL::RootAdaptor
> attempting to load adaptor class for Bio::Ontology::Term
>          attempting to load module Bio::DB::BioSQL::TermAdaptor
> attempting to load adaptor class for Bio::Ontology::Term
>          attempting to load module Bio::DB::BioSQL::TermAdaptor
> attempting to load adaptor class for Bio::Ontology::Term
>          attempting to load module Bio::DB::BioSQL::TermAdaptor
> attempting to load adaptor class for Bio::Ontology::Term
>          attempting to load module Bio::DB::BioSQL::TermAdaptor
> preparing UPDATE statement: UPDATE seqfeature SET  
> seqfeature_rank = ?, 
>   bioentry_id = ?,  ontology_term_id = ?,  seqfeature_source_id = ? 
> WHERE seqfeature_id = ?
> binding column 1 to "6" (rank)
> binding column 2 to "1" (FK to bioentry)
> binding column 3 to "" (FK to ontology_term)
> binding column 4 to "" (FK to ontology_term)
> preparing UPDATE statement: UPDATE seqfeature_location SET  
> seq_start = 
> ?,  seq_end = ?,  seq_strand = ?,  location_rank = ?,  
> seqfeature_id = ? 
> WHERE seqfeature_location_id = ?
> binding column 1 to "796" (start)
> binding column 2 to "981" (end)
> binding column 3 to "1" (strand)
> binding column 4 to "1" (rank)
> binding column 5 to "6" (FK to seqfeature)
> binding column 1 to "1589" (start)
> binding column 2 to "1634" (end)
> binding column 3 to "1" (strand)
> binding column 4 to "2" (rank)
> binding column 5 to "6" (FK to seqfeature)
> binding column 1 to "1822" (start)
> binding column 2 to "1869" (end)
> binding column 3 to "1" (strand)
> binding column 4 to "3" (rank)
> binding column 5 to "6" (FK to seqfeature)
> binding column 1 to "2171" (start)
> binding column 2 to "2592" (end)
> binding column 3 to "1" (strand)
> binding column 4 to "4" (rank)
> binding column 5 to "6" (FK to seqfeature)
> attempting to load adaptor class for Bio::Annotation::Collection
>          attempting to load module Bio::DB::BioSQL::CollectionAdaptor
> attempting to load adaptor class for Bio::Annotation::TypeManager
>          attempting to load module Bio::DB::BioSQL::TypeManagerAdaptor
> no adaptor found for class Bio::Annotation::TypeManager
> attempting to load adaptor class for 
> Bio::DB::Persistent::PersistentObjectFactory
>          attempting to load module 
> Bio::DB::BioSQL::PersistentObjectFactoryAdaptor
> attempting to load adaptor class for Bio::Factory::ObjectFactoryI
>          attempting to load module 
> Bio::DB::BioSQL::ObjectFactoryIAdaptor
>          attempting to load module 
> Bio::DB::BioSQL::ObjectFactoryAdaptor
> no adaptor found for class 
> Bio::DB::Persistent::PersistentObjectFactory
> attempting to load driver for adaptor class 
> Bio::DB::BioSQL::AnnotationCollectionAdaptor
> Using Bio::DB::BioSQL::mysql::AnnotationCollectionAdaptorDriver as 
> driver peer for Bio::DB::BioSQL::AnnotationCollectionAdaptor
> attempting to load adaptor class for Bio::Ontology::Term
>          attempting to load module Bio::DB::BioSQL::TermAdaptor
> preparing UK select statement: SELECT ontology_term.ontology_term_id, 
> ontology_term.term_identifier, ontology_term.term_name, 
> ontology_term.term_definition, ontology_term.category_id FROM 
> ontology_term WHERE term_name = ?
> binding UK column 1 to "Annotation Tags" (name)
> preparing UK select statement: SELECT ontology_term.ontology_term_id, 
> ontology_term.term_name, NULL, ontology_term.category_id FROM 
> ontology_term WHERE category_id = ? AND term_name = ?
> binding UK column 1 to "5" (category)
> binding UK column 2 to "db_xref" (tagname)
> binding UK column 1 to "5" (category)
> binding UK column 2 to "codon_start" (tagname)
> binding UK column 1 to "5" (category)
> binding UK column 2 to "protein_id" (tagname)
> binding UK column 1 to "5" (category)
> binding UK column 2 to "foo" (tagname)
> preparing INSERT statement: INSERT INTO ontology_term (term_name, 
> category_id) VALUES (?, ?)
> binding column 1 to "foo" (tagname)
> binding column 2 to "5" (FK to Bio::Ontology::Term)
> binding UK column 1 to "5" (category)
> binding UK column 2 to "translation" (tagname)
> binding UK column 1 to "5" (category)
> binding UK column 2 to "product" (tagname)
> preparing INSERT statement: INSERT INTO seqfeature_qualifier_value 
> (seqfeature_id, ontology_term_id, qualifier_value, qualifier_rank) 
> VALUES (?, ?, ?, ?)
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "6" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "GI:37210" (value)
> binding column 4 to "1" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-6-1' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "6" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "SWISS-PROT:P01375" (value)
> binding column 4 to "2" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-6-2' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "17" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "1" (value)
> binding column 4 to "1" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-17-1' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "18" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "CAA26669.1" (value)
> binding column 4 to "1" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-18-1' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> binding UK column 1 to "5" (category)
> binding UK column 2 to "foo" (tagname)
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "27" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "This is an added qualifier" (value)
> binding column 4 to "1" (rank)
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "20" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to 
> "MSTESMIRDVELAEEALPKKTGGPQGSRRCLFLSLFSFLIVAGATTLFCLLHFGVIGPQRE
> EFPRDLSLISPLAQAVRSSSRTPSDKPVAHVVANPQAEGQLQWLNRRANALLANGVELRDNQ
> LVVPSEGLYLIYSQVLFKGQGCPSTHVLLTHTISRIAVSYQTKVNLLSAIKSPCQRETPEGA
> EAKPWYEPIYLGGVFQLEKGDRLSAEINRPDYLDFAESGQVYFGIIAL" 
> (value)
> binding column 4 to "1" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-20-1' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> binding column 1 to "6" (FK to Bio::SeqFeature::Generic)
> binding column 2 to "19" (FK to Bio::Annotation::SimpleValue)
> binding column 3 to "TNF-alpha" (value)
> binding column 4 to "1" (rank)
> DBD::mysql::st execute failed: Duplicate entry '6-19-1' for key 1 at 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm 
> line 366.
> 
> ------------- EXCEPTION  -------------
> MSG: failed to store one or more child objects for an 
> instance of class 
> Bio::SeqFeature::Generic (PK=6)
> STACK Bio::Root::RootI::warn 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/Root/Ro
> otI.pm:182
> STACK Bio::DB::BioSQL::BasePersistenceAdaptor::store 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/BioS
> QL/BasePersistenceAdaptor.pm:237
> STACK Bio::DB::Persistent::PersistentObject::store 
> /usr/people/sealsa/bioperl-dev/lib/perl5/site_perl/Bio/DB/Pers
> istent/PersistentObject.pm:266
> STACK (eval) ./add_feat_qual.pl:101
> STACK toplevel ./add_feat_qual.pl:100
> 
> --------------------------------------
> 
> 
> _______________________________________________
> BioSQL-l mailing list
> BioSQL-l@open-bio.org
> http://open-bio.org/mailman/listinfo/biosql-l
>