info.bioinfweb.jphyloio.formats.pde

## Class PDEEventReader

- java.lang.Object
- - info.bioinfweb.jphyloio.AbstractEventReader<P>
  - - info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventReader<PDEReaderStreamDataProvider>
    - - info.bioinfweb.jphyloio.formats.pde.PDEEventReader

- All Implemented Interfaces:
    PDEConstants, JPhyloIOXMLEventReader, JPhyloIOEventReader, JPhyloIOFormatSpecificObject, ReadWriteConstants

      public class PDEEventReader
      extends AbstractXMLEventReader<PDEReaderStreamDataProvider>
      implements PDEConstants

  Event reader for the PDE format used by the alignment editor PhyDE.

  This reader supports reading sequence data and metadata as well as character sets from PDE files. Reading of taxon sets is not supported. Identifiers used to specify the number of missing characters at the start or end of a sequence are translated to the according number of missing symbols in `SequenceTokensEvent`s. Token set events are fired with the `CharacterStateSetType` DNA or amino acid, according to the information in the file.

  Sequence metadata of the types `STRING` and `NUMBER` is represented as `LiteralMetadataEvent`s, data of the type `FILE` as `ResourceMetadataEvent`s. The predicate is either `ReadWriteConstants.PREDICATE_HAS_LITERAL_METADATA` or `ReadWriteConstants.PREDICATE_HAS_RESOURCE_METADATA`. Char set attributes are represented by metaevents with predefined predicates according to the attribute.

  ### Recognized parameters

  - `ReadWriteParameterNames.KEY_ALLOW_DEFAULT_NAMESPACE`
  - `ReadWriteParameterNames.KEY_LOGGER`
  Since:
    0.0.0
  Author:
    Sarah Wiechers, Ben Stöver

- - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventReader

      `INTERNAL_USE_NAMESPACE, TAG_PARENT_OF_ROOT`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.formats.pde.PDEConstants

      `AMINO_TYPE, ATTR_ALIGNMENT_LENGTH, ATTR_CHARSET_LABEL, ATTR_COLOR, ATTR_DATATYPE, ATTR_ID, ATTR_SEQUENCE_COUNT, ATTR_SEQUENCE_INDEX, ATTR_VERSION, ATTR_VISIBILITY, DNA_TYPE, FIRST_CUSTOM_META_ID, META_ID_ACCESS_NUMBER, META_ID_COMMENT, META_ID_LINKED_FILE, META_ID_SEQUENCE_LABEL, META_TYPE_FILE, META_TYPE_NUMBER, META_TYPE_STRING, PDE_FORMAT_NAME, PDE_NAMESPACE_PREFIX, PDE_PREDICATE_NAMESPACE, PREDICATE_ACCESS_NUMBER, PREDICATE_CHARSET_COLOR, PREDICATE_CHARSET_VISIBILITY, PREDICATE_COMMENT, PREDICATE_DESCRIPTION, PREDICATE_LINKED_FILE, SEQUENCE_END, TAG_ALIGNMENT, TAG_BLOCK, TAG_CHARSET, TAG_CHARSETS, TAG_DESCRIPTION, TAG_HEADER, TAG_MATRIX, TAG_META_TYPE_DEFINITIONS, TAG_ROOT, TAG_SEQUENCE_INFORMATION, TAG_SEQUENCE_META_INFORMATION, UNKNOWN_CHARS`

    - ### Fields inherited from interface info.bioinfweb.jphyloio.ReadWriteConstants

      `ATTRIBUTE_STRING_KEY, ATTRIBUTES_NAMESPACE_FOLDER, DATA_TYPE_NAMESPACE_FOLDER, DATA_TYPE_SIMPLE_VALUE_LIST, DEFAULT_CHAR_SET_ID_PREFIX, DEFAULT_CHARACTER_DEFINITION_ID_PREFIX, DEFAULT_EDGE_ID_PREFIX, DEFAULT_GENERAL_ID_PREFIX, DEFAULT_MATRIX_ID_PREFIX, DEFAULT_MAX_COMMENT_LENGTH, DEFAULT_MAX_TOKENS_TO_READ, DEFAULT_META_ID_PREFIX, DEFAULT_NETWORK_ID_PREFIX, DEFAULT_NODE_EDGE_SET_ID_PREFIX, DEFAULT_NODE_ID_PREFIX, DEFAULT_OTU_ID_PREFIX, DEFAULT_OTU_LIST_ID_PREFIX, DEFAULT_OTU_SET_ID_PREFIX, DEFAULT_SEQUENCE_ID_PREFIX, DEFAULT_SEQUENCE_SET_ID_PREFIX, DEFAULT_TOKEN_DEFINITION_ID_PREFIX, DEFAULT_TOKEN_SET_ID_PREFIX, DEFAULT_TREE_ID_PREFIX, DEFAULT_TREE_NETWORK_GROUP_ID_PREFIX, DEFAULT_TREE_NETWORK_SET_ID_PREFIX, JPHYLOIO_ATTRIBUTES_NAMESPACE, JPHYLOIO_ATTRIBUTES_PREFIX, JPHYLOIO_DATA_TYPE_NAMESPACE, JPHYLOIO_DATA_TYPE_PREFIX, JPHYLOIO_FORMATS_NAMESPACE_PREFIX, JPHYLOIO_GENERAL_NAMESPACE, JPHYLOIO_NAMESPACE_PREFIX, JPHYLOIO_PREDICATE_NAMESPACE, JPHYLOIO_PREDICATE_PREFIX, PREDICATE_CHARACTER_COUNT, PREDICATE_EDGE_LENGTH, PREDICATE_EDGE_SOURCE_NODE, PREDICATE_EDGE_TARGET_NODE, PREDICATE_HAS_CUSTOM_XML, PREDICATE_HAS_LITERAL_METADATA, PREDICATE_HAS_RESOURCE_METADATA, PREDICATE_IS_CROSSLINK, PREDICATE_NAMESPACE_FOLDER, PREDICATE_PART_SEPERATOR, PREDICATE_SEQUENCE_COUNT, RESERVED_ID_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDEEventReader(java.io.File file, ReadWriteParameterMap parameters)`
    `PDEEventReader(java.io.InputStream stream, ReadWriteParameterMap parameters)`
    `PDEEventReader(java.io.Reader reader, ReadWriteParameterMap parameters)`
    `PDEEventReader(javax.xml.stream.XMLEventReader xmlReader, ReadWriteParameterMap parameters)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected PDEReaderStreamDataProvider` | `createStreamDataProvider()` This method is called in the constructor of `AbstractEventReader` to initialize the stream data provider that will be returned by `AbstractEventReader.getStreamDataProvider()`.
    `protected void` | `fillMap()`
    `java.lang.String` | `getFormatID()` Returns a string ID uniquely identifying the target format of this instance.

    - ### Methods inherited from class info.bioinfweb.jphyloio.formats.xml.AbstractXMLEventReader

      `close, createMetaXMLEventReader, createMetaXMLStreamReader, getElementReader, getElementReaderMap, getEncounteredTags, getNamespaceContext, getXMLReader, isAllowDefaultNamespace, parseQName, putElementReader, readNextEvent`

    - ### Methods inherited from class info.bioinfweb.jphyloio.AbstractEventReader

      `addEventListener, fireEvent, getCurrentEventCollection, getIDManager, getLastNonCommentEvent, getParameters, getParentInformation, getPreviousEvent, getSequenceTokensEventManager, getStreamDataProvider, getUpcomingEvents, hasNextEvent, hasSpecialEventCollection, isBeforeFirstAccess, next, nextOfType, peek, removeEventListener, resetCurrentEventCollection, setCurrentEventCollection`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.JPhyloIOEventReader

      `addEventListener, getLastNonCommentEvent, getParentInformation, getPreviousEvent, hasNextEvent, next, nextOfType, peek, removeEventListener`

- - ### Constructor Detail

    - #### PDEEventReader

          public PDEEventReader(java.io.File file,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### PDEEventReader

          public PDEEventReader(java.io.InputStream stream,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### PDEEventReader

          public PDEEventReader(java.io.Reader reader,
                                ReadWriteParameterMap parameters)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Throws:
        `java.io.IOException`
        `javax.xml.stream.XMLStreamException`

    - #### PDEEventReader

          public PDEEventReader(javax.xml.stream.XMLEventReader xmlReader,
                                ReadWriteParameterMap parameters)

  - ### Method Detail

    - #### getFormatID

          public java.lang.String getFormatID()

      Description copied from interface: `JPhyloIOFormatSpecificObject`
      Returns a string ID uniquely identifying the target format of this instance. Additional information on the format can be retrieved by passing the returned ID to `JPhyloIOReaderWriterFactory.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`).

      Specified by:
        `getFormatID` in interface `JPhyloIOFormatSpecificObject`
      Returns:
        the ID of the target format of this instance
      See Also:
        `JPhyloIOReaderWriterFactory.getFormatInfo(String)`

    - #### fillMap

          protected void fillMap()

      Specified by:
        `fillMap` in class `AbstractXMLEventReader<PDEReaderStreamDataProvider>`

    - #### createStreamDataProvider

          protected PDEReaderStreamDataProvider createStreamDataProvider()

      Description copied from class: `AbstractEventReader`
      This method is called in the constructor of `AbstractEventReader` to initialize the stream data provider that will be returned by `AbstractEventReader.getStreamDataProvider()`. Inherit classes that use their own stream data provider implementation should overwrite this method.

      This default implementation creates a new instance of `ReaderStreamDataProvider`.

      Overrides:
        `createStreamDataProvider` in class `AbstractXMLEventReader<PDEReaderStreamDataProvider>`
      Returns:
        the stream data provider to be used with this instance