///|
/// Bio.SCOP.Raf / Bio.SCOP.Dom Demo.
///
/// Demonstrates the ASTRAL RAF (Rapid Access Format) sequence maps and the
/// (deprecated) SCOP DOMain file: parsing RAF records, indexing, cutting a
/// domain's sequence map, extracting the matching PDB ATOM records, and
/// round-tripping DOM records.
///|
/// Build a synthetic RAF record line for the given residues
/// (resid, ATOM-letter, SEQRES-letter); header is padded to 38 columns.
fn raf_line(
pdbid : String,
chainid : String,
version : String,
flags : String,
residues : Array[(String, String, String)],
) -> String {
let mut line = pdbid +
chainid +
" " +
version +
" " +
"26JUN9" +
" " +
flags
while line.length() < 38 {
line = line + " "
}
for residue in residues {
let (resid, atom, seqres) = residue
let mut field = resid
while field.length() < 5 {
field = " " + field
}
line = line + field + atom + seqres
}
line
}
///|
fn main raise {
println("=== 1. Parse a RAF sequence map ===")
let line = raf_line("1sct", "A", "0.01", "150212", [
("1", "A", "A"),
("2", "G", "G"),
("10A", "K", "K"),
("11", "R", "R"),
])
let seqmap = @src.scop_raf_seqmap_parse(line)
println("pdbid: \{seqmap.pdbid}")
println("datestamp: \{seqmap.pdb_datestamp}")
println("version: \{seqmap.version}")
println("flags: \{seqmap.flags}")
println("residues: \{seqmap.length()}")
for i in 0..