Hi everyone
Can someone help with this error please. I am trying to translate 6 open reading frames from the fetchgenbank.java program and Translation:SixFrames java program. used in biojava. I am trying to combine the two error but keep receiving the exception error.
Here is what I have so far
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.NoSuchElementException;
import org.biojava.bio.BioException;
import org.biojavax.bio.db.ncbi.GenbankRichSequenceDB;
import org.biojavax.bio.seq.RichSequence;
import org.biojava.bio.Annotation;
import org.biojava.bio.seq.DNATools;
import org.biojava.bio.seq.RNATools;
import org.biojava.bio.seq.Sequence;
import org.biojava.bio.seq.SequenceIterator;
import org.biojava.bio.seq.SequenceTools;
import org.biojava.bio.seq.io.SymbolTokenization;
import org.biojava.bio.symbol.AlphabetManager;
import org.biojava.bio.symbol.IllegalAlphabetException;
import org.biojava.bio.symbol.SymbolList;
import java.util.Scanner;
public class test4{
public static void main(String[] args) {
RichSequence rs = null;
GenbankRichSequenceDB grsdb = new GenbankRichSequenceDB();
Scanner input = new ScannerSystem.in);
try{
// get data via GenBank accession number or gi number
System.out.println("Enter a GenBank accession number or gi number: ");
String id = input.nextLine();
}
finally{
String id;
rs = grsdb.getRichSequence(id);
System.out.println(rs.getName()+" | "+rs.getDescription());
System.out.println(rs.seqString());
}
String type;
SymbolTokenization toke = AlphabetManager.alphabetForName(type)
.getTokenization("token");
BufferedReader br = new BufferedReader(new FileReader(type));
SequenceIterator seqi = RichSequence.IOTools.readFasta(br,toke,
null);
SequenceIterator seqi1 = RichSequence.IOTools.readFasta(br,
toke, null);
while (seqi1.hasNext()) {
Sequence seq = seqi1.nextSequence();
// for each frame
for (int i = 0; i < 3; i++) {
SymbolList prot;
Sequence trans;
SymbolList syms = seq.subList(i + 1, seq.length()
- (seq.length() - i) % 3);
if (syms.getAlphabet() == DNATools.getDNA()) {
syms = DNATools.toRNA(syms);
}
prot = RNATools.translate(syms);
trans = SequenceTools.createSequence(prot, "", seq
.getName()
+ "TranslationFrame: +" + i,
Annotation.EMPTY_ANNOTATION);
syms = RNATools.reverseComplement(syms);
prot = RNATools.translate(syms);
trans = SequenceTools.createSequence(prot, "", seq
.getName()
+ " TranslationFrame: -" + i,
Annotation.EMPTY_ANNOTATION);
}
br.close();
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalAlphabetException e) {
e.printStackTrace();
} catch (NoSuchElementException e) {
e.printStackTrace();
} catch (BioException e) {
e.printStackTrace();
}
}
}
and what is the stacktrace ??
this is the error I am receiving
I am not quite sure since from looking at the other biojava programs the "catch (exceptions) seems to be right
are you running your program from eclipse ?
yes I am using eclipse
a *.jar is missing in your configuration.
i added the *.jar but still recieved the same results
make sure to show the entire traceback and also specify exactly which jar files are in discussion