[BioSQL-l] storing features to the database

Hilmar Lapp hlapp at gnf.org
Wed Sep 7 13:22:53 EDT 2005


On Sep 6, 2005, at 10:31 AM, Amit Indap wrote:

> Hi,
>
> I have the following code that attempts to add a seq feature to a
> sequence in my biosql database:
>
> my $adp = $dbadp->get_object_adaptor("Bio::SeqI");
>
> my $seq = Bio::Seq->new(-accession => $acc,
>                                       --namespace =>$namespace,
>                                       -version = $ver);

Just first off - are the double dash in front of namespace and the 
equals after -version typos introduced by typing in a transcript, or 
are these verbatim in your script?

Otherwise there's nothing wrong in what I can see from your code, so it 
should certainly work.

Note that for testing whether the feature really gets serialized to the 
database you could run this with a single sequence and then check 
through SQL whether the additional feature is there.

Oh, BTW you do commit at some point, right? BioSQL is transactional and 
the adaptors disable autocommit by default, so if you never commit you 
disconnecting will roll back any changes. Usually you would call 
$dbseq->commit() after the store(), but it is up to you which series of 
operations you consider a transaction (i.e., exceptions happening 
within the transaction will want you to $dbseq->rollback()).

	-hilmar

>
> my $dbseq = $adp->find_by_unique_key($seq);
> my $feat = new Bio::SeqFeature::Generic(-primary_tag = >$primary_tag,
>                                                              -strand 
> => 1,
>                                                              -start => 
> 100,
>                                                              -end => 
> 10000,
>
> -source_tag => 'blat'
>                                                              );
>
> $dbseq->add_SeqFeature($feat);
> $dbseq->store;
>                                                              -
> I had ~20,000 sequences I added features to. Yet when I run another 
> script that
> lists features of sequences, these records come up with no features!
>
> I'm not really sure what's going on. I made sure my namespace and
> other parameters were correct. Maybe I should try and just run the
> script again.
>
> Thanks,
>
> Amit Indap
> Cornell University
>
> _______________________________________________
> BioSQL-l mailing list
> BioSQL-l at open-bio.org
> http://open-bio.org/mailman/listinfo/biosql-l
>
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------




More information about the BioSQL-l mailing list