[Biojava-dev] Re: [Biojava-l] Location output
    Thomas Down 
    td2 at sanger.ac.uk
       
    Thu Apr 14 09:24:47 EDT 2005
    
    
  
On 14 Apr 2005, at 13:43, mmatilai at hytti.uku.fi wrote:
> Hi,
>
> Below is the stack trace. I actually imported the RangeLocation class  
> to my program project so I don't
> know if this should affect something. The code is the same and I still  
> called it RangeLocation.
>
> Error occurred.
> java.lang.ClassCastException
>         at
> org.biojava.bio.seq.io.AbstractGenEmblFileFormer.formatLocationBlock(Ab 
> stractGenEmblFileFormer.java
> :647)
Java classes are identified by their fully qualified names, so  
your.app.RangeLocation isn't considered to be interchangeable with  
org.biojava.bio.symbol.RangeLocation.  This seems to have triggered a  
bug in the Genbank (and EMBL) file-writing code, which couldn't handle  
any Location implementation outside the core set included in the  
BioJava library.
I've now fixed the Genbank-writing bug, so if you use the latest  
version from CVS, everything should work as expected.
An alternative solution would be to make your custom RangeLocation a  
subclass of BioJava's built-in RangeLocation class:
public class MyRangeLocation extends RangeLocation {
     public MyRangeLocation(int min, int max) {
         super(min, max);
     }
     public String toString() {
         return "" + getMin() + "," + getMax();
     }
}
Thomas
    
    
More information about the biojava-dev
mailing list