Rename PersistentCompactIntMatrix to PersistentIntMatrix
Update all matrix type references, imports, and instantiations across the codebase to use the new PersistentIntMatrix name. The change also includes standardizing code formatting, such as multi-line statements and import ordering, without altering any behavioral logic or public API contracts.
This commit is contained in:
1 parent
6bdc9354d3
commit
4b6005962e
14 files changed
+779
-369
No files matched your search
@@ -11,8 +11,8 @@ use std::io;
|
||||
use std::path::Path;
|
||||
|
||||
use obicompactvec::{
|
||||
ColGroup, MatrixBuilder, MatrixGroupOps, PersistentBitMatrix,
|
||||
PersistentCompactIntMatrix, TempBitVec, TempCompactIntVec,
|
||||
ColGroup, MatrixBuilder, MatrixGroupOps, PersistentBitMatrix, PersistentIntMatrix, TempBitVec,
|
||||
TempCompactIntVec,
|
||||
};
|
||||
use obikindex::layer::{KmerLayer, LayerContent};
|
||||
use obikindex::{KmerIndex, OKIError, OKIResult};
|
||||
@@ -39,13 +39,15 @@ impl AggOp {
|
||||
/// `--aggregate-op`.
|
||||
pub fn parse(s: &str) -> Result<Self, String> {
|
||||
match s.to_lowercase().as_str() {
|
||||
"any" => Ok(AggOp::Any),
|
||||
"all" => Ok(AggOp::All),
|
||||
"any" => Ok(AggOp::Any),
|
||||
"all" => Ok(AggOp::All),
|
||||
"none" => Ok(AggOp::None),
|
||||
"sum" => Ok(AggOp::Sum),
|
||||
"min" => Ok(AggOp::Min),
|
||||
"max" => Ok(AggOp::Max),
|
||||
other => Err(format!("unknown aggregation operator: {other}; valid: any, all, none, sum, min, max")),
|
||||
"sum" => Ok(AggOp::Sum),
|
||||
"min" => Ok(AggOp::Min),
|
||||
"max" => Ok(AggOp::Max),
|
||||
other => Err(format!(
|
||||
"unknown aggregation operator: {other}; valid: any, all, none, sum, min, max"
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +77,11 @@ enum AggResult {
|
||||
Int(TempCompactIntVec),
|
||||
}
|
||||
|
||||
fn compute_group(mat: &dyn MatrixGroupOps, spec: &OutputCol, threshold: u32) -> io::Result<AggResult> {
|
||||
fn compute_group(
|
||||
mat: &dyn MatrixGroupOps,
|
||||
spec: &OutputCol,
|
||||
threshold: u32,
|
||||
) -> io::Result<AggResult> {
|
||||
let g = ColGroup::new(spec.label.clone(), spec.indices.clone());
|
||||
Ok(match spec.op {
|
||||
AggOp::Any => AggResult::Bit(mat.partial_group_any(&g, threshold)?),
|
||||
@@ -145,18 +151,23 @@ pub(crate) fn select_partition(
|
||||
|
||||
let group_mat: Box<dyn MatrixGroupOps> = match src_layer.content() {
|
||||
LayerContent::Count => {
|
||||
Box::new(PersistentCompactIntMatrix::open(src_layer.dir()).map_err(OKIError::Io)?)
|
||||
Box::new(PersistentIntMatrix::open(src_layer.dir()).map_err(OKIError::Io)?)
|
||||
}
|
||||
LayerContent::Presence => {
|
||||
Box::new(PersistentBitMatrix::open(src_layer.dir()).map_err(OKIError::Io)?)
|
||||
}
|
||||
};
|
||||
|
||||
let data_subdir = if output_presence { "presence" } else { "counts" };
|
||||
let data_subdir = if output_presence {
|
||||
"presence"
|
||||
} else {
|
||||
"counts"
|
||||
};
|
||||
let data_dir = dst_layer_dir.join(data_subdir);
|
||||
fs::create_dir_all(&data_dir).map_err(OKIError::Io)?;
|
||||
|
||||
let mut builder = MatrixBuilder::new(output_presence, n, &data_dir).map_err(OKIError::Io)?;
|
||||
let mut builder =
|
||||
MatrixBuilder::new(output_presence, n, &data_dir).map_err(OKIError::Io)?;
|
||||
for spec in specs {
|
||||
let r = compute_group(group_mat.as_ref(), spec, threshold).map_err(OKIError::Io)?;
|
||||
add_result(&mut builder, r).map_err(OKIError::Io)?;
|
||||
|
||||
Reference in new issue
Block a user