[Bioperl-l] Re: Finally coding...

Chris Mungall cjm@fruitfly.org
Wed, 12 Jun 2002 13:44:07 -0700 (PDT)


On Wed, 12 Jun 2002, Elia Stupka wrote:

> Hi Chris,
>
> I am finally back in linux and have some coding time after 6 months of
> hectic times...
>
> ...I am trying to clean up little bits and bobs in bioperl-db. I removed
> some warnings in the tests, and now I find that when you moved to the
> ontology system, you added a method to store qualifiers for locations, and
> you do something that I can't really follow...
>
> you store both the actual qualifier value as well as a forced int() of the
> value (see snippet below). This barfs when the qualifier is something like
> "BEFORE", "AFTER", "EXACT", "WITHIN", "BEFORE" and not an int (found in
> fuzzy and split locations)... was this intentional?
>
> I guess I am just clibing my backlog of missed knowledge, what's the
> purpose of keeping an int value in the table since you can get it on the
> fly anyway?

The rationale was that if you want to do SQL based on fuzzy ranges, you
have to cast it which is slow, and I think the syntax differs depending on
the dbms. By pre-casting you avoid this. But this is a somewhat arbitrary
decision; why not have int/float slots for all qualifier_values?

I'm happy enough to see this go and live with the sql cast

regarding the code, sounds like I should have checked for /\d+/ before
using int()

> Elia
> Code:
> self->insert("location_qualifier_value",
>                    {seqfeature_qualifier_id=>$qual_id,
>                     seqfeature_location_id=>$loc_id,
>                     qualifier_value=>$slot,
>                     qualifier_int_value=>int($slot)});
>
>
>