IUBio

How to test for existence of nothing

Keith Bradnam krb at sanger.ac.uk
Thu Jul 19 10:29:04 EST 2001


On 19 Jul 2001, Keith Bradnam wrote:
 
> Any acedb query gurus out there who can help me with a problem?
> 
> It might be that it's beyond the capabilities of the acedb query language
> in which case Ed will set me straight.
> 
> How do you test for the absence of a value in a tag-value pair where you
> would normally expect a value?

...snip...
 
> Any ideas anyone?  This would be really useful to me if it is possible.


That Keith Bradnam, he knows nothing!  He should have tried using
AcePerl! ;)
 
Having given up on constructing an acedb query, I resorted to looking at
AcePerl.  The following is a simple solution for the problem of finding
Homol tags which don't have any associated value.


my $db = Ace->connect(-path  =>  'path_to_database');

my @sequences = $db->fetch(-class => 'Sequence');

foreach my $sequence (@sequences){
  if($sequence->Homol){
    my ($value) = $sequence->at('Homol');
    print "$sequence - No value!\n" if (!defined($value));
  }
}


It gets messier if you have subtags to 'Homol' (such as 'Pep_homol') which
you might want to additionally check for the absence of a value.  Feel
free to email me if anyone finds this stuff of use and wants to know more.

Keith

~  Keith Bradnam - WormBase group: http://wormbase.sanger.ac.uk/
~ 
~  The Sanger Centre, Wellcome Trust Genome Campus
~  Hinxton, Cambridge, CB10 1SA, UK.  Tel (01223) 497516






More information about the Acedb mailing list

Send comments to us at biosci-help [At] net.bio.net