I created a new class NCBIGenbankSequenceFetcher.java which extends GenbankRichSequenceDB and overrid the "getAddress(String id)" to limit the sequence for an id (seq_start and seq_stop).

public class NCBIGenbankSequenceFetcher extends GenbankRichSequenceDB{

    private String seq_start;
    private String seq_stop;
    private String strand="1";//1=plus, 2=minus

    public NCBIGenbankSequenceFetcher() {
    }

    public NCBIGenbankSequenceFetcher(String seq_start, String seq_stop) {
        this.seq_start = seq_start;
        this.seq_stop = seq_stop;
    }

public NCBIGenbankSequenceFetcher(String seq_start, String seq_stop,String strand) {
        this.seq_start = seq_start;
        this.seq_stop = seq_stop;
        this.strand = strand;
    }

    @Override
    protected URL getAddress(String id) throws MalformedURLException {
        FetchURL seqURL = new FetchURL("Genbank", "text");
        String baseurl = seqURL.getbaseURL();
        String db = seqURL.getDB();
        String url = baseurl+db+"&id="+id+"&rettype=gb";
        if(seq_start != null && seq_stop != null){
url +="&seq_start="+seq_start+"&seq_stop="+seq_stop+"&strand="+strand;
        }
        return new URL(url);
    }
}

From an other class, i create an instance of this class and then call its "getRichSequence(id)" method. (Not the same, but similar)

for(String gi:ids){ // ids is a list<string>
seq = new NCBIGenbankSequenceFetcher(seq_start, seq_stop,strand).getRichSequence(gi);
}

What i found later is that it randomly throws the exception, not by any particular sequence. So my guess an io error, which arises during the data streaming from server.

ilhami visne.

On 12/11/2009 10:59 AM, Richard Holland wrote:
Hello. Could you also post the relevant parts of your code that you are running 
when this exception happens?

cheers,
Richard

On 11 Dec 2009, at 00:46, Ilhami Visne wrote:

Hi,

I'm following the suggestion "Please submit the details that follow to
[email protected] or post a bug report to http://bugzilla.open-bio.org/";
.

The sequence of concerns is at
http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=39645757&rettype=gb&seq_start=1353&seq_stop=2128&strand=1

Format_object=org.biojavax.bio.seq.io.GenbankFormat
Accession=null
Id=null
Comments=Bad section
Parse_block=
Stack trace follows ....


        at
org.biojavax.bio.seq.io.GenbankFormat.readSection(GenbankFormat.java:603)
        at
org.biojavax.bio.seq.io.GenbankFormat.readRichSequence(GenbankFormat.java:278)
        at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
        ... 8 more
Caused by: java.lang.NullPointerException
        at
org.biojavax.bio.seq.io.GenbankFormat.readSection(GenbankFormat.java:593)
        ... 10 more
org.biojava.bio.BioException: IO failure whilst reading from Genbank

Any quick fix,patch?

thanks.
Ilhami Visne
_______________________________________________
Biojava-l mailing list  -  [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l
--
Richard Holland, BSc MBCS
Operations and Delivery Director, Eagle Genomics Ltd
T: +44 (0)1223 654481 ext 3 | E: [email protected]
http://www.eaglegenomics.com/



_______________________________________________
Biojava-l mailing list  -  [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l

Reply via email to