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

Hilmar Lapp lapp@gnf.org
Mon, 21 Oct 2002 17:02:08 -0700 (PDT)


I cannot reproduce this on my Mysql version (4.0.4 beta). Which version of 
MySQL are you running?

Have you issued any ALTER TABLE or CREATE INDEX statements against 
seqfeature_qualifier_value (MySQL < 3.23.{50,51 - not sure} had the 
problem of losing all FK constraints in this case on the respective 
table). Does the problem persist if you at the Mysql prompt say

ALTER TABLE seqfeature_qualifier_value ADD CONSTRAINT 
FKseqfeature_featqual
        FOREIGN KEY (seqfeature_id) REFERENCES seqfeature(seqfeature_id)
        ON DELETE CASCADE;

(Note: with the orphans in place this statement will fail; you first need 
to delete all orphans.)

If this is active and honored, those records really should go away if the
seqfeature goes away ... Let me know what you observe.

	-hilmar
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp@gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------

On Mon, 21 Oct 2002, Tim Henderson wrote:

>  > 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();
>  >
> 
> That worked. Thanks.
> 
> I did notice, though, that the $cds->remove() left some traces of the 
> old feature in the database. For reference, I'm using a test database 
> with one sequence in it, loaded via load_seqdatabase.pl from the GenBank 
> record for accession X02910. The primary key of the original  CDS 
> feature was 6; after doing the above update the primary key of the new 
> CDS feature was 24. Browsing through my database, I see...
> 
> mysql> select * from seqfeature where seqfeature_id = 6;
> Empty set (0.01 sec)
> 
> mysql> select * from seqfeature_location where seqfeature_id = 6;
> Empty set (0.00 sec)
> 
> mysql> select * from seqfeature_relationship where parent_seqfeature_id 
> = 6 or child_seqfeature_id = 6;
> Empty set (0.02 sec)
> 
> mysql> select seqfeature_id, term_name, qualifier_value from 
> seqfeature_qualifier_value t1, ontology_term t2 where t1.seqfeature_id = 
> 6 and t1.ontology_term_id = t2.ontology_term_id;
> 
> +---------------+-------------+----------------------------
> | seqfeature_id | term_name   | qualifier_value 
>  
>  
> 
> +---------------+-------------+----------------------------
> |             6 | db_xref     | GI:37210 
>  
>  
> 
> |             6 | db_xref     | SWISS-PROT:P01375 
>  
>  
> 
> |             6 | codon_start | 1 
>  
>  
> 
> |             6 | protein_id  | CAA26669.1 
>  
>  
> 
> |             6 | product     | TNF-alpha 
>  
>  
> 
> |             6 | translation | MSTESMIRDVELAEEALPKKTGGP...
> +---------------+-------------+----------------------------
> 6 rows in set (0.01 sec)
> 
> mysql> select seqfeature_id, term_name, qualifier_value from 
> seqfeature_qualifier_value t1, ontology_term t2 where t1.seqfeature_id = 
> 24  and t1.ontology_term_id = t2.ontology_term_id;
> +---------------+-------------+----------------------------
> | seqfeature_id | term_name   | qualifier_value 
>  
>  
> 
> +---------------+-------------+----------------------------
> |            24 | db_xref     | GI:37210 
>  
>  
> 
> |            24 | db_xref     | SWISS-PROT:P01375 
>  
>  
> 
> |            24 | codon_start | 1 
>  
>  
> 
> |            24 | protein_id  | CAA26669.1 
>  
>  
> 
> |            24 | product     | TNF-alpha 
>  
>  
> 
> |            24 | translation | MSTESMIRDVELAEEALPKKTGGP...
> |            24 | foo         | This is an added qualifier
> +---------------+-------------+----------------------------
> 7 rows in set (0.00 sec)
> 
> 
> These orphaned entries don't seem to be causing any problems, but I 
> thought I'd point them out.
> 
> 
> -- Tim
> 
> 
>