public class NeXMLEventWriter extends AbstractXMLEventWriter<NeXMLWriterStreamDataProvider> implements NeXMLConstants
All data elements modeled by JPhyloIO are supported by this writer, since the data model of JPhyloIO is heavily influenced by the data model of NeXML.
Comments and meta information can be written under all modeled elements. Meta elements only present to group meta information,
e.g. nested under elements not modeled in JPhyloIO, are ignored by this writer and the nested content is written to the
according position. The ID of a JPhyloIOEvent will be written to the file unchanged.
Namespaces used or declared in custom XML elements are managed according to ReadWriteParameterNames.KEY_CUSTOM_XML_NAMESPACE_HANDLING.
More information about this can be found in the documentation of XMLReadWriteUtils#manageLiteralContentMetaNamespaces().
If no OTUs or OTU list are found in the data, but elements that need to reference either of those, the writer will write a
new OTU list or OTU with the ID prefix NeXMLConstants.UNDEFINED_OTU_ID_PREFIX or
NeXMLConstants.UNDEFINED_OTUS_ID_PREFIX. If no token set is present in the data, a new token set with the type
CharacterStateSetType.DISCRETE and the ID prefix NeXMLConstants.DEFAULT_TOKEN_DEFINITION_SET_ID_PREFIX will
be written to the file. If not all alignment characters are defined in the document data, missing definitions will be add.
Before writing, the token definitions and sequence data are checked if they fit the specified CharacterStateSetType.
If this is not the case, the CharacterStateSetType.DISCRETE is assumed. In case of DNA, RNA
or NUCLEOTIDE data it is first checked if the data could also be of another nucleotide data type. All molecular
data token definition sets contain all token definitions defined in the IUPAC standards. If single token definitions are missing,
they are add. Token definitions of standard tokens found in the sequence data but not defined previously are also add
in case of standard data.
Restriction data can not be written, since it is not modeled by JPhyloIO. If the CharacterStateSetType of the
sequence data is DSICRETE tokens are translated to integers as required by NeXML.
ReadWriteParameterNames.KEY_WRITER_INSTANCEReadWriteParameterNames.KEY_LOGGERReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORYReadWriteParameterNames.KEY_APPLICATION_NAMEReadWriteParameterNames.KEY_APPLICATION_VERSIONReadWriteParameterNames.KEY_APPLICATION_URLReadWriteParameterNames.KEY_NEXML_TOKEN_DEFINITION_LABELReadWriteParameterNames.KEY_NEXML_TOKEN_DEFINITION_LABEL_METADATAReadWriteParameterNames.KEY_CUSTOM_XML_NAMESPACE_HANDLINGAbstractEventWriter.NoEditUniqueLabelHandler, AbstractEventWriter.UniqueLabelHandlerEDITED_LABEL_SEPARATORATTR_ABOUT, ATTR_CELL_SET_LINKED_IDS, ATTR_CHAR_SET_LINKED_IDS, ATTR_CODON_POSITION, ATTR_CONTENT, ATTR_DATATYPE, ATTR_GENERATOR, ATTR_HREF, ATTR_ID, ATTR_LABEL, ATTR_LENGTH, ATTR_NODE_EDGE_SET_LINKED_EDGE_IDS, ATTR_NODE_EDGE_SET_LINKED_NODE_IDS, ATTR_NODE_EDGE_SET_LINKED_ROOTEDGE_IDS, ATTR_OTU_SET_LINKED_IDS, ATTR_OTUS, ATTR_PROPERTY, ATTR_REL, ATTR_ROOT, ATTR_SEQUENCE_SET_LINKED_IDS, ATTR_SINGLE_CHAR_LINK, ATTR_SINGLE_OTU_LINK, ATTR_SINGLE_STATE_LINK, ATTR_SOURCE, ATTR_STATE_SET_LINKED_IDS, ATTR_STATES, ATTR_SYMBOL, ATTR_TARGET, ATTR_TOKENS, ATTR_TREE_SET_LINKED_NETWORK_IDS, ATTR_TREE_SET_LINKED_TREE_IDS, ATTR_VERSION, ATTR_XSI_TYPE, DEFAULT_TOKEN_DEFINITION_SET_ID_PREFIX, NEXML_DEFAULT_NAMESPACE_PREFIX, NEXML_FORMAT_NAME, NEXML_NAMESPACE, NEXML_NAMESPACE_PREFIX, NEXML_PREDICATE_NAMESPACE, NEXML_VERSION, PREDICATE_CHAR_ATTR_CODON_POSITION, PREDICATE_CHAR_ATTR_TOKENS, PREDICATE_FORMAT, PREDICATE_MATRIX, PREDICATE_ORIGINAL_LABEL, PREDICATE_ORIGINAL_TOKEN_NAME, TAG_CELL, TAG_CHAR, TAG_CHARACTERS, TAG_EDGE, TAG_FORMAT, TAG_MATRIX, TAG_MEMBER, TAG_META, TAG_NETWORK, TAG_NODE, TAG_OTU, TAG_OTUS, TAG_POLYMORPHIC, TAG_ROOT, TAG_ROOTEDGE, TAG_ROW, TAG_SEQ, TAG_SET, TAG_STATE, TAG_STATES, TAG_TREE, TAG_TREES, TAG_UNCERTAIN, TYPE_CONTIN_CELLS, TYPE_CONTIN_SEQ, TYPE_DNA_CELLS, TYPE_DNA_SEQS, TYPE_FLOAT_NETWORK, TYPE_FLOAT_TREE, TYPE_INT_NETWORK, TYPE_INT_TREE, TYPE_LITERAL_META, TYPE_PROTEIN_CELLS, TYPE_PROTEIN_SEQS, TYPE_RESOURCE_META, TYPE_RESTRICTION_CELLS, TYPE_RESTRICTION_SEQS, TYPE_RNA_CELLS, TYPE_RNA_SEQS, TYPE_STANDARD_CELLS, TYPE_STANDARD_SEQ, UNDEFINED_OTU_ID_PREFIX, UNDEFINED_OTU_LABEL, UNDEFINED_OTUS_ID_PREFIX, UNDEFINED_OTUS_LABEL| Constructor and Description |
|---|
NeXMLEventWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected NeXMLWriterStreamDataProvider |
createStreamDataProvider()
This method is called in the constructor of
AbstractEventWriter to initialize the stream
data provider that will be returned by AbstractEventWriter.getStreamDataProvider(). |
protected void |
doWriteDocument() |
java.lang.String |
getFormatID()
Returns a string ID uniquely identifying the target format of this instance.
|
createMetaXMLEventWriter, createMetaXMLStreamWriter, doWriteDocument, getDocument, getLogger, getNamespaceContext, getParameters, getXMLWritercreateUniqueLabel, createUniqueLabel, createUniqueLabel, createUniqueLinkedOTULabel, decreaseIndention, determineMaxSequenceLength, extendSequence, getFileStartInfo, getIndention, getLabeledIDName, getLinkedOTUNameOTUFirst, getLinkedOTUNameOwnFirst, getReferencedOTUList, getStreamDataProvider, increaseIndention, logIngnoredOTULists, writeDocument, writeDocument, writeDocument, writeLineBreak, writeLineStartclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteDocument, writeDocument, writeDocumentpublic NeXMLEventWriter()
public java.lang.String getFormatID()
JPhyloIOFormatSpecificObjectJPhyloIOReaderWriterFactory.getFormatInfo(String).
Third party developers that create readers or writers for additional formats must make sure to use a globally unique
format ID. It is strongly recommended to use owned reverse domain names for this (e.g.
org.example.additionalformat).
getFormatID in interface JPhyloIOFormatSpecificObjectJPhyloIOReaderWriterFactory.getFormatInfo(String)protected NeXMLWriterStreamDataProvider createStreamDataProvider()
AbstractEventWriterAbstractEventWriter to initialize the stream
data provider that will be returned by AbstractEventWriter.getStreamDataProvider(). Inheriting classes that use
their own stream data provider implementation should overwrite this method.
This default implementation creates a new instance of WriterStreamDataProvider.
createStreamDataProvider in class AbstractEventWriter<NeXMLWriterStreamDataProvider>protected void doWriteDocument() throws java.io.IOException, javax.xml.stream.XMLStreamException
doWriteDocument in class AbstractXMLEventWriter<NeXMLWriterStreamDataProvider>java.io.IOExceptionjavax.xml.stream.XMLStreamException