Skip to content

Commit

Permalink
add skipmers; update as needed for core changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegenes committed Dec 17, 2024
1 parent 0d45ca9 commit 6190609
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 80 deletions.
121 changes: 75 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ crate-type = ["cdylib"]
pyo3 = { version = "0.23.3", features = ["extension-module","anyhow"], default = ["extension-module"] }
rayon = "1.10.0"
serde = { version = "1.0.204", features = ["derive"] }
sourmash = { version = "0.16.0"}
#sourmash = { version = "0.18.0"}
sourmash = {git = "https://github.com/sourmash-bio/sourmash/", branch = "try-skipmers"}
serde_json = "1.0.132"
niffler = "2.4.0"
needletail = "0.5.1"
async_zip={version="0.0.17", features=["full"]}
simple-error = "0.3.1"
anyhow = "1.0.90"
camino = "1.1.7"
csv = "1.3.0"
csv = "1.3.1"
reqwest = { version = "0.12.8", features = ["json", "stream"] }
tokio = { version = "1.42.0", features = ["full"] }
tokio-util = "0.7.11"
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ channels:
dependencies:
- sourmash>=4.8,<5
- pip
- rust
- rust=1.75
- maturin>=1,<2
- pytest
- pandas
- compilers
- compilers
26 changes: 8 additions & 18 deletions src/directsketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,34 +540,24 @@ async fn load_existing_zip_batches(outpath: &PathBuf) -> Result<(MultiCollection
if let Some(file_name) = entry_path.file_name() {
// Check if the file matches the base zip file or any batched zip file (outpath.zip, outpath.1.zip, etc.)
if let Some(captures) = zip_file_pattern.captures(file_name) {
// Wrap the `from_zipfile` call in `catch_unwind` to prevent panic propagation
let result = panic::catch_unwind(|| Collection::from_zipfile(&entry_path));
match result {
Ok(Ok(collection)) => {
// Successfully loaded the collection, push to `collections`
Collection::from_zipfile(&entry_path)
.and_then(|collection| {
collections.push(collection);

// Extract the batch number (if it exists) and update the highest_batch
// Extract batch number if it exists
if let Some(batch_str) = captures.get(1) {
if let Ok(batch_num) = batch_str.as_str().parse::<usize>() {
highest_batch = max(highest_batch, batch_num);
}
}
}
Ok(Err(e)) => {
// Handle the case where `from_zipfile` returned an error
Ok(()) // Return Ok(()) for the closure
})
.unwrap_or_else(|e| {
eprintln!(
"Warning: Failed to load zip file '{}'. Error: {:?}",
"Warning: Failed to load zip file '{}'; skipping. Zipfile Error: {:?}",
entry_path, e
);
continue; // Skip the file and continue
}
Err(_) => {
// The code inside `from_zipfile` panicked
eprintln!("Warning: Invalid zip file '{}'; skipping.", entry_path);
continue; // Skip the file and continue
}
}
});
}
}
}
Expand Down
Loading

0 comments on commit 6190609

Please sign in to comment.