Skip to content

Commit

Permalink
fix doc tests with new kmer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-k committed Oct 12, 2024
1 parent 81b1bcd commit 1f5bdab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bio-seq/src/kmer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ impl<A: Codec + Complement, const K: usize> ReverseComplement for Kmer<A, K> {
/// This is a wrapper for the `dna!` macro that returns a `Kmer`:
/// ```
/// # use bio_seq::prelude::*;
/// let kmer: Kmer<Dna, 8> = dna!("ACGTACGT").into();
/// let kmer: Kmer<Dna, 8> = kmer!("ACGTACGT");
/// ```
#[macro_export]
macro_rules! kmer {
Expand Down
2 changes: 1 addition & 1 deletion bio-seq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
//! let seq: &'static SeqSlice<Dna> = dna!("CGCTAGCTACGATCGCAT");
//!
//! // Sequences can also be copied into `Kmer`s:
//! let kmer: Kmer<Dna, 18> = dna!("CGCTAGCTACGATCGCAT").into();
//! let kmer: Kmer<Dna, 18> = dna!("CGCTAGCTACGATCGCAT").try_into().unwrap();
//! // or with the kmer! macro:
//! let kmer = kmer!("CGCTAGCTACGATCGCAT");
//!
Expand Down
13 changes: 7 additions & 6 deletions bio-seq/src/seq/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
//! use bio_seq::prelude::*;
//! use bio_seq::seq;
//!
//! let reference: Seq<Dna> = dna!("ACGTTCGCATGCTACGACGATC").into();
//! let reference = dna!("ACGTTCGCATGCTACGACGATC");
//!
//! let mut table: HashMap<Seq<Dna>, &SeqSlice<Dna>> = HashMap::new();
//! table.insert(dna!("ACGTT").into(), &reference[2..5]);
//! table.insert(dna!("ACACCCCC").into(), &reference[6..]);
//! let mut table: HashMap<&SeqSlice<Dna>, usize> = HashMap::new();
//!
//! // Associate some kind of count with sequences as keys:
//! table.insert(dna!("ACGTT"), 1);
//! table.insert(dna!("ACACCCCC"), 0);
//!
//! // The query is a short window in the reference `Seq`
//! let query: &SeqSlice<Dna> = &reference[..5];
//!
//! // The keys of the hashmap are `Seq`, but since `Seq` can be borrowed as a SeqSlice we can call `HashMap::get` on another slice.
//! if let Some(value) = table.get(&query) {
//! // `SeqSlice` implements `Display`
//! println!("{value}");
//! println!("{query}: {value}");
//! }
//! ```
pub mod index;
Expand Down

0 comments on commit 1f5bdab

Please sign in to comment.