diff --git a/bio-seq/src/kmer/mod.rs b/bio-seq/src/kmer/mod.rs index 437cf18..dbe8b25 100644 --- a/bio-seq/src/kmer/mod.rs +++ b/bio-seq/src/kmer/mod.rs @@ -542,7 +542,7 @@ impl ReverseComplement for Kmer { /// This is a wrapper for the `dna!` macro that returns a `Kmer`: /// ``` /// # use bio_seq::prelude::*; -/// let kmer: Kmer = dna!("ACGTACGT").into(); +/// let kmer: Kmer = kmer!("ACGTACGT"); /// ``` #[macro_export] macro_rules! kmer { diff --git a/bio-seq/src/lib.rs b/bio-seq/src/lib.rs index 2bfbff9..00328fc 100644 --- a/bio-seq/src/lib.rs +++ b/bio-seq/src/lib.rs @@ -53,7 +53,7 @@ //! let seq: &'static SeqSlice = dna!("CGCTAGCTACGATCGCAT"); //! //! // Sequences can also be copied into `Kmer`s: -//! let kmer: Kmer = dna!("CGCTAGCTACGATCGCAT").into(); +//! let kmer: Kmer = dna!("CGCTAGCTACGATCGCAT").try_into().unwrap(); //! // or with the kmer! macro: //! let kmer = kmer!("CGCTAGCTACGATCGCAT"); //! diff --git a/bio-seq/src/seq/mod.rs b/bio-seq/src/seq/mod.rs index bf574af..7855a67 100644 --- a/bio-seq/src/seq/mod.rs +++ b/bio-seq/src/seq/mod.rs @@ -12,19 +12,20 @@ //! use bio_seq::prelude::*; //! use bio_seq::seq; //! -//! let reference: Seq = dna!("ACGTTCGCATGCTACGACGATC").into(); +//! let reference = dna!("ACGTTCGCATGCTACGACGATC"); //! -//! let mut table: HashMap, &SeqSlice> = HashMap::new(); -//! table.insert(dna!("ACGTT").into(), &reference[2..5]); -//! table.insert(dna!("ACACCCCC").into(), &reference[6..]); +//! let mut table: HashMap<&SeqSlice, 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 = &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;