Skip to content

Saving files

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

Saving Files

Use IOController.saveFiles(...) to write RNAFile objects to disk. The method accepts any List<RNAFile> — files do not need to have been loaded through the controller.


Method Signature

io.saveFiles(
    files,               // List<RNAFile> to save
    Path.of("/output/"), // destination directory
    true,                // generate non-canonical pairs CSV?
    true,                // generate statistics CSV?
    "results"            // ZIP archive name (null or "" to skip)
);

Save Options

Parameter Type Description
files List<RNAFile> Files to write
outputDir Path Destination directory
generateNonCanonicalPairs boolean Produce _nc.csv files
generateStatistics boolean Produce _seqInfo.csv files
zipFileName String Archive name; blank/null to skip

Output Naming Convention

Each saved file is named:

<original_name_without_extension>.<format_extension>.txt

Example: structure.bpseq translated to DB → structure.db.txt


Statistics CSV (_seqInfo.csv)

When generateStatistics is true, a CSV with these columns is produced for each file:

Nucleotide count, Bond count, A count, C count, G count, U count, GC bonds, AU bonds, GU bonds

Statistics requiring the nucleotide sequence return 0 for DB NO SEQUENCE, AAS NO SEQUENCE, and FASTA.


Non-Canonical Pairs CSV (_nc.csv)

When generateNonCanonicalPairs is true, CSV files listing detected non-canonical pairs are produced. These files are generated by an external component in the current working directory (user.dir) — ensure it is writable.


ZIP Archive

When zipFileName is non-blank, all generated files (translated files + CSVs) are compressed into a single ZIP archive and the intermediate files are deleted.


Saving Translated Files

List<RNAFile> translated = io.getLoadedRNAFiles().stream()
        .map(f -> translator.translate(f, RNAFormat.DB))
        .toList();
 
io.saveFiles(translated, Path.of("/output/"), false, true, "output_db");

See Also

Clone this wiki locally