Skip to content

Commit

Permalink
Merge pull request #18 from COMBINE-lab/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rob-p committed Feb 16, 2024
2 parents c421c44 + ff4940f commit f35f2f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
20 changes: 9 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ categories = ["command-line-utilities", "science"]

[dependencies]
snap = "1"
scroll = "0.11.0"
num = "0.4.0"
ahash = "0.8.3"
serde = { version = "1.0.164", features = ["derive"] }
dashmap = "^5.4.0"
bio-types = "1.0.0"
smallvec = "1.10.0"
rust-htslib = { version = "0.44.1", default-features = false, features = [
"bzip2",
"lzma",
] }
scroll = "0.12.0"
num = "0.4.1"
ahash = "0.8.8"
serde = { version = "1.0.196", features = ["derive"] }
dashmap = "^5.5.3"
bio-types = "1.0.1"
smallvec = "1.13.1"
noodles-bam = "0.56.0"
noodles-sam = "0.53.0"
18 changes: 8 additions & 10 deletions src/rad_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate as libradicl;
use self::libradicl::utils;
use bio_types::strand::*;
use num::cast::AsPrimitive;
use rust_htslib::bam::HeaderView;
use noodles_sam as sam;
use scroll::Pread;
use std::io::Write;
use std::io::{Cursor, Read};
Expand Down Expand Up @@ -471,27 +471,25 @@ impl RadHeader {
rh.num_chunks = buf.pread::<u64>(0).unwrap();
rh
}
pub fn from_bam_header(header: &HeaderView) -> RadHeader {

pub fn from_bam_header(header: &sam::Header) -> RadHeader {
let mut rh = RadHeader {
is_paired: 0,
ref_count: 0,
ref_names: vec![],
num_chunks: 0,
};

rh.ref_count = header.target_count() as u64;
let ref_seqs = header.reference_sequences();
rh.ref_count = ref_seqs.len() as u64;
// we know how many names we will read in.
rh.ref_names.reserve_exact(rh.ref_count as usize);
for (_i, t) in header
.target_names()
.iter()
.map(|a| std::str::from_utf8(a).unwrap())
.enumerate()
{
rh.ref_names.push(t.to_owned());
for (k, _v) in ref_seqs.iter() {
rh.ref_names.push(k.to_string());
}
rh
}

pub fn get_size(&self) -> usize {
let mut tot_size = 0usize;
tot_size += std::mem::size_of::<u8>() + std::mem::size_of::<u64>();
Expand Down

0 comments on commit f35f2f1

Please sign in to comment.