Package org.biojava.bio.program.sax
Class ClustalWAlignmentSAXParser
java.lang.Object
org.biojava.bio.program.sax.ClustalWAlignmentSAXParser
- All Implemented Interfaces:
XMLReader
A SAX2 parser for dealing with a multiple sequence
alignment as produced by ClustalW outputing .aln format.
For example,
K1C0_XENLA/125-441 DKVHALETANTELERKIKEWYEKQRPGSSSGDGAKDYSKYYT K1C4_XENLA/81-396 EKVRALEAANADLELKIREWYEKQK-GSGIGAGSKDFSKYFE K1C5_XENLA/73-384 DRVRSLEQANHELELKIREYLDKK-----AAVGSLDYSGYYN keratin15 DKVRALEEANADLEVKIHDWYQKQTP----ASPECDYSQYFK K1C0_XENLA/125-441 -----AKFLLQNDNARLAADDFKMKFEN-------------- K1C4_XENLA/81-396 -----SRVVLQIDNAKLAADDFRLKFEN-------------- K1C5_XENLA/73-384 -----TRLVLSIDNAKLAADDFKIKYES-------------- keratin15 -----SRVILEIDNARLAADDFRLKYEN--------------
Please note, this parser reads the whole alignment in to core memory and thus does not scale to work with very large alignments on low-end hardware.
Please also note that this class has not been tested with many version of CLUSTAL W. Copyright © 2000,2001 Cambridge Antibody Technology.
Primary author -
- Simon Brocklehurst (CAT)
- Neil Benn (CAT)
- Lawrence Bower (CAT)
- Derek Crockford (CAT)
- Tim Dilks (CAT)
- Colin Hardman (CAT)
- Stuart Johnston (CAT)
- Version:
- 1.0
- Author:
- Cambridge Antibody Technology (CAT), Greg Cox
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected String
protected ContentHandler
protected String
protected boolean
protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionInitialises internal state Sets namespace prefix to "biojava" -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrefixMapping
(String poPrefix, String poURI) Adds a namespace prefix to URI mapping as (key,value) pairs.protected void
changeState
(int piState) Centralise chaining of iState field to help with debugging.protected void
characters
(char[] ch, int start, int length) Utility method to centralize the sending of a SAX characters message a document handler.protected void
endElement
(org.biojava.bio.program.sax.QName poQName) Utility method to centralize the sending of a SAX endElement message a document handler.Return the content handler.protected BufferedReader
getContentStream
(InputSource poSource) Create a stream from an an InputSource, picking the correct stream according to order of precedance.Do-nothing implementation of interface methodDo-nothing implementation of interface methodDo-nothing implementation of interface methodboolean
getFeature
(String poName) Do-nothing implementation of interface methodDescribegetNamespacePrefix
method here.boolean
Support SAX2 configuration of namespace support of parser.boolean
Support SAX2 configuration of namespace support of parser.getProperty
(String name) Do-nothing implementation of interface methodgetURIFromPrefix
(String poPrefix) Gets the URI for a namespace prefix, given that prefix, or null if the prefix is not recognised.void
Full implementation of interface method.void
parse
(InputSource poSource) Describe 'parse' method here.Given an unprefixed element name, returns a new element name with a namespace prefixvoid
setContentHandler
(ContentHandler poHandler) Allow an application to register a content event handler.void
setDTDHandler
(DTDHandler handler) Do-nothing implementation of interface methodvoid
setEntityResolver
(EntityResolver resolver) Do-nothing implementation of interface methodvoid
setErrorHandler
(ErrorHandler handler) Do-nothing implementation of interface methodvoid
setFeature
(String poName, boolean value) Handles support for ReasoningDomain and Namespace-prefixesvoid
setNamespacePrefix
(String poPrefix) void
setProperty
(String name, Object value) Do-nothing implementation of interface methodprotected void
startElement
(org.biojava.bio.program.sax.QName poQName, Attributes atts) Utility method to centralize sending of a SAX startElement message to document handler
-
Field Details
-
oHandler
-
tNamespaces
protected boolean tNamespaces -
tNamespacePrefixes
protected boolean tNamespacePrefixes -
oNamespacePrefix
-
oFullNamespacePrefix
-
iState
protected int iState
-
-
Constructor Details
-
ClustalWAlignmentSAXParser
public ClustalWAlignmentSAXParser()Initialises internal state Sets namespace prefix to "biojava"
-
-
Method Details
-
parse
Describe 'parse' method here.- Specified by:
parse
in interfaceXMLReader
- Parameters:
poSource
- -- Throws:
IOException
SAXException
-
setContentHandler
Allow an application to register a content event handler. If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
- Specified by:
setContentHandler
in interfaceXMLReader
- Parameters:
poHandler
- aContentHandler
The XML content handler- Throws:
NullPointerException
- If the handler argument is null
-
getContentHandler
Return the content handler.- Specified by:
getContentHandler
in interfaceXMLReader
- Returns:
- a
ContentHandler
The current content handler, or null if none has been registered.
-
parse
Full implementation of interface method.- Specified by:
parse
in interfaceXMLReader
- Throws:
IOException
SAXException
-
getFeature
Do-nothing implementation of interface method- Specified by:
getFeature
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
setFeature
public void setFeature(String poName, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException Handles support for ReasoningDomain and Namespace-prefixes- Specified by:
setFeature
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
getProperty
Do-nothing implementation of interface method- Specified by:
getProperty
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
setProperty
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException Do-nothing implementation of interface method- Specified by:
setProperty
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
setEntityResolver
Do-nothing implementation of interface method- Specified by:
setEntityResolver
in interfaceXMLReader
-
getEntityResolver
Do-nothing implementation of interface method- Specified by:
getEntityResolver
in interfaceXMLReader
-
setDTDHandler
Do-nothing implementation of interface method- Specified by:
setDTDHandler
in interfaceXMLReader
-
getDTDHandler
Do-nothing implementation of interface method- Specified by:
getDTDHandler
in interfaceXMLReader
-
setErrorHandler
Do-nothing implementation of interface method- Specified by:
setErrorHandler
in interfaceXMLReader
-
getErrorHandler
Do-nothing implementation of interface method- Specified by:
getErrorHandler
in interfaceXMLReader
-
startElement
protected void startElement(org.biojava.bio.program.sax.QName poQName, Attributes atts) throws SAXException Utility method to centralize sending of a SAX startElement message to document handler- Parameters:
poQName
- aQName
valueatts
- anAttributes
value- Throws:
SAXException
- if an error occurs
-
endElement
Utility method to centralize the sending of a SAX endElement message a document handler.- Parameters:
poQName
- -
-
characters
Utility method to centralize the sending of a SAX characters message a document handler.- Parameters:
ch
- -start
- -length
- -
-
getNamespaces
public boolean getNamespaces()Support SAX2 configuration of namespace support of parser. -
getNamespacePrefixes
public boolean getNamespacePrefixes()Support SAX2 configuration of namespace support of parser. -
addPrefixMapping
Adds a namespace prefix to URI mapping as (key,value) pairs. This mapping can be looked up later to get URIs on request using the getURIFromPrefix method.- Parameters:
poPrefix
- aString
representation of the namespace prefixpoURI
- aString
representation of the URI for the namespace prefix.
-
getURIFromPrefix
Gets the URI for a namespace prefix, given that prefix, or null if the prefix is not recognised.- Parameters:
poPrefix
- aString
The namespace prefix.
-
setNamespacePrefix
- Parameters:
poPrefix
- aString
value
-
getNamespacePrefix
DescribegetNamespacePrefix
method here.- Returns:
- a
String
value
-
prefix
Given an unprefixed element name, returns a new element name with a namespace prefix- Returns:
- a
String
value
-
getContentStream
Create a stream from an an InputSource, picking the correct stream according to order of precedance.- Parameters:
poSource
- anInputSource
value- Returns:
- a
BufferedReader
value
-
changeState
protected void changeState(int piState) Centralise chaining of iState field to help with debugging. E.g. printing out value etc. All changes to iState should be made through this method.- Parameters:
piState
- anint
value
-