|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
uk.ac.ebi.ep.mm.app.UniprotSaxParser
public class UniprotSaxParser
UniProt XML parser which takes into account only primary accessions,
entry names (IDs), organisms, EC numbers and PDB codes, and indexes/stores
them in a mega-map.
Only enzymes - i.e. entries with an EC number assigned - are considered.
Field Summary | |
---|---|
protected List<String> |
accessions
|
protected StringBuilder |
currentChars
The text value of the current element being parsed. |
protected List<String> |
ecs
|
protected List<String> |
entryNames
|
protected boolean |
isAccession
|
protected boolean |
isDbRef
|
protected boolean |
isEntry
|
protected boolean |
isEntryName
|
protected boolean |
isOrgComName
|
protected boolean |
isOrgSciName
|
protected boolean |
isProperty
|
protected boolean |
isProtRecName
|
protected String |
orgComName
|
protected String |
orgSciName
|
protected List<String> |
pdbCodes
|
protected String |
protRecName
|
Constructor Summary | |
---|---|
UniprotSaxParser()
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
|
void |
endElement(String uri,
String localName,
String qName)
Stores interesting data into the index. |
protected String |
getCurrentXpath()
|
static void |
main(String... args)
Parses a UniProt XML file and indexes/stores the UniProt accessions, IDs and organisms into a mega-map. |
void |
parse(String uniprotXml)
Parses a UniProt XML file and indexes/stores the UniProt accessions, IDs and organisms into a lucene index. This method is not thread safe. |
void |
setWriter(MegaMapper mmWriter)
Sets a writer to make the mega-map persistent. |
void |
startDocument()
|
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StringBuilder currentChars
protected boolean isEntry
protected boolean isAccession
protected boolean isEntryName
protected boolean isOrgSciName
protected boolean isOrgComName
protected boolean isDbRef
protected boolean isProperty
protected boolean isProtRecName
protected List<String> accessions
protected List<String> entryNames
protected String orgSciName
protected String orgComName
protected List<String> ecs
protected List<String> pdbCodes
protected String protRecName
Constructor Detail |
---|
public UniprotSaxParser()
Method Detail |
---|
public static void main(String... args) throws Exception
args
- see CliOptionsParser.getCommandLine(String...)
Exception
- in case of error while parsing.public void setWriter(MegaMapper mmWriter)
MmParser
setWriter
in interface MmParser
public void parse(String uniprotXml) throws Exception
parse
in interface MmParser
uniprotXml
- the XML file to parse
FileNotFoundException
- if the UniProt XML file is not found
or not readable.
SAXException
- if no default XMLReader can be found or
instantiated, or exception during parsing.
IOException
- if the lucene index cannot be opened/created,
or from the parser.
Exception
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
protected String getCurrentXpath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |