///|
/// PHD module demo - Phred base-calling quality file parser.
///
/// Run: moon run examples/phd_demo
fn main {
println("=== PHD Module Demo ===")
println("Phred base-calling output file parser")
println("Reference: Ewing B et al. (1998) Genome Res 8(3):175-85")
println("")
// ------------------------------------------------------------------
// 1. Generate and parse sample PHD file
// ------------------------------------------------------------------
println("=== 1. Generate and parse sample PHD file ===")
let text = @bio.phd_sample_text()
let file = @bio.phd_parse(text)
println("Parsed " + file.num_reads().to_string() + " read(s)")
println("")
// ------------------------------------------------------------------
// 2. Display read information
// ------------------------------------------------------------------
println("=== 2. Read information ===")
let read = file.get(0).unwrap()
println("Read name: " + read.name())
println("Length: " + read.length().to_string() + " bases")
println("Sequence: " + read.sequence())
println("")
// ------------------------------------------------------------------
// 3. Display quality scores
// ------------------------------------------------------------------
println("=== 3. Quality scores ===")
let quals = read.quality()
for i in 0..= 40 {
" (high)"
} else if quals[i] >= 20 {
" (medium)"
} else {
" (low)"
}
println(
" base " + (i + 1).to_string() + ": Q=" + quals[i].to_string() + marker,
)
}
println("")
// ------------------------------------------------------------------
// 4. Display peak positions
// ------------------------------------------------------------------
println("=== 4. Peak positions (trace indices) ===")
let peaks = read.peak_positions()
for i in 0..