[Biojava-dev] Problems building biojava v2 (trunk or alpha1)
Matthew Pocock
matthew_pocock at yahoo.co.uk
Fri May 7 07:50:19 EDT 2004
Hi Bruno,
Great to hear that you are interested. Sorry for the problems some of
you have had compiling the code - I didn't realise how in-flux the beta
sdk was, or I would have waited untill the next official beta release of
the sdk.
It would be realy helpfull at this point to get a list from people about
what sucks in biojava at the moment - glaringly missing functionality or
realy confusing API or anything else for that matter. So far, none of
the biology APIs are set in stone for bjv2.
For those of you who can't test out Medusa, here is a program that
parses any text file into tag-value events, and below is a program that
loads in a sequence file and prints out some vital stats, just so you
can get a feel for the syntax.
------
import org.bjv2.io.FormatReader;
import org.bjv2.io.IOListeners;
import org.bjv2.io.IOListener;
import org.bjv2.io.FormatFactories;
import java.io.File;
/**
* @author Matthew Pocock
*/
public class ReadGuessedFormatCompact
{
public static void main(String[] args)
throws Throwable
{
File inFile = new File(args[0]);
FormatReader reader = FormatFactories.findReader(inFile);
IOListener listener = IOListeners.echo(System.out, 2);
for (reader.read(listener); reader.hasNext(); reader.read(listener)) {
// don't do anything here - the events are being processed by listener
}
}
}
----
import org.bjv2.seq.Sequence;
import org.bjv2.seq.Sequences;
import org.bjv2.seq.Feature;
import org.bjv2.integrator.Integrated;
import org.bjv2.integrator.Integrator;
import java.io.File;
/**
* @author Matthew Pocock
*/
public class LoadSequence
{
public static void main(String[] args)
throws Throwable
{
File seqFile = new File(args[0]);
for(Sequence seq: Sequences.load(seqFile)) {
System.out.println("Sequence: " + seq.getIdentifier());
System.out.println("Length: " + seq.getSymbolList().length());
System.out.println("Features: " + seq.getFeatures().size());
}
}
}
More information about the biojava-dev
mailing list