[Biojava-l] How to get strand information using DAS and biojava?

Matthew Pocock matthew_pocock@yahoo.co.uk
Fri, 02 Aug 2002 16:58:21 +0100


Morning.

I've had trouble replying to this - mails bouncing. Anyway, the problem 
with your script is that you are casting to StrandedFeature, not 
Feature. Some of the things returned from DAS may not have strand 
information (e.g. chromosome bands or perhaps the assembly features). If 
you recode the loop to be:

   Feature fbj = (Feature) iterator.next();
   if(fbj instanceof StrandedFeature) {
     StrandedFeature sf = (StrandedFeature) fbj;
     ...
   }

Alternatively, and more powerfuly, you could replace the iterator 
initialization line with:

Iterator iterator = dasSeq.filter(
   new FeatureFilter.ByClass("StrandedFeature"),
   true // search the whole feature hierachy
).features();

You can set the flag to false if you just want the top-level features, 
but with DAS, most likely the features you are interested in will not be 
in chromosomal coordinates, but at the level of clones. Using feature 
filters is a /good thing/ in BioJava. It allows the implementor of the 
sequence to execute optimized code, rather than looping over all 
features manualy. For example, some filter statements will turn into 
specific Das feature fetching requests in the case of DAS, or to 
optimized SQL in BioSql.

Matthew

Thorsten Jansen wrote:
> Hi,
> does anybody out there know how to get the strand information for a
> feature received from a DAS server by using biojava?
> 
> I tried the following code but unfortunatly that code doesn't work:
> ////////////////////////////////////////////////////////////
> DASSequence dasSeq;
> .....
> .....
> Iterator iterator = dasSeq.features();
> while (iterator.hasNext()){
>     org.biojava.bio.seq.StrandedFeature fbj =
> (org.biojava.bio.seq.StrandedFeature)iterator.next();
>     ....
>     ....
> }
> /////////////////////////////////////////////////////////////
> This code results in a classcastexception. Casting to
> org.biojava.bio.seq.Feature works fine but that doesn't provide me with
> the strand information.
> 
> Thanks
> Thorsten
> 
> 
> 
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l
> 



__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com