Commit e4f91173 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 0.2.1

parent 7c34c122
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
language: d
script:
- rdmd -unittest -d test/unittests.d

os:
  - linux
  - osx

d:
  - dmd
  - ldc
+63 −13
Original line number Diff line number Diff line
### BioD
# BioD [![Build Status](https://travis-ci.org/biod/BioD.svg?branch=master)](https://travis-ci.org/biod/BioD) [![DUB Package](https://img.shields.io/badge/dub-v0.1.0-red.svg)](https://code.dlang.org/packages/biod)

[BioD](https://github.com/biod/BioD) is a fast and memory efficient bioinformatics library written in the [D programming language](http://dlang.org).

BioD aims to:

* Provide a platform for writing high-performance bioinformatics applications in D. BioD achieves this by:
     - automatic parallelization of tasks where possible for example reading and writing BAM files.
  - automatic parallelization of tasks where possible for example reading and writing BAM files
  - reducing the GC overhead by avoiding unnecessary memory allocations
* Offer support for manipulating common biological data formats.
* Write clear documented and maintainable codebase.
* Offer support for manipulating common biological data formats

## Why D?

### Usage
See the [examples directory](https://github.com/biod/BioD/tree/master/examples) for examples and usage.
D is a language that suits parallel programming because of guarantees
the compiler provides. D is both a low-level language and a high-level
hybrid OOP/FP language. There is no other programming language that
matches those features. Also, D templating/generics is far easier that
that of C++ or, say, Scala.

That is not to say that D is an easy language. A powerful toolbox will
be complicated. If you want to do everything with a hammer, maybe
better choose Java instead ;).

#### BioD core
* [Artem Tarasov](https://github.com/lomereiter)
* [Pjotr Prins](https://github.com/pjotrp)
For more information about D find Andrei Alexandrecu's D book. It is a
classic. Ali Çehreli's book also is recommended.

## Current development

Our current focus is to provide a bamreader and bamwriter that is
really fast and easy to use. We believe the BAM format is here to stay
for the foreseeable future in pipelines. With D we have an good way to
write performance parsers, particularly with three typical scenarios:

1. Go through a BAM file a read at a time
2. Go through a BAM file a nucleotide at a time (pileup)
3. Go through a BAM file with a sliding window

The sliding window is a derivation of the first - a read at a time or
a nucleotide at a time.

At this point this functionality is mostly in BioD, but not in an
intuitive way. We are building up this functionality and will give
examples (WIP).

# Install

The current default is to provide the path to the checked out repo to the D-compiler. For example
in sambamba we use

    DFLAGS = -wi -I. -IBioD -g

# Usage

See the [examples directory](https://github.com/biod/BioD/tree/master/examples)
for examples and usage.

BioD is also a crucial part of the [sambamba](https://github.com/biod/sambamba) tool.

# Contributing

Simply clone the repository on github and put in a pull request.

# BioD contributors and support

See
[contributors](https://github.com/biod/BioD/graphs/contributors). For
support use the [issue tracker](https://github.com/biod/BioD/issues) or contact

* [Pjotr Prins](https://github.com/pjotrp)
* [Artem Tarasov](https://github.com/lomereiter)
* [George Githinji](https://github.com/George-Githinji)

##### License
This library is licensed under the MIT license. Please see the license file for more details
# License

##### Citation
BioD is licensed under the liberal MIT (expat) [license](./LICENSE).

RELEASE-NOTES.md

0 → 100644
+23 −0
Original line number Diff line number Diff line
## ChangeLog v0.2.1 (20181004)

+ Fix bunch of deprecation warnings
+ Fixes sort removing tags from @RG header https://github.com/biod/sambamba/issues/356
+ Fixes https://github.com/biod/BioD/issues/37

## ChangeLog v0.2.0 (20180915)

64-bit compilation should be fine on ldc 1.10

+ Added FastQ parser (thanks George Githinji @george-githinji)
+ Added rewritten Bamreader f4a6c1c55c8903e948b793adbb150704d1e267b2 (thanks Pjotr Prins @pjotrp)
+ Improved big-endian support and other bug fixes (thanks Artem Tarasov @lomereiter)
+ Include SAM/BAM AH tag (thanks Indraniel Das @indraniel)
+ D undeaD compilation fixes (thanks John Colvin @John-Colvin)
+ Meson build definition added (thanks Matthias Klumpp @ximion)
+ Update outputstream.d (thanks Brett T. Hannigan @godotgildor)
+ Moved Cigar into its own module 7994406592f277bc6950739aaf75c5f948cb7928
+ Added 'asserte' method which throws an exception on assert (failure)
+ Bug fixes:
  * #31 Bug in bio/core/utils/outbuffer.d: _heap.length is not correctly set affects reading long SAM records
  * https://github.com/biod/sambamba/issues/210 correct pseudo-bin calculation (thanks @jfarek)
  * JSON header output fixes #331

VERSION

0 → 100644
+1 −0
Original line number Diff line number Diff line
0.2.1
+12 −10
Original line number Diff line number Diff line
/*
    This file is part of BioD.
    Copyright (C) 2012-2013    Artem Tarasov <lomereiter@gmail.com>
    Copyright (C) 2012-2017    Artem Tarasov <lomereiter@gmail.com>

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
@@ -30,12 +30,12 @@ import bio.bam.constants;
import bio.bam.bai.bin;
import bio.core.bgzf.chunk;

import std.stream;
import undead.stream;
import std.array;
import std.algorithm;
import std.system;
import std.exception;
import std.c.string;
import core.stdc.string;

// Suppose we have an alignment which covers bases on a reference,
// starting from one position and ending at another position.
@@ -117,7 +117,8 @@ struct IndexBuilder {
        void updateMetadata(ref BamReadBlock read) {
            if (read.ref_id == -1) {
                ++_no_coord;
            } else if (read.is_unmapped) {
            } else {
                if (read.is_unmapped) {
                    ++_unmapped;
                } else {
                    ++_mapped;
@@ -127,6 +128,7 @@ struct IndexBuilder {
                    _beg_vo = cast(ulong)read.start_virtual_offset;
                _end_vo = cast(ulong)read.end_virtual_offset;
            }
        }

        void updateLinearIndex() {
            assert(_prev_read.ref_id >= 0);
Loading