Skip to content

Commit

Permalink
Merge pull request #76 from rob-p/alignment-score
Browse files Browse the repository at this point in the history
Better detection of supplementary alignments
  • Loading branch information
jguhlin authored Aug 18, 2024
2 parents dc8acbf + 8057f2d commit a00d1d3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,7 @@ impl Aligner {

// Check options
pub fn check_opts(&self) -> Result<(), &'static str> {
let result = unsafe {
mm_check_opt(&self.idxopt, &self.mapopt)
};
let result = unsafe { mm_check_opt(&self.idxopt, &self.mapopt) };

if result == 0 {
Ok(())
Expand All @@ -568,7 +566,6 @@ impl Aligner {
}
}


/// Set index parameters for minimap2 using builder pattern
/// Creates the index as well with the given number of threads (set at struct creation).
/// You must set the number of threads before calling this function.
Expand Down Expand Up @@ -890,8 +887,8 @@ impl Aligner {
(*((*(self.idx.unwrap())).seq.offset(reg.rid as isize))).name;

let is_primary = reg.parent == reg.id;
let is_supplementary = reg.sam_pri() == 0;
let is_supplementary = (reg.parent == reg.id) && (reg.sam_pri() == 0);

// todo holy heck this code is ugly
let alignment = if !reg.p.is_null() {
let p = &*reg.p;
Expand Down Expand Up @@ -1492,9 +1489,7 @@ mod tests {

aligner.check_opts().expect("Opts are invalid");

aligner = aligner
.with_index("test_data/genome.fa", None)
.unwrap();
aligner = aligner.with_index("test_data/genome.fa", None).unwrap();

let output = aligner.map(
b"GAAATACGGGTCTCTGGTTTGACATAAAGGTCCAACTGTAATAACTGATTTTATCTGTGGGTGATGCGTTTCTCGGACAACCACGACCGCGCCCAGACTTAAATCGCACATACTGCGTCGTGCAATGCCGGGCGCTAACGGCTCAATATCACGCTGCGTCACTATGGCTACCCCAAAGCGGGGGGGGCATCGACGGGCTGTTTGATTTGAGCTCCATTACCCTACAATTAGAACACTGGCAACATTTGGGCGTTGAGCGGTCTTCCGTGTCGCTCGATCCGCTGGAACTTGGCAACCACACTCTAAACTACATGTGGTATGGCTCATAAGATCATGCGGATCGTGGCACTGCTTTCGGCCACGTTAGAGCCGCTGTGCTCGAAGATTGGGACCTACCAAC",
Expand Down

0 comments on commit a00d1d3

Please sign in to comment.