Skip to content

Architecture

Francesco Palozzi edited this page Jun 6, 2026 · 1 revision

Architecture

The library is organized into three layers: controllers (entry points), model (domain objects and logic), and utilities.


Package Overview

controller/
  IOController            ← file loading and saving (Singleton)
  TranslatorController    ← format translation (Singleton)
 
model/
  rnafile/
    RNAFile               ← representation of a loaded RNA file
    RNAFormat             ← enum of supported formats
    RNAFileConstructor    ← builds an RNAFile from disk (Singleton, ANTLR)
    RNAFileTranslator     ← translation logic between formats (static methods)
    RNAInputFileParserException ← parsing exception (unchecked)
 
  rnastructure/
    RNASecondaryStructure     ← secondary structure model
    WeakBond                  ← index pair representing a bond
    NonCanonicalEdgeFamily    ← non-canonical edge family
    NonCanonicalEdgeFamilyValues ← allowed values for edge families
 
  utils/
    Region                    ← region used in the pseudoknot algorithm
    RNAStatisticsCalculator   ← structure statistics (static methods)

Key Classes

IOController (Singleton)

The main entry point for I/O operations.

Method Description
loadFile(Path) Parse and register a single file
loadDirectory(Path) Parse and register all files in a directory
getRNAFileOf(Path) Parse without registering
saveFiles(...) Write files to disk, optionally with stats and ZIP
getLoadedRNAFiles() Return an unmodifiable list of loaded files
deleteFile(RNAFile) Remove a single file from the managed list
clearAllDataStructures() Reset the controller state
getRecognizedFormat() Return the current session's format

TranslatorController (Singleton)

Handles format conversion.

Method Description
translate(RNAFile, RNAFormat) Translate a file to the target format
getAvailableTranslations(RNAFormat) List compatible target formats

RNAFile

Immutable representation of a parsed file. Key getters:

Method Returns
getFormat() RNAFormat
getFileName() Original file name
getContent() List<String> — raw lines
getStructure() RNASecondaryStructure

RNASecondaryStructure

Method Returns
getSize() Number of nucleotides
getSequence() Nucleotide sequence string
isPseudoknotted() boolean
getWeakBonds() List<WeakBond>

Design Notes

  • Singletons are stateful. IOController holds the list of loaded files and the recognized format. Always call clearAllDataStructures() between sessions with different formats.
  • ANTLR4 parsing. Format detection happens at parse time from file content, not from the file extension.
  • Translation returns new objects. translator.translate(...) never mutates the source RNAFile.
  • 1-based indexing. All position indices start at 1, both internally and in all file formats.

See Also

Clone this wiki locally