[Biojava-l] bug using getFeature() ?

Thomas Down td2 at sanger.ac.uk
Fri Aug 1 15:34:22 EDT 2003


The feature you're looking at isn't actually a `top level' feature
in BioJava, because it is fully contained by a clone of the
genome assembly.  When accessing ensembl sequences, you need
to search the whole feature hierarchy.  If you try:

    Iterator fi = seq.filter(FeatureFilter.all).features();  

You should see the feature you're looking for.

Better still, just do:

    chrSeq.filter(
	new FeatureFilter.And(
            new FeatureFilter.ByType("transcript"),
            new FeatureFilter.OverlapsLocation(
                new RangeLocation(156947999, 156952998)
            )
        )
    );


Hope this helps,

     Thomas.

On Thu, Jul 31, 2003 at 06:55:18PM +0200, Alberto Ambesi wrote:
> my program fails to get a transcript feature on human chromosome 1 
> within positions: 156947999-156952998. If the search is done via web at 
> ensembl.org, I find ensembl transcript CASQ1, with an exon in position: 
> 156948909-156949040. In many other genomic regions the program works 
> well. Why is this? 
>  
> import java.sql.*; 
> import java.util.*; 
> import org.ensembl.db.*; 
> import org.ensembl.db.sql.SQLDatabaseAdaptor; 
> import org.biojava.bio.*; 
> import org.biojava.bio.program.ensembl.*; 
> import org.biojava.bio.seq.*; 
> import org.biojava.bio.seq.db.*; 
> import org.biojava.bio.seq.io.*; 
> import org.biojava.bio.symbol.*; 
> 
> public class bug { 
>     public static void main(String[] args) throws Exception { 
>         Driver driverName = 
> (Driver)Class.forName("org.gjt.mm.mysql.Driver").newInstance(); 
>         //Connection conn = 
> DriverManager.getConnection("jdbc:mysql://kaka.sanger.ac.uk/homo_sapiens_core_15_33", 
> "anonymous", ""); 
>         SQLDatabaseAdaptor sqlDBAdaptor = 
> SQLDatabaseAdaptor.connectSQL("jdbc:mysql://kaka.sanger.ac.uk/homo_sapiens_core_15_33", 
> "anonymous", "", 9); 
>         Ensembl ens = new Ensembl(sqlDBAdaptor); 
>         SequenceDB chromosomes =ens.getChromosomes(); 
>         Sequence chrSeq = chromosomes.getSequence("1"); 
>         Sequence seq = new SubSequence(chrSeq, 156947999, 156952998); 
>         System.out.println(seq.seqString()); 
>         for (Iterator fi = seq.features(); fi.hasNext(); ) { 
>             org.biojava.bio.seq.Feature f = 
> (org.biojava.bio.seq.Feature) fi.next(); 
>             String featureType = f.getType(); 
>             System.out.println(featureType); 
>         } 
>     } 
> } 


More information about the Biojava-l mailing list