Skip to content

Commit e7f05b7

Browse files
Merge branch 'master' of https://github.com/rust-bio/rust-htslib
2 parents 45a1228 + e91a766 commit e7f05b7

30 files changed

+784
-283
lines changed

.cargo/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.x86_64-unknown-linux-musl]
2+
linker = "x86_64-linux-musl-gcc"

.github/workflows/rust.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
Formatting:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Install stable toolchain
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
components: rustfmt
22+
23+
- name: Check format
24+
run: cargo fmt -- --check
25+
26+
Linting:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v2
31+
32+
- name: Checkout submodules
33+
uses: textbook/git-checkout-submodule-action@2.0.0
34+
35+
- name: Install stable toolchain
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: stable
39+
override: true
40+
components: clippy
41+
42+
- name: Lint with clippy
43+
uses: actions-rs/clippy-check@v1
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
48+
Testing:
49+
needs: Formatting
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v2
54+
55+
- name: Checkout submodules
56+
uses: textbook/git-checkout-submodule-action@2.0.0
57+
58+
- name: Install stable toolchain
59+
uses: actions-rs/toolchain@v1
60+
with:
61+
toolchain: stable
62+
override: true
63+
64+
- name: Install system dependencies
65+
run: |
66+
sudo apt-get install --yes zlib1g-dev libbz2-dev musl musl-dev musl-tools clang libc6-dev
67+
68+
- name: Run cargo-tarpaulin
69+
uses: actions-rs/tarpaulin@v0.1
70+
with:
71+
args: '--out Lcov -- --test-threads 1'
72+
73+
- name: Upload coverage
74+
uses: coverallsapp/github-action@master
75+
with:
76+
github-token: ${{ secrets.GITHUB_TOKEN }}
77+
path-to-lcov: ./lcov.info
78+
79+
- name: Test musl build without default features
80+
env:
81+
CFLAGS: -I/usr/local/musl/include
82+
uses: actions-rs/cargo@v1
83+
with:
84+
use-cross: true
85+
command: build
86+
args: --target x86_64-unknown-linux-musl --no-default-features
87+
88+
- name: Test musl build with all features
89+
env:
90+
CFLAGS: -I/usr/local/musl/include
91+
uses: actions-rs/cargo@v1
92+
with:
93+
use-cross: true
94+
command: build
95+
args: --target x86_64-unknown-linux-musl --all-features
96+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vscode/
2+
.idea
23
*~
34
target
45
Cargo.lock

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "htslib"]
22
path = hts-sys/htslib
3-
url = https://github.com/rust-bio/htslib.git
3+
url = https://github.com/samtools/htslib.git

.travis.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,43 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [0.27.0] - (TBD)
5+
## [0.30.0] - 2020-04-03
6+
### Changes
7+
- Removed `fn header_mut()` from `bam::Read` trait.
8+
- Fixed a major performance regression when reading bam files (issue #195).
9+
10+
## [0.29.0] - 2020-03-26
11+
### Changes
12+
- Migrate buffer intervals to u64.
13+
14+
## [0.28.0] - 2020-03-26
15+
### Changes
16+
- Return u64 wherever htslib has migrated to using 64 bit.
17+
- Implement more bio-types (Interval, Locus, Strand).
18+
19+
## [0.27.0] - 2020-03-17
20+
### Changes
21+
- Updated to Htslib 1.10.2.
622
- bam::Record.set() will panic if seq.len() != qual.len(). Previously, mismatched length would cause
723
uninitialized memory to be written into the BAM file.
824
- use `serde_bytes` to serialize .data section of bam::Record when using serde - large speed improvement.
925
- change build.rs to avoid re-running when htslib or wrapper.h haven't changed.
1026
- update some dependencies.
1127
- refactor native dependency into htslib-sys crate, for greater versioning flexibility
28+
- Record::from_sam require `&mut HeaderView`. Provide the appropriate accessor.
29+
- set() no longer invalidates tag data.
30+
- Various minor improvements.
1231

1332
## [0.26.1] - 2019-12-03
14-
## Changes
33+
### Changes
1534
- Various bug fixes in CIGAR string handling, INFO tag reading and FORMAT tag reading.
1635

1736
## [0.26.0] - 2019-09-27
18-
## Changes
37+
### Changes
1938
- Allow caching of CIGAR in bam::RecordBuffer.
2039

2140
## [0.25.0] - 2019-09-27
22-
## Changes
41+
### Changes
2342
- Migrated error handling to the snafu crate: https://docs.rs/snafu.
2443
- Cleaned up and simplified API (including breaking changes).
2544
- Allow writing SAM files from the bam::Writer.

Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rust-htslib"
3-
version = "0.26.2-alpha.0"
3+
version = "0.30.1-alpha.0"
44
authors = ["Christopher Schröder <christopher.schroeder@tu-dortmund.de>", "Johannes Köster <johannes.koester@tu-dortmund.de>"]
55
description = "This library provides HTSlib bindings and a high level Rust API for reading and writing BAM files."
66
readme = "README.md"
@@ -17,7 +17,7 @@ tag-message = "Version {{version}} of Rust-HTSlib."
1717

1818
[dependencies]
1919
libc = "0.2"
20-
itertools = "0.8"
20+
itertools = "0.9.0"
2121
newtype_derive = "0.1"
2222
custom_derive = "0.1"
2323
url = "2.1"
@@ -28,15 +28,18 @@ regex = "1.3"
2828
linear-map = "1.2"
2929
serde_base = { version = "^1", optional = true, package = "serde" }
3030
serde_bytes = { version = "0.11", optional = true }
31-
bio-types = ">=0.5.1"
32-
snafu = ">= 0.5.0, <= 0.6.0"
33-
hts-sys = { version = "^1.9", path = "hts-sys", default-features = false }
31+
bio-types = ">=0.6"
32+
snafu = "0.6.8"
33+
hts-sys = { version = "^1.10", path = "hts-sys", default-features = false }
3434

3535
[features]
36-
default = ["bzip2", "lzma"]
36+
default = ["bzip2", "lzma", "curl"]
3737
bzip2 = ["hts-sys/bzip2"]
3838
lzma = ["hts-sys/lzma"]
39+
curl = ["hts-sys/curl"]
40+
#openssl = ["hts-sys/openssl"]
3941
serde = ["serde_base", "serde_bytes"]
42+
static = []
4043

4144
[dev-dependencies]
4245
tempdir = "0.3"

Cross.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[build.env]
2+
passthrough = [
3+
"RUST_DEBUG",
4+
"RUST_BACKTRACE",
5+
"CFLAGS"
6+
]
7+
8+
9+
[target.x86_64-unknown-linux-musl]
10+
image = "brainstorm/cross-x86_64-unknown-linux-musl:latest"
11+
[target.x86_64-unknown-linux-gnu]
12+
image = "brainstorm/cross-x86_64-unknown-linux-gnu:libcurl-openssl"

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,49 @@
22
[![Crates.io](https://img.shields.io/crates/v/rust-htslib.svg)](https://crates.io/crates/rust-htslib)
33
[![Crates.io](https://img.shields.io/crates/l/rust-htslib.svg)](https://crates.io/crates/rust-htslib)
44
[![docs.rs](https://docs.rs/rust-htslib/badge.svg)](https://docs.rs/rust-htslib)
5-
[![Travis](https://img.shields.io/travis/rust-bio/rust-htslib.svg)](https://travis-ci.org/rust-bio/rust-htslib)
5+
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rust-bio/rust-htslib/CI/master?label=tests)
66

77
# HTSlib bindings for Rust
88

99
This library provides HTSlib bindings and a high level Rust API for reading and writing BAM files.
1010

1111
To clone this repository, issue
1212

13-
```
14-
git clone --recursive https://github.com/rust-bio/rust-htslib.git
13+
```shell
14+
$ git clone --recursive https://github.com/rust-bio/rust-htslib.git
1515
```
1616

1717
ensuring that the HTSlib submodule is fetched, too.
1818
If you only want to use the library, there is no need to clone the repository. Go on to the **Usage** section in this case.
1919

2020
## Requirements
2121

22-
To compile this crate you need the development headers of zlib, bzip2 and xz.
22+
To compile this crate you need docker and cross:
23+
24+
```shell
25+
$ cargo install cross
26+
$ cross build # will build with GNU toolchain
27+
```
28+
29+
If you want to run rust-htslib code on AWS lambda, you'll need to statically compile it with MUSL as follows:
30+
31+
```shell
32+
$ export CFLAGS="-I/usr/local/musl/include"
33+
$ cross build --target x86_64-unknown-linux-musl # will build with MUSL toolchain
34+
```
35+
36+
Alternatively, you can also install it locally by installing the development headers of zlib, bzip2 and xz. For instance, in Debian systems one needs the following dependencies:
37+
38+
```shell
39+
$ sudo apt-get install zlib1g-dev libbz2-dev liblzma-dev clang pkg-config
40+
```
41+
42+
On OSX:
43+
44+
```shell
45+
$ brew install FiloSottile/musl-cross/musl-cross
46+
$ brew install bzip2 zlib xz curl-openssl
47+
```
2348

2449
## Usage
2550

@@ -46,6 +71,10 @@ rust-htslib = { version = "*", features = ["serde"] }
4671

4772
For more information, please see the [docs](https://docs.rs/rust-htslib).
4873

74+
# Alternatives
75+
76+
There's [noodles](https://github.com/zaeleus/noodles) by [Michael Macias](https://github.com/zaeleus) which implements a large part of htslib's C functionality in pure Rust (still experimental though).
77+
4978
# Authors
5079

5180
* [Johannes Köster](https://github.com/johanneskoester)

docker/Dockerfile.gnu

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM rustembedded/cross:x86_64-unknown-linux-gnu
2+
3+
#ENV LIBCLANG_PATH /usr/lib/x86_64-linux-musl
4+
ENV LIBCLANG_PATH /usr/lib/llvm-10/lib
5+
ENV LLVM_CONFIG_PATH /usr/bin
6+
RUN apt-get update
7+
RUN apt-get install -y wget gnupg lsb-release software-properties-common apt-transport-https ca-certificates # Otherwise LLVM bump below fails
8+
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
9+
RUN apt-get install -y libssl-dev libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev # htslib deps

0 commit comments

Comments
 (0)