Parse .prm file contents into structured list
Usage
read_prm(file)
write_prm(x, file = stdout(), add_comments = TRUE, sep = " ")Details
.prm files are simple key-value text files:
#' Comments start with #
scalar_key 1.0
biosedprofile gaussian
# Arrays: key followed by count, then values on next line
array_key 4
1.0 1.0 1.0 1.0.The key differences between read_prm() and the Atlantis parser are:
Comments: lines starting with # are not skipped, they are collected and stored as an attributes to the list elements
Array padding: in the original parser, if fewer values than declared size, the last value is repeated to fill.
read_prm()will throw an error instead.
To be consistent with the Atlantis parser, lines with more than 4000 characters (a lot, even for vectors) throw an error. Also, key duplicates will trigger warnings and the
