9 unstable releases (3 breaking)

0.4.21 Feb 12, 2025
0.4.2 Feb 12, 2025
0.3.1 Feb 10, 2025
0.2.1 May 10, 2024
0.1.0 May 3, 2024

#691 in Parser implementations

Download history 10/week @ 2024-12-04 19/week @ 2024-12-11 250/week @ 2025-02-05 543/week @ 2025-02-12 3/week @ 2025-02-19 20/week @ 2025-02-26

816 downloads per month

MIT license

105KB
2K SLoC

hmm_tblout

Simple parsing of tabular output from HMMER::nhmmer --tblout ..., and also Infernal cmscan/cmsearch.

Example

Run this example using cargo run --example print_coordinates ./data/test.tbl.

use hmm_tblout;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // get the command line args, only parse the
    // first one which should be a fasta file
    let args: Vec<String> = std::env::args().collect();
    if args.len() < 2 {
        println!("Usage: print_coordinates <tblout_file>");
        std::process::exit(1);
    }

    let reader = hmm_tblout::Reader::from_path(args[1].clone())?;

    for record in reader.into_records() {
        let r = record?;
        let tname = r.target_name();
        let strand = r.strand().unwrap();
        let alifrom = r.ali_from().unwrap();
        let alito = r.ali_to().unwrap();

        println!("{}\t{}\t{}\t{}", tname, strand, alifrom, alito);
    }

    Ok(())
}

lib.rs:

The hmm_tblout crate is purely for parsing the output of certain HMMER3 programs. The output is generated by passing the --tblout flag to the HMMER3 program.

Example

use hmm_tblout;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// get the command line args, only parse the
// first one which should be a fasta file
let args: Vec<String> = std::env::args().collect();
if args.len() < 2 {
println!("Usage: print_coordinates <tblout_file>");
std::process::exit(1);
}

let reader = hmm_tblout::Reader::from_path(args[1].clone())?;

for record in reader.into_records() {
let r = record?;
let tname = r.target_name();
let strand = r.strand().unwrap();
let alifrom = r.ali_from().unwrap();
let alito = r.ali_to().unwrap();

println!("{}\t{}\t{}\t{}", tname, strand, alifrom, alito);
}

Ok(())
}

No runtime deps