Skip to content

Commit

Permalink
Merge pull request #86 from jguhlin/Change-preset-behavior
Browse files Browse the repository at this point in the history
More docs
  • Loading branch information
jguhlin authored Nov 22, 2024
2 parents fd74bb5 + 3f54a82 commit 1ba25c6
Showing 1 changed file with 56 additions and 8 deletions.
64 changes: 56 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,17 @@ impl Aligner {

impl Aligner {
/// Ergonomic function for Aligner. Sets the minimap2 preset to lr:hq.
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
pub fn lrhq(self) -> Self {
self.preset(Preset::LrHq)
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to splice
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().splice();
Expand All @@ -366,6 +372,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to splice:hq
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().splice_hq();
Expand All @@ -375,6 +384,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to Asm
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().asm();
Expand All @@ -384,6 +396,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to Asm5
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().asm5();
Expand All @@ -392,6 +407,9 @@ impl Aligner {
self.preset(Preset::Asm5)
}
/// Ergonomic function for Aligner. Sets the minimap2 preset to Asm10
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().asm10();
Expand All @@ -400,6 +418,9 @@ impl Aligner {
self.preset(Preset::Asm10)
}
/// Ergonomic function for Aligner. Sets the minimap2 preset to Asm20
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().asm20();
Expand All @@ -409,6 +430,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to sr
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().sr();
Expand All @@ -418,6 +442,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to MapPb
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().map_pb();
Expand All @@ -427,6 +454,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to MapHifi
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().map_hifi();
Expand All @@ -436,6 +466,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to MapOnt.
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().map_ont();
Expand All @@ -445,6 +478,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to AvaPb
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().ava_pb();
Expand All @@ -466,6 +502,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to Short
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().short();
Expand All @@ -475,6 +514,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to Map10k
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().map10k();
Expand All @@ -484,6 +526,9 @@ impl Aligner {
}

/// Ergonomic function for Aligner. Sets the minimap2 preset to cdna
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
/// ```
/// # use minimap2::*;
/// Aligner::builder().cdna();
Expand All @@ -493,19 +538,22 @@ impl Aligner {
}

/// Create an aligner using a preset.
pub fn preset(self, preset: Preset) -> Self {
let mut idxopt = IdxOpt::default();
let mut mapopt = MapOpt::default();
///
/// Presets should be called before any other options are set, as they change multiple
/// options at once.
pub fn preset(mut self, preset: Preset) -> Self {
// let mut idxopt = IdxOpt::default();
// let mut mapopt = MapOpt::default();

unsafe {
mm_set_opt(&0, &mut idxopt, &mut mapopt);
mm_set_opt(preset.into(), &mut idxopt, &mut mapopt)
mm_set_opt(&0, &mut self.idxopt, &mut self.mapopt);
mm_set_opt(preset.into(), &mut self.idxopt, &mut self.mapopt)
};

Self {
idxopt,
mapopt,
..Default::default()
idxopt: self.idxopt,
mapopt: self.mapopt,
..self
}
}

Expand Down

0 comments on commit 1ba25c6

Please sign in to comment.