k2tools_lib/report/
row.rs1use serde::{Deserialize, Serialize};
2
3use super::rank::TaxonomicRank;
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14pub struct ReportRow {
15 percentage: f64,
16 clade_count: u64,
17 direct_count: u64,
18 minimizer_count: Option<u64>,
19 distinct_minimizer_count: Option<u64>,
20 taxonomic_rank: TaxonomicRank,
21 taxon_id: u64,
22 name: String,
23 depth: usize,
24}
25
26impl ReportRow {
27 #[allow(clippy::too_many_arguments)]
29 pub(super) fn new(
30 percentage: f64,
31 clade_count: u64,
32 direct_count: u64,
33 minimizer_count: Option<u64>,
34 distinct_minimizer_count: Option<u64>,
35 taxonomic_rank: TaxonomicRank,
36 taxon_id: u64,
37 name: String,
38 depth: usize,
39 ) -> Self {
40 Self {
41 percentage,
42 clade_count,
43 direct_count,
44 minimizer_count,
45 distinct_minimizer_count,
46 taxonomic_rank,
47 taxon_id,
48 name,
49 depth,
50 }
51 }
52
53 #[must_use]
55 pub fn percentage(&self) -> f64 {
56 self.percentage
57 }
58
59 #[must_use]
61 pub fn clade_count(&self) -> u64 {
62 self.clade_count
63 }
64
65 #[must_use]
67 pub fn direct_count(&self) -> u64 {
68 self.direct_count
69 }
70
71 #[must_use]
73 pub fn minimizer_count(&self) -> Option<u64> {
74 self.minimizer_count
75 }
76
77 #[must_use]
79 pub fn distinct_minimizer_count(&self) -> Option<u64> {
80 self.distinct_minimizer_count
81 }
82
83 #[must_use]
85 pub fn taxonomic_rank(&self) -> TaxonomicRank {
86 self.taxonomic_rank
87 }
88
89 #[must_use]
91 pub fn taxon_id(&self) -> u64 {
92 self.taxon_id
93 }
94
95 #[must_use]
97 pub fn name(&self) -> &str {
98 &self.name
99 }
100
101 #[must_use]
103 pub fn depth(&self) -> usize {
104 self.depth
105 }
106}