Skip to content

Format translation

Francesco Palozzi edited this page Jun 6, 2026 · 1 revision
RNAFile source = io.loadFile(Path.of("structure.bpseq"));
RNAFile translated = translator.translate(source, RNAFormat.DB);
 
System.out.println("New format: " + translated.getFormat());
translated.getContent().forEach(System.out::println);

Querying Available Translations

Before translating, check which target formats are compatible with a given source:

List<RNAFormat> available = translator.getAvailableTranslations(RNAFormat.BPSEQ);
available.forEach(System.out::println);

Batch Translation

Translate all loaded files at once using streams:

io.loadDirectory(Path.of("/data/bpseq/"));
 
List<RNAFile> translated = io.getLoadedRNAFiles().stream()
        .map(f -> translator.translate(f, RNAFormat.DB))
        .toList();

See Also

Clone this wiki locally