AW: [Biojava-l] Parse Genbank file

Andy Yates ady at sanger.ac.uk
Mon Dec 6 10:31:09 EST 2004


Hi,

I have to agree that this sounds like a classpath issue. Usually it 
means that you have correctly specified Biojava in your javac compile 
classpath but you lack it in your java run cmd.

If you're using ant to do the compile and run a good technique is to 
have a classpath property and use this whenever you try to compile and 
run. That's what we do in our department when I get my way :)

Andy Yates
======
Computer Biologist.
CancerIT - Cancer Genome Project,
The Wellcome Trust Sanger Institute.

BIBIS, Garnier, Christophe wrote:
> Hello,
> 
> It means it did not find a class, probably the Alphabet class but i wonder
> why because it is an Interface part of the biojava distribution.
> Be sure you have the biojava jar file available in your classpath.
> 
> And maybe if you want to parse a genbank file use something like that (see
> as well the tutorials):
> 
> 	private static void readGenBankFile()
> 	{
> 		BufferedReader br = null;
> 		File f = new File("your_genbank_file_path");
> 
> 		try
> 		{
> 			br = new BufferedReader(new FileReader(f));
> 		}
> 		catch (FileNotFoundException ex)
> 		{
> 			ex.printStackTrace();
> 			System.exit(-1);
> 		}
> 
> 		SequenceIterator sequences = SeqIOTools.readGenbank(br);
> 		while (sequences.hasNext())
> 		{
> 			try
> 			{
> 				Sequence seq = sequences.nextSequence();
> 
> 				System.out.println("sequence: " + seq);
> 				printSequence(seq);
> 
> 			}
> 			catch (BioException ex)
> 			{
> 				ex.printStackTrace();
> 			}
> 			catch (NoSuchElementException ex)
> 			{
> 				ex.printStackTrace();
> 			}
> 		}
> 	}
> 
> 
> 
> Regards,
> christophe
> 
> -----Ursprüngliche Nachricht-----
> Von: Xingen Zhu [mailto:xingenzhu at yahoo.com.cn]
> Gesendet: Montag, 29. November 2004 18:46
> An: biojava-l at biojava.org
> Betreff: [Biojava-l] Parse Genbank file
> 
> 
> Hi all,
>  I am a new user of biojava.  I use the following java program to parse a
> genebank file:
>   import java.util.*;
> import java.io.*;
>  
> import org.biojava.bio.*;
> import org.biojava.bio.symbol.*;
> import org.biojava.bio.seq.*;
> import org.biojava.bio.seq.io.*;
>  
> public class biojava {
>  
>  public static void main(String[] args) {
>   try {
>         File genbankFile = new File("e:\\java\\gb.txt"); 
>         BufferedReader gReader = new BufferedReader(new 
>           InputStreamReader(new FileInputStream(genbankFile)));
>        GenbankFormat gFormat = new GenbankFormat();
>        Alphabet alpha = DNATools.getDNA();
>     
>   } catch (Throwable t) {
>       t.printStackTrace();
>       System.exit(1); 
>  }
>  
> }
> }
>  
>  
> This program can be compiled, but not run. The error message is
>  Java.lang.NoClassDefFoundError
>  
> If delete the following line
> Alphabet alpha = DNATools.getDNA();
>  
> It will complie and run 
>  
> Any idea?
>  
> Thanks a lot.
> Michael
> 
> 
> 
> 
> ---------------------------------
> Do You Yahoo!?
> 嫌邮箱太小?雅虎电邮自助扩容!
> 
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at biojava.org
> http://biojava.org/mailman/listinfo/biojava-l


More information about the Biojava-l mailing list