Crates.io | hmmer-rs |
lib.rs | hmmer-rs |
version | 0.2.0 |
source | src |
created_at | 2023-01-27 11:01:37.35577 |
updated_at | 2023-02-03 21:55:59.557797 |
description | Ergonomic Rust interface to HMMER |
homepage | https://github.com/wwood/hmmer-rs |
repository | https://github.com/wwood/hmmer-rs |
max_upload_size | |
id | 769558 |
size | 257,299 |
Rust interface to the HMMER C code. This library provides a Rust interface which builds upon the bindings generated by libhmmer-sys and is intended to provide a more idiomatic Rust interface.
It is quite new and not all of the functionality of HMMER is exposed yet. If you need something that is not exposed, please open an issue or a pull request, or better yet have a go at implementing it yourself.
As this is still early days, the API is likely to change. If you are using this library, please pin your dependency to a specific version.
Example usage, running a HMMSEARCH:
let hmms = Hmm::read_hmms_from_path(std::path::Path::new(
"tests/data/DNGNGWU00010_mingle_output_good_seqs.hmm",
))
.unwrap();
let hmm = &hmms[0];
println!("HMM name: {}", hmm.name());
let mut hmmsearch = HmmerPipeline::new(hmm);
let mut query_seq = EaselSequence::new(Alphabet::Protein);
let seq: &[u8] =
b"MVYSGPNAPIEVGNSLPLSEIPLATEIHNIELTPGKGGQLVRSAGSSAQLLAKEGNYVTLRLPSGEMRFVRKECYATIGQ";
query_seq.replace_sequence(seq).unwrap();
debug!("Query seq replaced;");
hmmsearch.query(&query_seq);
let hmmsearch_result = hmmsearch.get_results();
println!(
"Total number of reported hits: {}",
hmmsearch_result.nreported()
);
for hit in hmmsearch_result.hits() {
println!("New hit:");
println!("Hit name: {}", hit.name());
println!("Hit score: {}", hit.score());
for domain in hit {
println!("New domain:");
println!("Domain score: {}", domain.bitscore());
println!("Domain evalue: {:?}", domain.evalue());
}
}
Output of this program:
HMM name: S2.1.ribosomal_protein_L2_rplB
Total number of reported hits: 1
New hit:
Hit name:
Hit score: 150.01991
current domain counter 0
New domain:
Domain score: 149.90887
Domain evalue: 1.4970530541655288e-48