[Biojava-dev] Filter features of a sequence from SequenceDB

Matthew Pocock matthew_pocock at yahoo.co.uk
Wed May 28 10:43:22 EDT 2003


Hi,

If you want to print out the annotations in a way that doesn't depend 
upon the implementation, do f.getAnnotation().asMap() and print that out.

Matthew

Y D Sun wrote:
> Dear all,
> 
> I create a sequence database and add EMBL sequences to it using
> BioSQLSequenceDB() and addSequence().
> 
> Then, I read a sequence from the database using getSequence() and filter
> its features like CDS using the code:
> 
>     //make a Filter for "CDS" types
>     FeatureFilter ff = new FeatureFilter.ByType("CDS");
> 
>     //get the filtered Features
>     FeatureHolder fh = seq.filter(ff);
> 
>     //iterate over the Features in fh
>     for (Iterator i = fh.features(); i.hasNext(); ) {
>       Feature f = (Feature)i.next();
>       String s = f.getAnnotation().toString();
> 	System.out.println(s);
>     }
> 
> The output is incorrect:
> 
> org.biojava.bio.seq.db.biosql.BioSQLFeatureAnnotation at 1f2ee1
> org.biojava.bio.seq.db.biosql.BioSQLFeatureAnnotation at 3ecfff
> org.biojava.bio.seq.db.biosql.BioSQLFeatureAnnotation at c99159
> org.biojava.bio.seq.db.biosql.BioSQLFeatureAnnotation at 65a77f
> org.biojava.bio.seq.db.biosql.BioSQLFeatureAnnotation at d7ad1c
> ... ...
> 
> If applying the code to a sequence read from a EMBL file using
> readEmbl(), it can get CDS feature rightly. So, I think this problem may
> be caused by the format of sequence. I haven't specified the format when
> creating DB, addSequence and getSequence. 
> 
> I want to know the correct method to get the feature of a sequence from
> SequenceDB, how to specify the format.
> 
> Thanks.
> 
> George Sun
> 
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at biojava.org
> http://biojava.org/mailman/listinfo/biojava-dev
> 


-- 
BioJava Consulting LTD - Support and training for BioJava
http://www.biojava.co.uk



More information about the biojava-dev mailing list