-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from COMBINE-lab/develop
merge develop into main
- Loading branch information
Showing
18 changed files
with
3,087 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "libradicl" | ||
version = "0.8.2" | ||
version = "0.9.0" | ||
authors = [ | ||
"Avi Srivastava <[email protected]>", | ||
"Hirak Sarkar <[email protected]>", | ||
|
@@ -28,15 +28,20 @@ categories = ["command-line-utilities", "science"] | |
[dependencies] | ||
snap = "1" | ||
scroll = "0.12.0" | ||
num = "0.4.1" | ||
ahash = "0.8.9" | ||
serde = { version = "1.0.197", features = ["derive"] } | ||
dashmap = "^5.5.3" | ||
num = "0.4.3" | ||
ahash = "0.8.11" | ||
serde = { version = "1.0.204", features = ["derive"] } | ||
dashmap = "^6.0.1" | ||
bio-types = "1.0.1" | ||
smallvec = "1.13.1" | ||
noodles-bam = "0.56.0" | ||
noodles-sam = "0.53.0" | ||
anyhow = "1.0.80" | ||
smallvec = "1.13.2" | ||
noodles-bam = "0.64.0" | ||
noodles-sam = "0.61.0" | ||
anyhow = "1.0.86" | ||
itertools = "0.13.0" | ||
bytemuck = { version = "1.16.1", features = ["aarch64_simd"] } | ||
derivative = "2.2.0" | ||
crossbeam-queue = "0.3.11" | ||
|
||
[dev-dependencies] | ||
needletail="0.5.1" | ||
indicatif="0.17.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; | ||
use libradicl::{ | ||
//header::RadPrelude, | ||
//readers::ParallelChunkReader, | ||
readers::ParallelRadReader, | ||
record::AtacSeqReadRecord, | ||
}; | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
use std::num::NonZeroUsize; | ||
use std::sync::atomic::Ordering; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
let f = File::open("../piscem_atac_data/map.rad")?; | ||
let metadata = f.metadata()?; | ||
let file_len = metadata.len(); | ||
let ifile = BufReader::new(f); | ||
|
||
const NWORKERS: usize = 12; | ||
let mut rad_reader = ParallelRadReader::<AtacSeqReadRecord, BufReader<File>>::new( | ||
ifile, | ||
NonZeroUsize::new(NWORKERS).unwrap(), | ||
); | ||
|
||
if let Ok(summary) = rad_reader.prelude.summary(None) { | ||
println!("{}", summary); | ||
} | ||
println!("tag map {:?}\n", rad_reader.file_tag_map); | ||
println!("num chunks = {:?}\n", rad_reader.prelude.hdr.num_chunks()); | ||
|
||
let mut handles = Vec::<std::thread::JoinHandle<usize>>::new(); | ||
for _ in 0..NWORKERS { | ||
let rd = rad_reader.is_done(); | ||
let q = rad_reader.get_queue(); | ||
let handle = std::thread::spawn(move || { | ||
let mut nrec_processed = 0_usize; | ||
while !rd.load(Ordering::SeqCst) { | ||
while let Some(meta_chunk) = q.pop() { | ||
for c in meta_chunk.iter() { | ||
nrec_processed += c.nrec as usize; | ||
/* | ||
println!("Chunk :: nbytes: {}, nrecs: {}", c.nbytes, c.nrec); | ||
assert_eq!(c.nrec as usize, c.reads.len()); | ||
for (i, r) in c.reads.iter().take(10).enumerate() { | ||
println!("record {i}: {:?}", r); | ||
} | ||
*/ | ||
} | ||
} | ||
} | ||
nrec_processed | ||
}); | ||
handles.push(handle); | ||
} | ||
|
||
// simple callback if we want to test one | ||
let header_offset = rad_reader.get_byte_offset(); | ||
let pbar = ProgressBar::new(file_len - header_offset); | ||
pbar.set_style( | ||
ProgressStyle::with_template( | ||
"[{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {msg}", | ||
) | ||
.unwrap() | ||
.progress_chars("##-"), | ||
); | ||
pbar.set_draw_target(ProgressDrawTarget::stderr_with_hz(5)); | ||
let cb = |new_bytes: u64, _new_rec: u64| { | ||
pbar.inc(new_bytes); | ||
}; | ||
|
||
let _ = rad_reader.start_chunk_parsing(Some(cb)); //libradicl::readers::EMPTY_METACHUNK_CALLBACK); | ||
let mut total_processed = 0; | ||
for handle in handles { | ||
total_processed += handle.join().expect("The parsing thread panicked"); | ||
} | ||
pbar.finish_with_message(format!( | ||
"finished parsing RAD file; processed {} total records\n", | ||
total_processed | ||
)); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; | ||
use libradicl::{ | ||
//header::RadPrelude, | ||
//readers::ParallelChunkReader, | ||
readers::ParallelRadReader, | ||
record::AlevinFryReadRecord, | ||
}; | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
use std::num::NonZeroUsize; | ||
use std::sync::atomic::Ordering; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
let f = File::open("../piscem_atac_data/map.rad")?; | ||
let metadata = f.metadata()?; | ||
let file_len = metadata.len(); | ||
let ifile = BufReader::new(f); | ||
|
||
const NWORKERS: usize = 12; | ||
let mut rad_reader = ParallelRadReader::<AlevinFryReadRecord, BufReader<File>>::new( | ||
ifile, | ||
NonZeroUsize::new(NWORKERS).unwrap(), | ||
); | ||
|
||
if let Ok(summary) = rad_reader.prelude.summary(None) { | ||
println!("{}", summary); | ||
} | ||
println!("tag map {:?}\n", rad_reader.file_tag_map); | ||
println!("num chunks = {:?}\n", rad_reader.prelude.hdr.num_chunks()); | ||
|
||
let mut handles = Vec::<std::thread::JoinHandle<usize>>::new(); | ||
for _ in 0..NWORKERS { | ||
let rd = rad_reader.is_done(); | ||
let q = rad_reader.get_queue(); | ||
let handle = std::thread::spawn(move || { | ||
let mut nrec_processed = 0_usize; | ||
while !rd.load(Ordering::SeqCst) { | ||
while let Some(meta_chunk) = q.pop() { | ||
for c in meta_chunk.iter() { | ||
nrec_processed += c.nrec as usize; | ||
/* | ||
println!("Chunk :: nbytes: {}, nrecs: {}", c.nbytes, c.nrec); | ||
assert_eq!(c.nrec as usize, c.reads.len()); | ||
for (i, r) in c.reads.iter().take(10).enumerate() { | ||
println!("record {i}: {:?}", r); | ||
} | ||
*/ | ||
} | ||
} | ||
} | ||
nrec_processed | ||
}); | ||
handles.push(handle); | ||
} | ||
|
||
// simple callback if we want to test one | ||
let header_offset = rad_reader.get_byte_offset(); | ||
let pbar = ProgressBar::new(file_len - header_offset); | ||
pbar.set_style( | ||
ProgressStyle::with_template( | ||
"[{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {msg}", | ||
) | ||
.unwrap() | ||
.progress_chars("##-"), | ||
); | ||
pbar.set_draw_target(ProgressDrawTarget::stderr_with_hz(5)); | ||
let cb = |new_bytes: u64, _new_rec: u64| { | ||
pbar.inc(new_bytes); | ||
}; | ||
|
||
let _ = rad_reader.start_chunk_parsing(Some(cb)); //libradicl::readers::EMPTY_METACHUNK_CALLBACK); | ||
let mut total_processed = 0; | ||
for handle in handles { | ||
total_processed += handle.join().expect("The parsing thread panicked"); | ||
} | ||
pbar.finish_with_message(format!( | ||
"finished parsing RAD file; processed {} total records\n", | ||
total_processed | ||
)); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.