Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Nov 12, 2024
1 parent 179075b commit 4c1a8ad
Showing 1 changed file with 42 additions and 37 deletions.
79 changes: 42 additions & 37 deletions src/core/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,52 +260,57 @@ impl Manifest {

impl Select for Manifest {
fn select(self, selection: &Selection) -> Result<Self> {
let rows: Vec<_> = self.records.iter().filter(|row| {
let mut valid = true;
valid = if let Some(ksize) = selection.ksize() {
row.ksize == ksize
} else {
valid
};
valid = if let Some(abund) = selection.abund() {
valid && row.with_abundance() == abund
} else {
valid
};
valid = if let Some(moltype) = selection.moltype() {
valid && row.moltype() == moltype
} else {
valid
};
valid = if let Some(scaled) = selection.scaled() {
// num sigs have row.scaled = 0, don't include them
valid && row.scaled != 0 && row.scaled <= scaled
} else {
valid
};
valid = if let Some(num) = selection.num() {
valid && row.num == num
} else {
let rows: Vec<_> = self
.records
.iter()
.filter(|row| {
let mut valid = true;
valid = if let Some(ksize) = selection.ksize() {
row.ksize == ksize
} else {
valid
};
valid = if let Some(abund) = selection.abund() {
valid && row.with_abundance() == abund
} else {
valid
};
valid = if let Some(moltype) = selection.moltype() {
valid && row.moltype() == moltype
} else {
valid
};
valid = if let Some(scaled) = selection.scaled() {
// num sigs have row.scaled = 0, don't include them
valid && row.scaled != 0 && row.scaled <= scaled
} else {
valid
};
valid = if let Some(num) = selection.num() {
valid && row.num == num
} else {
valid
};
valid
};
valid
}).cloned().collect();
})
.cloned()
.collect();

// if scaled is set, update!
let rows: Vec<_> = if let Some(scaled) = selection.scaled() {
rows.iter().map(|r| {
let mut r = r.clone();
r.scaled = scaled;
r
}).collect()
rows.iter()
.map(|r| {
let mut r = r.clone();
r.scaled = scaled;
r
})
.collect()
} else {
rows
};
// TODO: with num as well?

Ok(Manifest {
records: rows
})
Ok(Manifest { records: rows })

/*
matching_rows = self.rows
Expand Down

0 comments on commit 4c1a8ad

Please sign in to comment.