[−][src]Crate uniprot
Rust data structures and parser for the UniprotKB database(s).
🔌 Usage
The uniprot::parse
function can be used to obtain an iterator over the entries
of a UniprotKB database in XML format (either SwissProt or TrEMBL). It
will use the uniprot::Parser
, which is either SequentialParser
or ThreadedParser
depending on the compilation features.
extern crate uniprot; let f = std::fs::File::open("tests/uniprot.xml") .map(std::io::BufReader::new) .unwrap(); for r in uniprot::parse(f) { let entry = r.unwrap(); // ... process the Uniprot entry ... }
uniprot::parse
takes any BufRead
implementor as an input. Additionaly,
if compiling with the threading
feature, it will require the input to
be Send
and 'static
as well.
📦 Decoding Gzip
If parsing a Gzipped file, you can use flate2::read::GzDecoder
or
libflate::gzip::Decoder
to decode the input stream, and then simply
wrap it in a BufferedReader
. Note that flate2
has slightly better
performance, but binds to C,, while libflate
is a pure Rust
implementation.
📧 Downloading from FTP
Uniprot is available from the two following locations: ftp.ebi.ac.uk
and ftp.uniprot.org
, the former being located in Europe while the
latter is in the United States. The ftp
crate can be used to open
a connection and parse the databases on-the-fly: see the
uniprot::parse
example to see a code snippet.
📧 Downloading from HTTP
If FTP is not available, note that the EBI FTP server can also be reached
using HTTP at http://ftp.ebi.ac.uk
. This allows using HTTP libraries
instead of FTP ones to reach the release files.
📝 Features
threading
enabled by default.
The threading
feature compiles the parser module in multi-threaded mode.
This feature greatly improves parsing speed and efficiency, but removes
any guarantee about the order the entries are yielded in.
📋 Changelog
This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.
📜 License
This library is provided under the open-source MIT license.
Modules
error | Ubiquitous types for error management. |
model | Object model of the UniprotKB XML database. |
parser | UniprotKB XML parser implementation. |
Functions
parse | Parse a Uniprot database XML file. |
Type Definitions
Parser | The parser type for the crate, used by |