
// the length method is not working yet for DNA arrays, because they are packed
select ->0, l, l2 from class genome_sequence where exists_tag ->dna,
	      l in ->dna.length,
	      l2 in ->dna[2]

// correctly errno 810
select ->0, ->1, ->2, ->3 from object("sequence", "ah10")

// correctly errno 810
select a, a->2  from a in object("author", "Durbin RM") where exists a->2


select ->0, abs (->subsequence[2] - ->subsequence[3]) > 100 from class Sequence 

select ->0, ->subsequence[1], ->subsequence[2] from class Sequence 

select ->0, ->subsequence[1], abs (->subsequence[2] - ->subsequence[3]) > 1000 from object("sequence", "B0310")

select ->0, ->subsequence[2] from object("sequence", "B0310")

@auth := select ->0 from class author where not (->mail or ->email) ;
 select :1->email, :1->mail, p->title
 from @auth 
      where count(select :1->paper) > 10, 
 p in :1->paper 
      where p->journal like"*nature*"

select s
from s in class sequence
where count (select s->homol) > 3 and s->dna[2] < 2000

/* should be empty in wormdb */


@seqs := select all class sequence where exists_tag ->structure ;
select all from @seqs where :1->dna[2] < 300 and not exists_tag :1->structure

/* should never have to open the objects to check for dna */
/* rhs of where clause can be cheaply evaluated using bindex */

select all class genome_sequence where not (->0 like "em:*")

select all class genome_sequence where not (->0 like "em:*") order

select all class sequence where not (->0 like "em:*")

select ->email, ->mail from class author where count(select ->paper) > 10


/*************************************************/

@t := select s, max (select s->Pep_homol[3]) from
  s in class Sequence where s like "A*";
select s, m, p->Title from 
   t in @t,
   s in t:1,
   m in t:2 where m > 80,
   p in s->Pep_homol where p[2] = m

select s,  max (select s->Pep_homol[3]) 
 from  s in class Sequence 
	    where s like "A*"

select s from  s in class Sequence 
	    where s like "A*"

select s,  s->Pep_homol[3], max (select s->Pep_homol[3]) 
 from  s in class Sequence 
	    where s like "A*"

@t := select s, max (select s->Pep_homol[3]) from
  s in class Sequence where s like "A*";
select s, m from 
   t in @t,
   s in t:1,
   m in t:2
------


// row-variable
@t := select s, max (select s->Pep_homol[3]) from
  s in class Sequence where s like "A*";
select t:1, t:2 from 
   t in @t

// wrong query using column-variable - you'll get a doubly nested recursion
// which is probably not what you'd want.
@t := select s, max (select s->Pep_homol[3]) from
  s in class Sequence where s like "A*";
select s, m from 
   s in @t:1,
   m in @t:2



// with ~rd/worm/AH6 I get 172 result lines
select s, max (select p[2]), t from
  s in class Sequence 
       where s like "A*",
  p in s->Pep_homol
       where p[2] > 80,
  t in p->title

select s, p[2], max (select s->pep_homol[3]), t from
  s in class Sequence 
       where s like "A*",
  p in s->Pep_homol
       where p[2] > 80,
  t in p->title

// this is the right result I think, in only one result line
// why is this different ????
select s, max (select s->pep_homol[3]), t from
  s in class Sequence 
       where s like "A*",
  p in s->Pep_homol
       where p[2] > 80,
  t in p->title



************************************************************
** query for SANgc05193 **

select m[1], m[2] 
from s in object ("Sequence","Y75B8A"), 
     m in s->feature 
       where m like "tandem" or m like "inverted"

************************************************************
** query for SANgc05249 (restricted TableFunc grammar)

select s, m, p->Title from
   s in class Sequence where s like "A*",
   m in max (select all s->Pep_homol[3]) where m > 80,
   p in s->Pep_homol where p[2] = m

