BioJava using SEED Web Services

For a few days I’ve been testing the waters of the SEED Web Services methods and trying to get a feel for the different ways they could be implemented, and at the same time was doing the same for BioJava. After aquiring enough knowledge of sequences, pegs, and other things I was finally able to get them to use each other’s methods to display and store information for anyone to use. Here is a really simple example where the Web Services obtains a genome ID, “83333.1”, and a region on the chromosome, “NC_000913_1303788_1304792”, and then returns a sequence. Then, BioJava uses its createDNA() method to convert the sequence into an object it can manipulate. The code then prints out different properties held by the sequence. Click the Read More for the code.

 

 

import gov.anl.mcs.bioseed.SeedWebServices.SeedWebServicesHandler;
import gov.anl.mcs.bioseed.SeedWebServices.SeedWebServicesHandlerProxy;

import java.rmi.RemoteException;

import org.biojava.bio.seq.DNATools;
import org.biojava.bio.symbol.IllegalSymbolException;
import org.biojava.bio.symbol.SymbolList;

public class WebAccessTester2 {

public static void main(String[] args) {

SeedWebServicesHandler service = new SeedWebServicesHandlerProxy();

String tmp[];
SymbolList seq;

try {

tmp = service.dna_sequence("83333.1", "NC_000913_1303788_1304792", "NC_000913_1303788_1304792");
seq = DNATools.createDNA(tmp[0]);

System.out.println("Alphabet = " + seq.getAlphabet().getName());
System.out.println("Length = " + seq.length());
System.out.println("First symbol = " + seq.symbolAt(1).getName());
System.out.println(seq.seqString());

} catch (RemoteException e) {
// Do some error handling for remote access.
} catch (IllegalSymbolException e) {
// Do some more error handling.
}
}
}
 

Here is the output:

Alphabet = DNA
Length = 2010
First symbol = adenine
atgaatgctgtaactgaaggaagaaaagtcctccttgaaatcgccgatcttaaagtgc...
 

Note: The last string does not cut off with ellipses. It was too long for my purposes here Smile