#io #sequence #gb

gb-io

A library for parsing, writing and manipulating Genbank sequence files

5 releases (breaking)

✓ Uses Rust 2018 edition

new 0.5.0 Apr 21, 2019
0.4.0 Apr 8, 2019
0.3.0 Mar 10, 2019
0.2.0 Mar 9, 2019
0.1.0 Mar 1, 2019

36 downloads per month

MIT license

119KB
3K SLoC

gb-io

docs.rs link

This is a library for working with Genbank (.gb) files written in Rust. It supports reading, writing, and extracting parts of a sequence while retaining feature annotations.

The main aim of this project was to learn Rust, and it is not yet complete, however in its current state it should be able to handle most files. Feedback, improvements, and details of any .gb files it chokes on are welcome!

Example

Reverse complement a sequence, retaining feature annotations.

extern crate gb_io;

use std::fs::File;
use std::io;

use gb_io::reader::SeqReader;

fn main() {
    let file = File::open("mg1655.gb").unwrap();
    let stdout = io::stdout();
    for seq in SeqReader::new(file) {
        let seq = seq.unwrap();
        let rc = seq.revcomp();
        rc.write(stdout.lock()).unwrap();
    }
}

lib.rs:

This is a crate for working with annotated biological sequences stored in "Genbank" format. It focuses on parsing and writing Genbank files and provides some methods for extracting regions from a sequence, preserving annotations and respecting circular molecules.

Dependencies

~9MB
~153K SLoC