Skip to content

Commit

Permalink
remove unuseed block aligner
Browse files Browse the repository at this point in the history
  • Loading branch information
cschin committed Dec 18, 2023
1 parent cd43d12 commit deef4cb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 98 deletions.
14 changes: 14 additions & 0 deletions build_no_agc_apple_slicon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pushd WFA2-lib
#make all
#popd

#rustup default stable
rustup default stable-aarch64-apple-darwin
cargo build -p pgr-db --release --no-default-features
cargo build -p pgr-bin --release --no-default-features
cargo install --path pgr-bin --no-default-features

pushd pgr-tk/
maturin build --release --no-default-features
maturin build --release --skip-auditwheel --no-default-features
popd
1 change: 0 additions & 1 deletion pgr-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bincode = { version = "2.0.0-rc.1", features = ["alloc"] }
serde_json = "1.0.96"
serde = "1.0.163"
iset = "0.2.2"
block-aligner = { version = "0.5", features = ["simd_avx2"] }

[features]
default = ["with_agc"]
Expand Down
97 changes: 0 additions & 97 deletions pgr-bin/src/bin/pgr-generate-sv-analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,103 +332,6 @@ fn get_sw_aln_diff(s0str: &[u8], s1str: &[u8]) -> AlnDiff {
wfa_aln_diff
}

use block_aligner::{cigar::*, scan_block::*, scores::*};
fn get_block_aligner_diff(s0: &[u8], s1: &[u8]) -> AlnDiff {
let min_block_size = 256;
let max_block_size = 1024;

let nw: NucMatrix = NucMatrix::new_simple(1, -4);
let gaps = Gaps {
open: -3,
extend: -1,
};
let r = PaddedBytes::from_bytes::<NucMatrix>(s0, max_block_size);
let q = PaddedBytes::from_bytes::<NucMatrix>(s1, max_block_size);
let mut a = Block::<true, false>::new(q.len(), r.len(), max_block_size);
a.align(&q, &r, &nw, gaps, min_block_size..=max_block_size, 0);
let res = a.res();
// println!("score: {}", res.score);

let mut cigar = Cigar::new(res.query_idx, res.reference_idx);
a.trace()
.cigar_eq(&q, &r, res.query_idx, res.reference_idx, &mut cigar);
//println!("{}", cigar.to_string());
let mut p_t_match_end = 1_u32;
let mut p_q_match_end = 1_u32;
let mut t_pos = 0_u32;
let mut q_pos = 0_u32;
let mut cigar_vec = cigar.to_vec();
cigar_vec.push(OpLen {
op: Operation::Eq,
len: 0,
}); // Sentinel to trigger generating the last block
let diff = cigar_vec
.into_iter()
.flat_map(|oplen| match oplen.op {
Operation::Eq => {
let out = if t_pos >= p_t_match_end || q_pos >= p_q_match_end {
if t_pos - p_t_match_end == q_pos - p_q_match_end && q_pos - p_q_match_end > 0 {
let tvs =
String::from_utf8_lossy(&s0[p_t_match_end as usize..t_pos as usize])
.deref()
.to_owned();
let qvs =
String::from_utf8_lossy(&s1[p_q_match_end as usize..q_pos as usize])
.deref()
.to_owned();
Some((p_t_match_end, p_q_match_end, 'M', tvs.clone(), qvs.clone()))
} else {
let tvs = String::from_utf8_lossy(
&s0[p_t_match_end as usize - 1..t_pos as usize],
)
.deref()
.to_owned();
let qvs = String::from_utf8_lossy(
&s1[p_q_match_end as usize - 1..q_pos as usize],
)
.deref()
.to_owned();
if tvs.len() > qvs.len() {
if !qvs.is_empty() {
Some((p_t_match_end - 1, p_q_match_end - 1, 'D', tvs, qvs))
} else {
Some((p_t_match_end - 1, p_q_match_end - 1, 'E', tvs, qvs))
// Error
}
} else if !tvs.is_empty() && tvs.len() < qvs.len() {
Some((p_t_match_end - 1, p_q_match_end - 1, 'I', tvs, qvs))
} else {
Some((p_t_match_end - 1, p_q_match_end - 1, 'E', tvs, qvs))
// Error
}
}
} else {
None
};
t_pos += oplen.len as u32;
q_pos += oplen.len as u32;
p_t_match_end = t_pos;
p_q_match_end = q_pos;
out
}
Operation::I => {
q_pos += oplen.len as u32;
None
}
Operation::D => {
t_pos += oplen.len as u32;
None
}
Operation::X => {
t_pos += oplen.len as u32;
q_pos += oplen.len as u32;
None
}
_ => None,
})
.collect::<Vec<_>>();
AlnDiff::Aligned(diff)
}

fn aln_diff_to_records(
rec: &CandidateRecord,
Expand Down

0 comments on commit deef4cb

Please sign in to comment.