[Biojava-l] How handle genbank location like AC1234:790078..790119

Matthew Pocock matthew_pocock@yahoo.co.uk
Fri, 18 Oct 2002 15:58:06 +0100 (BST)


Hi,

Things where part of the location is else-where are
represented by instances of the RemoteFeature class.
RemoteFeature instances use the normal APIs to
represent the local portion of the feature and expose
the whole nasty thing via extra API. In your code you
say:

if(feat instanceof RemoteFeature) {
  RemoteFeature rf = (RemoteFeature) feat;
  List regions = RemoteFeature.getRegions();
  for(Iterator i = regions.iterator(); i.hasNext(); )
{
    RemoteFeature.Region region =
(RemoteFeature.Region) i.next();
    System.out.println(
      region.getSeqID() + "\t" +
      region.isRemote() + "\t" +
      region.getLocation());
  }
} else {
  // handle local features
}

In the cases where BioJava is aware of where to fetch
the other sequences from, you can call
RemoteFeature.getRemoteFeature() to return a feature
attached to a sequence that is large enough to contain
all the bits. This will probably not work for
sequences loaded from local files, but may work for
sequences from databases.

As for the other locations, try the
Location.getDecoration() method. e.g.:

Location loc = feat.getLocation();

Location cutSite =
loc.getDecoration(BetweenLocation.class);
if(cutSite != null) {
  // this location is of the form x^y - do stuff
}

FuzzyLocation fuzz = (FuzzyLocation)
loc.getDecoration(FuzzyLocation.class);
if(fuzz != null) {
  // this location is fuzzy
  // use methods in FuzzyLocation to interogate about
  // the possible range of start/end values
}

Good luck,

Matthew

 --- Stephane Marcel
<stephane.marcel@lionbioscience.com> wrote: > Hi,
> 
> I am a new user of biojava and a need help for a
> genBank parser.
> My problem is when I try to get the location of my
> feature. If the location
> is : join(790078..790119,791193..791337)
> no problem... I can get the min, the max and both
> blocks.
> 
> But, if the location is :
> join(AC1234:790078..790119,791193..791337) the
> first block describes a clone.
> In this case, the first block is simply ignored and
> only the second block is
> returned.
> 
> Here is the code I use to get this location:
> 
> 
> 
> while(seqI.hasNext()) {
>        Sequence seq = seqI.nextSequence();
>        this.extractFeatures(seq);
>  }
> 
> public void extractFeatures(Sequence seq)
>     throws Exception {
>         for (Iterator i =
> ((FeatureHolder)seq).features(); i.hasNext(); ) {
>             Feature f = (Feature) i.next();
> 		System.out.println((f.getLocation().toString());
> 	}
> 
> }
> 
> 
> There is similar problems with locations like
> (123.567) or 123^567
> 
> It seems there is a class EmblLikeLocationParser
> which manages this kind of
> location, but there is any public constructor and I
> do not know how handle
> with it.
> 
> Any ideas how to get around this?
> 
> Best Regards.
> 
> Stephane.
> 
> 
> 
> 
> 
> _______________________________________________
> 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