How can I use Blast XML output in my program?
This page describes how to get Java objects from Blast results XML file
in a few simple steps.
Steps similar to those described below could also be applied to use
output from any other bioinformatics related services, capable of
returning results in XML format.
It can be done in various ways, including saving manual Blast search
results in XML format or by using biojava’s
NCBIQBlastService.
Blast output XML file should look like this (note the root element
BlastOutput):
<?xml version=”1.0”?>
<!DOCTYPE BlastOutput PUBLIC “-//NCBI//NCBI BlastOutput/EN” “NCBI_BlastOutput.dtd”>
...
</xml>
Acquire referenced schema files
You might need referenced schema files: NCBI_BlastOutput.dtd,
NCBI_BlastOutput.mod.dtd and NCBI_Entity.mod.dtd (they can be
downloaded from 1).
Generate necessary Java classes
It can be done using xjc tool (part of Java Architecture for XML Binding
(JAXB)), which accepts an XML schema and generates Java classes. The
generated classes contain properties, which map to the XML elements
defined in the schema.
xjc can be used from command line
2
or as a Maven plugin 3.
Command line usage example:
`
xjc -d