Browse Source

Merge pull request #48 from george-githinji/master

Fixes for contrib/undead.
sambamba
Pjotr Prins 4 years ago
committed by GitHub
parent
commit
3c74763177
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Makefile
  2. 13
      README.md
  3. 2
      bio/core/bgzf/inputstream.d
  4. 2
      bio/core/bgzf/outputstream.d
  5. 4
      bio/core/utils/stream.d
  6. 2
      bio/core/utils/switchendianness.d
  7. 2
      bio/std/hts/bam/bai/indexing.d
  8. 2
      bio/std/hts/bam/baifile.d
  9. 2
      bio/std/hts/bam/reader.d
  10. 2
      bio/std/hts/bam/readrange.d
  11. 2
      bio/std/hts/bam/reference.d
  12. 2
      bio/std/hts/bam/referenceinfo.d
  13. 4
      bio/std/hts/bam/writer.d
  14. 2
      bio/std/sff/reader.d
  15. 2
      bio/std/sff/readrange.d
  16. 2
      bio/std/sff/writer.d
  17. 4
      contrib/undead/doformat.d
  18. 2
      contrib/undead/internal/file.d
  19. 18
      contrib/undead/stream.d
  20. 2
      contrib/undead/utf.d
  21. 13
      dub.json
  22. 2
      examples/create_bam_from_scratch.d

4
Makefile

@ -1,7 +1,7 @@
# Simple Makefile
D_COMPILER=ldc2
DFLAGS = -wi -g -relocation-model=pic -unittest -main -Icontrib/undead/src
DFLAGS = -wi -g -relocation-model=pic -unittest -main -Icontrib/undead
ifndef GUIX
ifdef GUIX_ENVIRONMENT
@ -15,7 +15,7 @@ endif
DLIBS = $(LIBRARY_PATH)/libphobos2-ldc.a $(LIBRARY_PATH)/libdruntime-ldc.a
DLIBS_DEBUG = $(LIBRARY_PATH)/libphobos2-ldc-debug.a $(LIBRARY_PATH)/libdruntime-ldc-debug.a
SRC = $(wildcard contrib/undead/src/undead/*.d) contrib/undead/src/undead/internal/file.d $(wildcard bio/std/*.d) $(wildcard bio/std/*/*.d) bio/std/experimental/hts/bgzf.d bio/core/bgzf/constants.d bio/core/utils/stream.d bio/core/utils/switchendianness.d
SRC = $(wildcard contrib/undead/src/undead/*.d) contrib/undead/internal/file.d $(wildcard bio/std/*.d) $(wildcard bio/std/*/*.d) bio/std/experimental/hts/bgzf.d bio/core/bgzf/constants.d bio/core/utils/stream.d bio/core/utils/switchendianness.d
OBJ = $(SRC:.d=.o)
BIN = bin/biod_tests

13
README.md

@ -9,8 +9,8 @@ whose aim is to:
## Why BioD?
BioD makes use of [D programming language](http://www.dlang.org) features that make it possible to develop high
performance bioinformatics tools (e.g. [sambamba](https://github.com/biod/sambamba)). D is both a low and high-level
BioD leverages on [D programming language](http://www.dlang.org) features to develop high
performance bioinformatics tools (e.g. [sambamba](https://github.com/biod/sambamba)). The D programming language is both a low and high-level
hybrid object orientated and functional (OOP/FP) programming language with templating/generic features are far easier
than that of C++.
@ -20,9 +20,9 @@ than that of C++.
* [The D Cookbook](https://www.amazon.com/D-Cookbook-Adam-D-Ruppe/dp/1783287217) by Adam D. Ruppe
## Current development
Our aim is to provide several modules to work with biological datasets.
BioD provides modules for manipulating high throughput data formats by provifing fast and easy to use native BAM file reader and writer
with ability to Iterate a BAM file a read at a time,a nucleotide at a time (pileup) or via a sliding window.
Our aim is to provide a set of D modules to manipulate and work with biological datasets.
BioD provides modules for manipulating high throughput data formats by provifing fast and easy to use native BAM file reader and writer
with ability to iterate a BAM file a read at a time,a nucleotide at a time (pileup) or via a sliding window.
## Install
@ -56,7 +56,8 @@ With gdb, switch off the handlers
` handle SIGUSR1 SIGUSR2 nostop noprint`
It can be passed in from the command line
gdb -iex "handle SIGUSR1 SIGUSR2 no stop noprint" biod_test
`gdb -iex "handle SIGUSR1 SIGUSR2 no stop noprint" biod_test`
## Usage

2
bio/core/bgzf/inputstream.d

@ -30,7 +30,7 @@ import bio.core.bgzf.chunk;
import bio.std.hts.bam.constants;
import bio.core.utils.roundbuf;
import undead.stream;
import contrib.undead.stream;
import std.exception;
import std.conv;
import std.parallelism;

2
bio/core/bgzf/outputstream.d

@ -28,7 +28,7 @@ import bio.core.bgzf.compress;
import bio.core.utils.roundbuf;
import undead.stream;
import contrib.undead.stream;
import std.exception;
import std.parallelism;
import std.array;

4
bio/core/utils/stream.d

@ -1,6 +1,6 @@
module bio.core.utils.stream;
public import undead.stream;
public import contrib.undead.stream;
import core.stdc.stdio;
import core.stdc.errno;
import core.stdc.string;
@ -48,7 +48,7 @@ FileMode toFileMode(string mode) {
return result;
}
final class File: undead.stream.File {
final class File: contrib.undead.stream.File {
this(string filename, string mode="rb") {
version (Posix) {
// Issue 8528 workaround

2
bio/core/utils/switchendianness.d

@ -1,5 +1,5 @@
/**
(Almost) a copy-paste from undead.stream.d
(Almost) a copy-paste from contrib.undead.stream.d
*/
module bio.core.utils.switchendianness;

2
bio/std/hts/bam/bai/indexing.d

@ -30,7 +30,7 @@ import bio.std.hts.bam.constants;
import bio.std.hts.bam.bai.bin;
import bio.core.bgzf.chunk;
import undead.stream;
import contrib.undead.stream;
import std.array;
import std.algorithm;
import std.system;

2
bio/std/hts/bam/baifile.d

@ -29,7 +29,7 @@ import bio.core.bgzf.virtualoffset;
import bio.std.hts.bam.constants;
//TODO Remove stream dependency!
import undead.stream;
import contrib.undead.stream;
import std.system;
import std.exception;
import std.algorithm;

2
bio/std/hts/bam/reader.d

@ -96,7 +96,7 @@ class BamReader : IBamSamReader {
}
-------------------------------------------
*/
this(undead.stream.Stream stream,
this(contrib.undead.stream.Stream stream,
TaskPool task_pool = taskPool) {
_source_stream = new EndianStream(stream, Endian.littleEndian);
_task_pool = task_pool;

2
bio/std/hts/bam/readrange.d

@ -29,7 +29,7 @@ import bio.std.hts.bam.reader;
import bio.core.bgzf.inputstream;
import bio.core.bgzf.virtualoffset;
import undead.stream;
import contrib.undead.stream;
import std.algorithm;
import std.system;
import std.bitmanip;

2
bio/std/hts/bam/reference.d

@ -47,7 +47,7 @@ import bio.std.hts.bam.region;
import bio.std.hts.bam.randomaccessmanager;
import bio.core.bgzf.virtualoffset;
import undead.stream;
import contrib.undead.stream;
import std.exception;
import std.array;

2
bio/std/hts/bam/referenceinfo.d

@ -23,7 +23,7 @@
*/
module bio.std.hts.bam.referenceinfo;
import undead.stream;
import contrib.undead.stream;
import std.exception;
import std.array;

4
bio/std/hts/bam/writer.d

@ -35,7 +35,7 @@ import bio.core.utils.stream;
import std.parallelism;
import std.exception;
import undead.stream;
import contrib.undead.stream;
import std.traits;
import std.system;
import std.algorithm;
@ -73,7 +73,7 @@ final class BamWriter {
/// compression_level = compression level, must be in range -1..9
/// task_pool = task pool to use for parallel compression
/// buffer_size = size of BgzfOutputStream buffer
this(undead.stream.Stream stream,
this(contrib.undead.stream.Stream stream,
int compression_level=-1,
std.parallelism.TaskPool task_pool=std.parallelism.taskPool,
size_t buffer_size=0)

2
bio/std/sff/reader.d

@ -29,7 +29,7 @@ import bio.std.sff.readrange;
import bio.std.sff.constants;
import bio.core.utils.stream;
import undead.stream;
import contrib.undead.stream;
import std.system;
import std.range;
import std.exception;

2
bio/std/sff/readrange.d

@ -5,7 +5,7 @@ import bio.std.sff.index;
import bio.core.utils.switchendianness;
import std.algorithm;
import undead.stream;
import contrib.undead.stream;
import std.system;
import std.array;

2
bio/std/sff/writer.d

@ -4,7 +4,7 @@ import bio.std.sff.constants;
import bio.std.sff.utils.roundup;
import bio.core.utils.stream;
import undead.stream;
import contrib.undead.stream;
import std.system;
/// Class for outputting SFF files

4
contrib/undead/src/undead/doformat.d → contrib/undead/doformat.d

@ -10,7 +10,7 @@
Source: $(PHOBOSSRC std/_format.d)
*/
module undead.doformat;
module contrib.undead.doformat;
//debug=format; // uncomment to turn on debugging printf's
@ -1315,7 +1315,7 @@ unittest
void myPrint(...)
{
undead.doformat.doFormat(&putc, _arguments, _argptr);
contrib.undead.doformat.doFormat(&putc, _arguments, _argptr);
}
myPrint("The answer is %s:", 27, 6);

2
contrib/undead/src/undead/internal/file.d → contrib/undead/internal/file.d

@ -1,6 +1,6 @@
// Written in the D programming language
module undead.internal.file;
module contrib.undead.internal.file;
// Copied from std.file. undead doesn't have access to it, but some modules
// in undead used std.file.deleteme when they were in Phobos, so this gives

18
contrib/undead/src/undead/stream.d → contrib/undead/stream.d

@ -25,7 +25,7 @@
* the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*/
module undead.stream;
module contrib.undead.stream;
import std.internal.cstring;
@ -81,12 +81,12 @@ private {
//import std.format;
import std.system; // for Endian enumeration
import std.utf;
import undead.utf;
import contrib.undead.utf;
import core.bitop; // for bswap
import core.vararg;
static import std.file;
import undead.internal.file;
import undead.doformat;
import contrib.undead.internal.file;
import contrib.undead.doformat;
}
/// InputStream is the interface for readable streams.
@ -1214,7 +1214,7 @@ class Stream : InputStream, OutputStream {
private void doFormatCallback(dchar c) {
char[4] buf;
auto b = undead.utf.toUTF8(buf, c);
auto b = contrib.undead.utf.toUTF8(buf, c);
writeString(b);
}
@ -1433,7 +1433,7 @@ class Stream : InputStream, OutputStream {
unittest { // unit test for Issue 3363
import std.stdio;
immutable fileName = undead.internal.file.deleteme ~ "-issue3363.txt";
immutable fileName = contrib.undead.internal.file.deleteme ~ "-issue3363.txt";
auto w = std.stdio.File(fileName, "w");
scope (exit) std.file.remove(fileName);
w.write("one two three");
@ -2139,7 +2139,7 @@ class File: Stream {
unittest {
File file = new File;
int i = 666;
auto stream_file = undead.internal.file.deleteme ~ "-stream.$$$";
auto stream_file = contrib.undead.internal.file.deleteme ~ "-stream.$$$";
file.create(stream_file);
// should be ok to write
assert(file.writeable);
@ -2257,7 +2257,7 @@ class BufferedFile: BufferedStream {
unittest {
BufferedFile file = new BufferedFile;
int i = 666;
auto stream_file = undead.internal.file.deleteme ~ "-stream.$$$";
auto stream_file = contrib.undead.internal.file.deleteme ~ "-stream.$$$";
file.create(stream_file);
// should be ok to write
assert(file.writeable);
@ -2852,7 +2852,7 @@ class MmFileStream : TArrayStream!(MmFile) {
}
unittest {
auto test_file = undead.internal.file.deleteme ~ "-testing.txt";
auto test_file = contrib.undead.internal.file.deleteme ~ "-testing.txt";
MmFile mf = new MmFile(test_file,MmFile.Mode.readWriteNew,100,null);
MmFileStream m;
m = new MmFileStream (mf);

2
contrib/undead/src/undead/utf.d → contrib/undead/utf.d

@ -1,7 +1,7 @@
/**
* Contains the obsolete functions from Phobos' `std.utf`.
*/
module undead.utf;
module contrib.undead.utf;
import std.utf;
import std.typecons;

13
dub.json

@ -1,15 +1,16 @@
{
"name": "biod",
"authors": [
"description": "A D library for computational biology and bioinformatics",
"homepage": "https://github.com/biod/BioD",
"authors": [
"Artem Tarasov",
"George Gitinji",
"Prasun Anand",
"George Githinji",
"Prasun Anand",
"Pjotr Prins"
],
"description": "Bioinformatics library in D (utils for working with SAM, BAM, SFF formats)",
"copyright": "Copyright © 2016-2018, BioD developers",
"license": "MIT",
"sourcePaths": ["bio","contrib/undead/src"],
"importPaths": ["bio","contrib/undead/src"],
"sourcePaths": ["bio","contrib/undead"],
"importPaths": ["bio","contrib/undead"],
"buildRequirements": ["allowWarnings"]
}

2
examples/create_bam_from_scratch.d

@ -4,7 +4,7 @@ import bio.std.hts.bam.referenceinfo;
import bio.std.hts.sam.header;
import bio.std.hts.bam.reader;
import bio.std.hts.bam.writer;
import undead.stream;
import contrib.undead.stream;
import std.stdio;
import bio.std.hts.bam.cigar;

Loading…
Cancel
Save