Skip to content

Commit

Permalink
Merge pull request #131 from blachlylab/develop
Browse files Browse the repository at this point in the history
Release v0.14.0+htslib-1.13
  • Loading branch information
charlesgregory committed Mar 2, 2022
2 parents 0f284df + 1176725 commit 2529b13
Show file tree
Hide file tree
Showing 134 changed files with 8,764 additions and 4,778 deletions.
141 changes: 139 additions & 2 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: unittests
on: [push, pull_request]

jobs:
linux-unittests:
name: Dub Tests
linux-unittests-ldc:
name: Dub Tests LDC
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -73,3 +73,140 @@ jobs:

- name: Upload coverage
run: bash <(curl -s https://codecov.io/bash)

linux-unittests-dmd:
name: Dub Tests DMD
strategy:
matrix:
os: [ubuntu-latest]
dc: [dmd-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

- name: Install htslib deps
run: |
sudo apt-get update && sudo apt-get install -y build-essential autoconf zlib1g-dev libbz2-dev liblzma-dev libcurl4-openssl-dev libssl-dev
- name: Get htslib commit
id: get-htslib-commit
run: echo "::set-output name=sha_short::$(git rev-parse --short :htslib)"

- name: Cache htslib
id: cache-htslib
uses: actions/cache@v2
with:
path: htslib
key: ${{ runner.os}}-htslib-${{ steps.get-htslib-commit.outputs.sha_short }}

- name: Build htslib
if: steps.cache-htslib.outputs.cache-hit != 'true'
run: |
cd htslib
autoreconf -i
./configure
make
- name: Install htslib
run: |
cd htslib
sudo make install
sudo ldconfig
- name: Setup additional test files
run: |
cd htslib
cd test
cd tabix
bgzip -c gff_file.gff > gff_file.gff.gz
tabix gff_file.gff.gz
bgzip -c bed_file.bed > bed_file.bed.gz
tabix bed_file.bed.gz
bgzip -c vcf_file.vcf > vcf_file.vcf.gz
tabix vcf_file.vcf.gz
- name: Run tests
run: dub -q test -b=unittest-cov
env:
LIBRARY_PATH: /usr/local/lib

- name: Run safety tests
run: dub -q test -c=unittest-safety
env:
LIBRARY_PATH: /usr/local/lib

macos-unittests-dmd:
name: Dub Tests DMD
strategy:
matrix:
os: [macos-latest]
dc: [dmd-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

- name: Install htslib deps
run: |
brew install xz autoconf automake
- name: Get htslib commit
id: get-htslib-commit
run: echo "::set-output name=sha_short::$(git rev-parse --short :htslib)"

- name: Cache htslib
id: cache-htslib
uses: actions/cache@v2
with:
path: htslib
key: ${{ runner.os}}-htslib-${{ steps.get-htslib-commit.outputs.sha_short }}

- name: Build htslib
if: steps.cache-htslib.outputs.cache-hit != 'true'
run: |
cd htslib
autoreconf -i
./configure
make
- name: Install htslib
run: |
cd htslib
sudo make install
- name: Setup additional test files
run: |
cd htslib
cd test
cd tabix
bgzip -c gff_file.gff > gff_file.gff.gz
tabix gff_file.gff.gz
bgzip -c bed_file.bed > bed_file.bed.gz
tabix bed_file.bed.gz
bgzip -c vcf_file.vcf > vcf_file.vcf.gz
tabix vcf_file.vcf.gz
- name: Run tests
run: dub -q test -b=unittest-cov
env:
LIBRARY_PATH: /usr/local/lib

- name: Run safety tests
run: dub -q test -c=unittest-safety
env:
LIBRARY_PATH: /usr/local/lib
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ bug_minimal
sam_iter
csam_iter
dhtslib-test-unittest
coordinates/coordinates-test-unittest
dhtslib-test-unittest-safety
chunkby
cigartest

# DUB
.dub
docs.json
__dummy.html
docs/
dub.selections.json

# Code coverage
*.lst
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
![alt text](/logo/dhtslib_logo.png "dhtslib")

dhtslib
=======

[![unittests](https://github.com/blachlylab/dhtslib/actions/workflows/unittests.yml/badge.svg)](https://github.com/blachlylab/dhtslib/actions/workflows/unittests.yml)
[![codecov.io](https://codecov.io/github/blachlylab/dhtslib/coverage.svg?branch=develop)](https://codecov.io/github/blachlylab/dhtslib?branch=develop)

# Overview

`dhtslib` provides D bindings, high-level abstractions, and additional functionality for [htslib](https://github.com/samtools/htslib), the most widely-used library for manipulation of high-throughput sequencing data. We currently support linux and OSX. Windows support is still in progress (see #38). More extensive documentation can be found at our [gitbook](https://blachlylab.gitbook.io/dhtslib/).

# Installation
## Installation

Add `dhtslib` as a dependency to `dub.json`:

```
"dependencies": {
"dhtslib": "~>0.12.3+htslib-1.10",
"dhtslib": "~>0.13.3+htslib-1.13",
}
```
(version number 0.12.3 is example, `+htslib-1.10` represents the compatible htslib version; see https://dub.pm/package-format-json)
(version number 0.13.3 is example, `+htslib-1.13` represents the compatible htslib version; see https://dub.pm/package-format-json)

# Requirements
## Requirements

## htslib
A system installation of htslib >= v1.10 is required. You can find detailed install instructions [here](htslib.md).
### htslib
A system installation of htslib >= v1.13 is required. You can find detailed install instructions [here](htslib.md).

# Usage
## Usage
`dhtslib` usage information and examples can be found [here](usage.md).

## Dhtslib API (OOP Wrappers)
### Dhtslib API (OOP Wrappers)

Object-oriented, idomatic D wrappers are available for:

Expand All @@ -47,7 +48,7 @@ Additional functionality is provided for:
All htslib bindings can be found under the `htslib` namespace (in prior versions they were under `dhtlsib.htslib`). These can be used directly as you would with `htslib`.


## htslib API
### htslib API

Direct bindings to htslib C API are available as submodules under the `htslib` namespace. Naming remains the same as the original `.h` include files. For example, `import htslib.faidx` for direct access to the C function calls. Where the OOP wrappers manage their own data along the the D garbage collector, these functions use traditional C memory management (or lack thereof). The current compatible htslib versions are 1.10+.

Expand Down Expand Up @@ -82,7 +83,7 @@ Missing or work-in-progress:

[dstep](https://github.com/jacob-carlborg/dstep) has matured and is an incredibly powerful tool for machine-assisted C-to-D translation. We've used dstep for the majority of bindings in the since version v0.11.0. After dstep translation, we port inline functions by hand as they are not translated, tweak some macros into templates (done although dstep already does an amazing job on simple `#define` macros translating to D templates!), and update the documentation comments to ddoc format.

# FAQ
## FAQ

**Q**: Does this work with the latest htslib?

Expand All @@ -106,16 +107,16 @@ However, the development resources poured into `htslib` overall are tremendous,
It's easy to get a segfault by using the direct C API incorrectly. Or possibly correctly. We have tried to eliminate most of this (use after free, etc.) in the OOP wrappers via refernece counting. If you are getting a segfault you cannot understand when using purely the high-level D API, please post an issue.


# Bugs and Warnings
## Bugs and Warnings

Do not call `hts_log_*` with `ctx` as anything other than a string literal from a destructor, as it is potentialy allocating via `toStringz`


# Programs made with dhtslib
## Programs made with dhtslib
1. [fade](https://github.com/blachlylab/fade): Fragmentase Artifact Detection and Elimination
2. [recontig](https://github.com/blachlylab/recontig): a program to convert different bioinformatics data types from one reference naming convention to another i.e UCSC to ensembl (chr1 to 1)

# Related projects
## Related projects

1. [gff3d](https://github.com/blachlylab/gff3d): GFF3 record reader/writer
2. [dklib](https://github.com/blachlylab/dklib): Templatized port of attractivechaos' klib, used extensively in htslib
2. [dklib](https://github.com/blachlylab/dklib): Templatized port of attractivechaos' klib, used extensively in htslib
Loading

0 comments on commit 2529b13

Please sign in to comment.