Skip to main content

hmmer_pure_rs/
lib.rs

1//! HMMER - Biological sequence analysis using profile hidden Markov models.
2//!
3//! This is a Rust port of [HMMER 3.4](http://hmmer.org/), a C tool for searching
4//! sequence databases for homologous sequences using profile HMMs.
5//!
6//! # Quick Start
7//!
8//! ```no_run
9//! use hmmer_pure_rs::{Alphabet, Bg, Hmm, Profile, Pipeline, TopHits, OProfile};
10//! use hmmer_pure_rs::hmmfile;
11//! use hmmer_pure_rs::profile::{profile_config, reconfig_length, P7_LOCAL};
12//! use hmmer_pure_rs::sequence::Sequence;
13//! use std::path::Path;
14//!
15//! // Load an HMM
16//! let hmms = hmmfile::read_hmm_file(Path::new("query.hmm")).unwrap();
17//! let hmm = &hmms[0];
18//!
19//! // Set up alphabet, background model, and scoring profile
20//! let abc = Alphabet::new(hmm.abc_type);
21//! let bg = Bg::new(&abc);
22//! let mut gm = Profile::new(hmm.m, &abc);
23//! profile_config(hmm, &bg, &mut gm, 400, P7_LOCAL);
24//! let mut om = OProfile::convert(&gm);
25//!
26//! // Create pipeline and hits collector
27//! let mut pli = Pipeline::new();
28//! pli.new_model(&gm);
29//! let mut th = TopHits::new();
30//!
31//! // Search a sequence programmatically
32//! let dsq = abc.digitize(b"ACDEFGHIKLMNPQRSTVWY");
33//! let sq = Sequence { name: "query".into(), acc: String::new(), desc: String::new(), dsq, n: 20, l: 20 };
34//! pli.run(&mut gm, &mut om, &bg, hmm, &sq, &mut th);
35//!
36//! // Access results
37//! th.sort_by_sortkey();
38//! for hit in &th.hits {
39//!     println!("{}: score={:.1} bits", hit.name, hit.score);
40//! }
41//! ```
42
43// FFI bindings use non-Rust naming conventions
44#![allow(non_upper_case_globals)]
45#![allow(non_camel_case_types)]
46#![allow(non_snake_case)]
47
48pub mod alphabet;
49pub mod bg;
50pub mod builder;
51pub mod calibrate;
52pub mod domaindef;
53pub mod dp;
54pub mod dsqdata;
55pub mod errors;
56pub mod eweight;
57pub mod fm_index;
58pub mod hmm;
59pub mod hmmfile;
60pub mod hmmfile_binary;
61pub mod logsum;
62pub mod msa;
63pub mod output;
64pub mod pipeline;
65pub mod pressed;
66pub mod prior;
67pub mod profile;
68pub mod seqmodel;
69pub mod sequence;
70pub mod simd;
71pub mod spensemble;
72pub mod ssi;
73pub mod stats;
74pub mod tophits;
75pub mod trace;
76pub mod util;
77
78// Re-export key types at crate root for convenience
79pub use alphabet::Alphabet;
80pub use bg::Bg;
81pub use hmm::Hmm;
82pub use pipeline::Pipeline;
83pub use profile::Profile;
84pub use sequence::Sequence;
85pub use simd::oprofile::OProfile;
86pub use tophits::TopHits;