Skip to content

Commit

Permalink
Merge pull request #21 from rust-bio/typed-constructors
Browse files Browse the repository at this point in the history
Use properly typed parameters for constructing readers and writers.
  • Loading branch information
johanneskoester authored Nov 10, 2016
2 parents 0f9fba9 + 2ab3ee7 commit c76da6b
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 120 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ rust:
- nightly
env:
global:
secure: ioWAhmR9VNa96Zn3UvY46bzys5LY6rHezT/nxsX6Wc0tZ3s/pk45wRKl9mU+oX+29EXMl2EXZZzsUlmY9AWNS34uQdBJ5HB68k2l2Cl44f/R4fQiFbkucCaCuTLDDshRsQInHTrsIjiB0tvjCG1tkNWQlgDIB4yeqPcL+YrmeMs=
- secure: ioWAhmR9VNa96Zn3UvY46bzys5LY6rHezT/nxsX6Wc0tZ3s/pk45wRKl9mU+oX+29EXMl2EXZZzsUlmY9AWNS34uQdBJ5HB68k2l2Cl44f/R4fQiFbkucCaCuTLDDshRsQInHTrsIjiB0tvjCG1tkNWQlgDIB4yeqPcL+YrmeMs=
- RUST_BACKTRACE=1
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.10.0] - 2016-11-10
### Added
- Prelude module to easily import all relevant traits.
### Changed
- fine-grained constructors for STDIN/STDOUT, paths and URLs
- better template handling with bam files


## [0.9.0] - 2016-11-02
### Changed
- improved genotype handling
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-htslib"
version = "0.9.0"
version = "0.10.0"
authors = ["Christopher Schröder <[email protected]>", "Johannes Köster <[email protected]>"]
build = "build.rs"
description = "This library provides HTSlib bindings and a high level Rust API for reading and writing BAM files."
Expand All @@ -17,6 +17,7 @@ itertools = "=0.4.*"
quick-error = "1.1.*"
newtype_derive = "0.1.*"
custom_derive = "0.1.*"
url = "1.2.*"
ieee754 = "0.1"
lazy_static = "0.1.*"

Expand Down
6 changes: 6 additions & 0 deletions src/bam/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// This file may not be copied, modified, or distributed
// except according to those terms.

use bam::HeaderView;


/// A BAM header.
pub struct Header {
Expand All @@ -16,6 +18,10 @@ impl Header {
Header { records: Vec::new() }
}

pub fn from_template(header: &HeaderView) -> Self {
Header { records: vec![header.as_bytes().to_owned()] }
}

/// Add a record to the header.
pub fn push_record(&mut self, record: &HeaderRecord) -> &mut Self {
self.records.push(record.to_bytes());
Expand Down
Loading

0 comments on commit c76da6b

Please sign in to comment.