[Biojava-l] failed to read genbank peptide file

Hongyu Zhang forward at hongyu.org
Fri Jul 30 01:41:02 EDT 2004


I am new to biojava. After being very happy with bioperl, I am glad to
start my biojava adventure. But it looks like something is still not
quite mature in biojava right now.

I've used the example in "biojava in anger" to successfully
read Genbank nucleotide files, but when reading peptide files I got
constant errors. I did change the read function from readGenbank()
to readGenpept(), but it didn't help :( . Is anyone aware of the
problems when reading Genbank formatted peptide files?

I put three sections below
1) the Java code
2) the command line and input file to this code
3) error message


1) First is my code, which is copied and revised from "biojava in
anger":

import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;
import java.io.*;
import org.biojava.bio.*;
import java.util.*;

public class ReadGB {
  public static void main(String[] args) {
    BufferedReader br = null;

    try {

      //create a buffered reader to read the sequence file specified
by args[0]
      br = new BufferedReader(new FileReader(args[0]));

    }
    catch (FileNotFoundException ex) {
      //can't find the file specified by args[0]
      ex.printStackTrace();
      System.exit(-1);
    }

    //read the GenBank File
    SequenceIterator sequences = SeqIOTools.readGenpept(br);

    //iterate through the sequences
    while(sequences.hasNext()){
      try {

        Sequence seq = sequences.nextSequence();
        //do stuff with the sequence

      }
      catch (BioException ex) {
        //not in GenBank format
        ex.printStackTrace();
      }catch (NoSuchElementException ex) {
        //request for more sequence when there isn't any
        ex.printStackTrace();
      }
    }
  }
}


2) After I successfully compiled the java code, I ran it in unix shell
window like this:
$ java ReadGB input_file

where the input_file is copied from the followin NCBI link:
http://www.ncbi.nih.gov/entrez/batchseq.cgi?txt=on&list_uids=7288210

3) And then I got this error message

org.biojava.bio.BioException: Couldn't realize feature
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:147)
        at
org.biojava.bio.seq.SimpleFeatureRealizer.realizeFeature(SimpleFeatureRealizer.java:97)
        at
org.biojava.bio.seq.impl.SimpleSequence.realizeFeature(SimpleSequence.java:217)
        at
org.biojava.bio.seq.impl.SimpleSequence.createFeature(SimpleSequence.java:223)
        at
org.biojava.bio.seq.io.SequenceBuilderBase.makeSequence(SequenceBuilderBase.java:175)
        at
org.biojava.bio.seq.io.SmartSequenceBuilder.makeSequence(SmartSequenceBuilder.java:103)
        at
org.biojava.bio.seq.io.SequenceBuilderFilter.makeSequence(SequenceBuilderFilter.java:99)
        at
org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:102)
        at ReadGB.main(ReadGB.java:30)
Caused by: org.biojava.bio.BioError: Could not initialize OntoTools
        at org.biojava.ontology.OntoTools.<clinit>(OntoTools.java:106)
        at
org.biojava.bio.seq.impl.SimpleFeature.<init>(SimpleFeature.java:392)
        at
org.biojava.bio.seq.impl.SimpleStrandedFeature.<init>(SimpleStrandedFeature.java:97)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:141)
        ... 8 more
Caused by: java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:61)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
        at org.biojava.ontology.OntoTools.<clinit>(OntoTools.java:61)
        ... 15 more
org.biojava.bio.BioException: Couldn't realize feature
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:147)
        at
org.biojava.bio.seq.SimpleFeatureRealizer.realizeFeature(SimpleFeatureRealizer.java:97)
        at
org.biojava.bio.seq.impl.SimpleSequence.realizeFeature(SimpleSequence.java:217)
        at
org.biojava.bio.seq.impl.SimpleSequence.createFeature(SimpleSequence.java:223)
        at
org.biojava.bio.seq.io.SequenceBuilderBase.makeSequence(SequenceBuilderBase.java:175)
        at
org.biojava.bio.seq.io.SmartSequenceBuilder.makeSequence(SmartSequenceBuilder.java:103)
        at
org.biojava.bio.seq.io.SequenceBuilderFilter.makeSequence(SequenceBuilderFilter.java:99)
        at
org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:102)
        at ReadGB.main(ReadGB.java:30)
Caused by: java.lang.NoClassDefFoundError
        at
org.biojava.bio.seq.impl.SimpleFeature.<init>(SimpleFeature.java:392)
        at
org.biojava.bio.seq.impl.SimpleStrandedFeature.<init>(SimpleStrandedFeature.java:97)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:141)
        ... 8 more
org.biojava.bio.BioException: Couldn't realize feature
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:147)
        at
org.biojava.bio.seq.SimpleFeatureRealizer.realizeFeature(SimpleFeatureRealizer.java:97)
        at
org.biojava.bio.seq.impl.SimpleSequence.realizeFeature(SimpleSequence.java:217)
        at
org.biojava.bio.seq.impl.SimpleSequence.createFeature(SimpleSequence.java:223)
        at
org.biojava.bio.seq.io.SequenceBuilderBase.makeSequence(SequenceBuilderBase.java:175)
        at
org.biojava.bio.seq.io.SmartSequenceBuilder.makeSequence(SmartSequenceBuilder.java:103)
        at
org.biojava.bio.seq.io.SequenceBuilderFilter.makeSequence(SequenceBuilderFilter.java:99)
        at
org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:102)
        at ReadGB.main(ReadGB.java:30)
Caused by: java.lang.NoClassDefFoundError
        at
org.biojava.bio.seq.impl.SimpleFeature.<init>(SimpleFeature.java:392)
        at
org.biojava.bio.seq.impl.SimpleStrandedFeature.<init>(SimpleStrandedFeature.java:97)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeatureRealizer.java:141)
        ... 8 more


Thanks for your help.


--
Hongyu Zhang
Computational biologist
Ceres Inc.







More information about the Biojava-l mailing list