-
Notifications
You must be signed in to change notification settings - Fork 0
Loading files
All loading operations go through IOController, which is a stateful singleton. Acquire the instance once and reuse it:
IOController io = IOController.getInstance();RNAFile file = io.loadFile(Path.of("structure.bpseq"));
System.out.println("Detected format : " + file.getFormat());
System.out.println("Nucleotides : " + file.getStructure().getSize());loadFile parses the file, adds it to the internal list, and sets the session's recognized format.
⚠️ If a file with a different format from the already-loaded ones is loaded, anIllegalArgumentExceptionis thrown.
io.loadDirectory(Path.of("/data/structures/"));
List<RNAFile> files = io.getLoadedRNAFiles();
System.out.println("Loaded files : " + files.size());
System.out.println("Shared format : " + io.getRecognizedFormat());The method automatically ignores:
- Hidden files (names starting with
.) - Files inside subdirectories whose name contains a dot Subdirectories are not visited recursively.
All files in the directory must share the same format; the first non-conforming file causes an IllegalArgumentException.
To parse a file without adding it to the controller's managed list:
RNAFile file = io.getRNAFileOf(Path.of("single_structure.db"));Useful for one-off inspection or when mixing files from different sessions.
The format is detected from file content via the ANTLR4 parser, not from the file extension. A .txt file containing BPSEQ content is correctly recognized as BPSEQ.
RNA2DFormatIO – Copyright © 2026 Francesco Palozzi.
University of Camerino – Licensed under the Apache License, Version 2.0.