@@ -122,7 +122,7 @@ fn to_anchor_hits(hits: &[TblHit]) -> Vec<HitIvl> {
122122}
123123
124124/// Sort by score desc, then evalue asc, keep top K
125- fn top_k < ' a > ( mut v : Vec < & ' a HitIvl > , k : usize ) -> Vec < & ' a HitIvl > {
125+ fn top_k ( mut v : Vec < & HitIvl > , k : usize ) -> Vec < & HitIvl > {
126126 v. sort_by ( |a, b| {
127127 b. score
128128 . partial_cmp ( & a. score )
@@ -470,82 +470,6 @@ fn count_anchors(ah: &[HitIvl]) -> AnchorCounts {
470470 c
471471}
472472
473- /// Public: explain why a read likely failed to yield bounds.
474- pub fn diagnose (
475- hits : & [ TblHit ] ,
476- region : Region ,
477- max_per_anchor : usize ,
478- constraints : Constraints ,
479- ) -> String {
480- let ah = to_anchor_hits ( hits) ;
481- if ah. is_empty ( ) {
482- return "no classified anchor hits (none of SSU_end/58S/LSU matched)" . to_string ( ) ;
483- }
484-
485- let counts = count_anchors ( & ah) ;
486-
487- let missing = {
488- let mut v = Vec :: new ( ) ;
489- let has_ssu = counts. ssu_p + counts. ssu_m > 0 ;
490- let has_s58s = counts. s58s_p + counts. s58s_m > 0 ;
491- let has_s58e = counts. s58e_p + counts. s58e_m > 0 ;
492- let has_lsu = counts. lsu_p + counts. lsu_m > 0 ;
493-
494- if !has_ssu {
495- v. push ( anchor_name ( Anchor :: SsuEnd ) ) ;
496- }
497- if !has_s58s {
498- v. push ( anchor_name ( Anchor :: S58Start ) ) ;
499- }
500- if !has_s58e {
501- v. push ( anchor_name ( Anchor :: S58End ) ) ;
502- }
503- if !has_lsu {
504- v. push ( anchor_name ( Anchor :: LsuStart ) ) ;
505- }
506- v
507- } ;
508-
509- let counts_str = format ! (
510- "counts(+/-): SSU_end {}/{} 58S_start {}/{} 58S_end {}/{} LSU_start {}/{}" ,
511- counts. ssu_p,
512- counts. ssu_m,
513- counts. s58s_p,
514- counts. s58s_m,
515- counts. s58e_p,
516- counts. s58e_m,
517- counts. lsu_p,
518- counts. lsu_m
519- ) ;
520-
521- if !missing. is_empty ( ) {
522- return format ! ( "missing anchors: {} | {}" , missing. join( "," ) , counts_str) ;
523- }
524-
525- // anchors exist; do we have a valid chain under constraints?
526- let chain = compute_chain ( hits, max_per_anchor, constraints) ;
527- if chain. is_none ( ) {
528- return format ! (
529- "anchors present but no valid SSU_end→58S_start→58S_end→LSU_start chain under constraints | {}" ,
530- counts_str
531- ) ;
532- }
533-
534- let chain = chain. unwrap ( ) ;
535- if bounds_from_chain ( & chain, region) . is_none ( ) {
536- return format ! (
537- "chain found, but requested region {:?} bounds invalid (start>end) | {}" ,
538- region, counts_str
539- ) ;
540- }
541-
542- // If we reach here, bounds *should* exist; this typically means downstream trimming failed (seq shorter than bounds).
543- format ! (
544- "bounds exist logically but trimming failed (likely bounds exceed sequence length) | {}" ,
545- counts_str
546- )
547- }
548-
549473/// Structured version of `diagnose` returning a machine-readable `SkipReason`.
550474pub fn diagnose_structured (
551475 hits : & [ TblHit ] ,
0 commit comments