java.lang.Object
de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.SSSOMSerializer

public class SSSOMSerializer extends Object
The SSSOMSerializer can serialize to SSSOM files following the convention described in the SSSOM github and userguide.
Author:
Sven Hertling
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • ENCODING

      private static final Charset ENCODING
      Constant for UTF-8 encoding.
    • SSSOM_ALTERNATIVES

      private static final Map<String,List<String>> SSSOM_ALTERNATIVES
    • NEWLINE

      private static final String NEWLINE
  • Constructor Details

    • SSSOMSerializer

      public SSSOMSerializer()
  • Method Details

    • serialize

      public static void serialize(Alignment alignment, File file) throws IOException
      Method to write the specified alignment to the specified file in the SSSOM format.
      Parameters:
      alignment - The alignment that shall be written.
      file - The file to which the alignment shall be written.
      Throws:
      IOException - Exception that occurred while serializing the alignment.
    • serialize

      public static String serialize(Alignment alignment) throws IOException
      Serializes an alignment as String.
      Parameters:
      alignment - The alignment to be serialized.
      Returns:
      Alignment as String.
      Throws:
      IOException - in case of an io error
    • serialize

      public static String serialize(Alignment alignment, boolean includeNonSSSOMAttributes) throws IOException
      Serializes an alignment as String.
      Parameters:
      alignment - The alignment to be serialized.
      includeNonSSSOMAttributes - if true include also non SSSOM attributes in the output.
      Returns:
      Alignment as String.
      Throws:
      IOException - in case of an io error
    • initAlternatives

      private static Map<String,List<String>> initAlternatives()
    • serialize

      public static void serialize(Alignment alignment, OutputStream stream) throws IOException
      Method to write the specified alignment to the specified file in the SSSOM format. The provided OutputStream is not closed.
      Parameters:
      alignment - The alignment that shall be written.
      stream - the stream where the serialized alignment should be written to (the stream is not closed)
      Throws:
      IOException - Exception that occurred while serializing the alignment.
    • serialize

      public static void serialize(Alignment alignment, OutputStream stream, boolean includeNonSSSOMAttributes) throws IOException
      Method to write the specified alignment to the specified file in the SSSOM format. The provided OutputStream is not closed.
      Parameters:
      alignment - The alignment that shall be written.
      stream - the stream where the serialized alignment should be written to (the stream is not closed)
      includeNonSSSOMAttributes - if true include also non SSSOM attributes in the output.
      Throws:
      IOException - Exception that occurred while serializing the alignment.
    • writeMetadata

      private static void writeMetadata(SSSOMPrefixMap prefixMap, Alignment a, OutputStreamWriter writer, boolean includeNonSSSOMAttributes) throws IOException
      Throws:
      IOException