Browse Source

Merge pull request #23 from John-Colvin/fix_build

Fix build
bio2
Artem Tarasov 6 years ago
committed by GitHub
parent
commit
cfa7cb3cf3
  1. 10
      .travis.yml
  2. 4
      bio/bam/bai/indexing.d
  3. 2
      bio/bam/baifile.d
  4. 1
      bio/bam/randomaccessmanager.d
  5. 3
      bio/bam/read.d
  6. 4
      bio/bam/reader.d
  7. 2
      bio/bam/readrange.d
  8. 2
      bio/bam/reference.d
  9. 2
      bio/bam/referenceinfo.d
  10. 2
      bio/bam/snpcallers/maq.d
  11. 2
      bio/bam/tagvalue.d
  12. 12
      bio/bam/thirdparty/msgpack.d
  13. 2
      bio/bam/utils/array.d
  14. 4
      bio/bam/writer.d
  15. 2
      bio/core/bgzf/inputstream.d
  16. 8
      bio/core/bgzf/outputstream.d
  17. 2
      bio/core/utils/bylinefast.d
  18. 7
      bio/core/utils/format.d
  19. 2
      bio/core/utils/outbuffer.d
  20. 7
      bio/core/utils/stream.d
  21. 2
      bio/core/utils/switchendianness.d
  22. 35
      bio/sam/header.d
  23. 2
      bio/sam/reader.d
  24. 2
      bio/sff/reader.d
  25. 2
      bio/sff/readrange.d
  26. 2
      bio/sff/writer.d
  27. 6
      dub.json
  28. 2
      examples/create_bam_from_scratch.d
  29. 2
      test/unittests.d

10
.travis.yml

@ -1,3 +1,9 @@
language: d
script:
- rdmd -unittest -d test/unittests.d
os:
- linux
- osx
d:
- dmd
- ldc

4
bio/bam/bai/indexing.d

@ -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.

2
bio/bam/baifile.d

@ -28,7 +28,7 @@ public import bio.bam.bai.bin;
import bio.core.bgzf.virtualoffset;
import bio.bam.constants;
import std.stream;
import undead.stream;
import std.system;
import std.exception;
import std.algorithm;

1
bio/bam/randomaccessmanager.d

@ -50,6 +50,7 @@ import std.traits;
import std.exception;
import std.container;
import std.parallelism;
static import std.file;
debug {
import std.stdio;

3
bio/bam/read.d

@ -72,7 +72,7 @@ import std.system;
import std.traits;
import std.array;
import std.bitmanip;
import std.c.stdlib;
import core.stdc.stdlib;
/**
Represents single CIGAR operation
@ -1579,6 +1579,7 @@ unittest {
{
import std.typecons;
static import bio.bam.thirdparty.msgpack;
auto packer = bio.bam.thirdparty.msgpack.packer(Appender!(ubyte[])());
read.toMsgpack(packer);
auto data = packer.stream.data;

4
bio/bam/reader.d

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

2
bio/bam/readrange.d

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

2
bio/bam/reference.d

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

2
bio/bam/referenceinfo.d

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

2
bio/bam/snpcallers/maq.d

@ -5,7 +5,7 @@ module bio.bam.snpcallers.maq;
*/
import core.stdc.math;
import std.math : LN2, LN10, isnan;
import std.math : LN2, LN10, isNaN;
import std.traits;
import std.range;
import std.algorithm;

2
bio/bam/tagvalue.d

@ -296,7 +296,7 @@ string injectOpCast() {
}
cs ~= `(is(T == string)) {` ~
` if (is_string) {`
` if (is_string) {` ~
` return bam_typeid == 'Z' ? u.Z : u.H;`~
` } else if (is_integer || is_float || is_character) {`~
` `~injectSwitchPrimitive("string")~

12
bio/bam/thirdparty/msgpack.d

@ -59,7 +59,7 @@ else
// for Converting Endian using ntohs and ntohl;
version(Windows)
{
import std.c.windows.winsock;
import core.stdc.windows.winsock;
}
else
{
@ -82,7 +82,7 @@ static if (real.sizeof == double.sizeof) {
import std.numeric;
}
version(unittest) import std.file, std.c.string;
version(unittest) import std.file, core.stdc.string;
@trusted:
@ -344,7 +344,7 @@ struct PackerImpl(Stream) if (isOutputRange!(Stream, ubyte) && isOutputRange!(St
* Params:
* withFieldName = serialize class / struct with field name
*/
this(bool withFieldName = false)
this(bool withFieldName)
{
withFieldName_ = withFieldName;
}
@ -3145,7 +3145,7 @@ struct Value
* type = the type of value.
*/
@safe
this(Type type = Type.nil)
this(Type type)
{
this.type = type;
}
@ -3617,7 +3617,7 @@ struct Value
ret ^= value.toHash();
}
return ret;
} catch assert(0);
} catch (Exception) assert(0);
}
}
}
@ -4656,7 +4656,7 @@ mixin template MessagePackable(Members...)
if (withFieldName) {
packer.beginMap(this.tupleof.length);
foreach (i, member; this.tupleof) {
pack(getFieldName!(typeof(this), i));
packer.pack(getFieldName!(typeof(this), i));
packer.pack(member);
}
} else {

2
bio/bam/utils/array.d

@ -23,7 +23,7 @@
*/
module bio.bam.utils.array;
import std.c.string;
import core.stdc.string;
import std.traits;
/// Modifies array in-place so that $(D slice) is replaced by

4
bio/bam/writer.d

@ -35,7 +35,7 @@ import bio.core.utils.stream;
import std.parallelism;
import std.exception;
import std.stream;
import 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(std.stream.Stream stream,
this(undead.stream.Stream stream,
int compression_level=-1,
std.parallelism.TaskPool task_pool=std.parallelism.taskPool,
size_t buffer_size=0)

2
bio/core/bgzf/inputstream.d

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

8
bio/core/bgzf/outputstream.d

@ -28,13 +28,13 @@ import bio.core.bgzf.compress;
import bio.core.utils.roundbuf;
import std.stream;
import undead.stream;
import std.exception;
import std.parallelism;
import std.array;
import std.algorithm : max;
import std.typecons;
import std.c.stdlib;
import core.stdc.stdlib;
alias void delegate(ubyte[], ubyte[]) BlockWriteHandler;
@ -88,7 +88,7 @@ class BgzfOutputStream : Stream {
// 1 extra block to which we can write while n_tasks are executed
auto comp_buf_size = (2 * n_tasks + 2) * max_block_size;
auto p = cast(ubyte*)std.c.stdlib.malloc(comp_buf_size);
auto p = cast(ubyte*)core.stdc.stdlib.malloc(comp_buf_size);
_compression_buffer = p[0 .. comp_buf_size];
_buffer = _compression_buffer[0 .. block_size];
_tmp = _compression_buffer[max_block_size .. max_block_size * 2];
@ -210,7 +210,7 @@ class BgzfOutputStream : Stream {
_stream.close();
writeable = false;
std.c.stdlib.free(_compression_buffer.ptr);
core.stdc.stdlib.free(_compression_buffer.ptr);
}
/// Adds EOF block. This function is called in close() method.

2
bio/core/utils/bylinefast.d

@ -6,7 +6,7 @@ module bio.core.utils.bylinefast;
import std.stdio;
import std.string: indexOf;
import std.c.string: memmove;
import core.stdc.string: memmove;
/**
Reads by line in an efficient way (10 times faster than File.byLine from std.stdio).

7
bio/core/utils/format.d

@ -34,8 +34,9 @@
*/
module bio.core.utils.format;
import std.c.stdio;
import std.c.stdlib;
import core.stdc.stdio;
import core.stdc.stdlib;
static import core.stdc.string;
import std.string;
import std.traits;
import std.array;
@ -161,7 +162,7 @@ private {
if (isSomeString!T)
{
auto str = cast(const(char)[])s;
std.c.string.memcpy(sink, str.ptr, str.length);
core.stdc.string.memcpy(sink, str.ptr, str.length);
sink += str.length;
}

2
bio/core/utils/outbuffer.d

@ -93,7 +93,7 @@ class OutBuffer {
/// Responsibility that there's enough capacity is on the user
void putUnsafe(T)(T bytes) if (is(T == ubyte[])) {
_heap_ptr[_heap_used .. _heap_used + bytes.length] = bytes[];
_heap_used += bytes.length;;
_heap_used += bytes.length;
}
/// ditto

7
bio/core/utils/stream.d

@ -1,6 +1,6 @@
module bio.core.utils.stream;
public import std.stream;
public import undead.stream;
import core.stdc.stdio;
import core.stdc.errno;
import core.stdc.string;
@ -15,7 +15,7 @@ version(Posix){
version(Windows) {
private import std.file;
private import std.utf;
private import std.c.windows.windows;
private import core.stdc.windows.windows;
extern (Windows) {
DWORD GetFileType(HANDLE hFile);
}
@ -48,7 +48,7 @@ FileMode toFileMode(string mode) {
return result;
}
final class File: std.stream.File {
final class File: undead.stream.File {
this(string filename, string mode="rb") {
version (Posix) {
// Issue 8528 workaround
@ -135,7 +135,6 @@ final class File: std.stream.File {
if (ret <= 0) {
size = 0;
throw new ReadException("read timeout");
break;
}
} else {
throw new ReadException(to!string(strerror(errno)));

2
bio/core/utils/switchendianness.d

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

35
bio/sam/header.d

@ -8,10 +8,10 @@
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -117,7 +117,7 @@ private {
mixin template toSamMethod(string line_prefix, Field...) {
void toSam(Sink)(auto ref Sink sink) const if (isSomeSink!Sink) {
sink.write(line_prefix);
mixin(serializeFields!Field());
mixin(serializeFields!Field());
}
}
@ -132,9 +132,9 @@ private {
mixin template toHashMethod(string struct_name, string id_field, Field...) {
static if (id_field != null) {
hash_t toHash() const {
hash_t toHash() const nothrow @safe{
hash_t result = 1;
mixin(generateHashExpression!Field());
mixin(generateHashExpression!Field());
return result;
}
@ -195,12 +195,12 @@ private {
}
}
mixin template HeaderLineStruct(string struct_name,
mixin template HeaderLineStruct(string struct_name,
string line_prefix,
string id_field,
Field...)
Field...)
{
mixin(`struct `~struct_name~`{
mixin(`struct `~struct_name~`{
mixin structFields!Field;
mixin parseStaticMethod!(struct_name, Field);
mixin toSamMethod!(line_prefix, Field);
@ -359,7 +359,7 @@ class HeaderLineDictionary(T) {
_index_to_id.length = _index_to_id.length - 1;
_dict.remove(id);
_id_to_index.remove(id);
_id_to_index.remove(id);
return true;
}
@ -484,7 +484,7 @@ class SamHeader {
try {
sorting_order = to!SortingOrder(header_line.sorting_order);
} catch (ConvException e) {
sorting_order = SortingOrder.unknown;
sorting_order = SortingOrder.unknown;
// FIXME: should we do that silently?
}
} else {
@ -536,14 +536,14 @@ class SamHeader {
core.memory.GC.enable();
}
/// Format version
string format_version;
/// Sorting order
SortingOrder sorting_order = SortingOrder.unknown;
/// Dictionary of @SQ lines.
/// Dictionary of @SQ lines.
/// Removal is not allowed, you can only replace the whole dictionary.
SqLineDictionary sequences() @property {
if (_sequences is null)
@ -624,7 +624,7 @@ class SamHeader {
sink.write(to!string(sorting_order));
}
sink.write('\n');
for (size_t i = 0; i < sequences.length; i++) {
auto sq_line = getSequence(i);
sq_line.toSam(sink);
@ -707,13 +707,16 @@ class SamHeader {
JSONValue json;
json.object = result;
sink.write(toJSON(&json));
static if (__VERSION__ < 2072)
sink.write(toJSON(&json));
else
sink.write(toJSON(json));
}
/// Packs message in the following format:
/// $(BR)
/// MsgPack array with elements
/// $(OL
/// $(OL
/// $(LI format version - string)
/// $(LI sorting order - string)
/// $(LI @SQ lines - array of dictionaries)
@ -789,7 +792,7 @@ unittest {
dict["zzz"] = zzz;
header.sequences = dict;
assert(header.text ==
assert(header.text ==
"@HD\tVN:1.4\tSO:coordinate\n@SQ\tSN:yay\tLN:111\n@SQ\tSN:zzz\tLN:222\tUR:ftp://nyan.cat\n");
assert(header.sequences == dict);

2
bio/sam/reader.d

@ -49,7 +49,7 @@ import std.typecons;
import std.parallelism;
import std.process;
import std.exception;
import std.c.string;
import core.stdc.string;
BamRead _parseSamRecord(Tuple!(char[], SamReader, OutBuffer) t) {
auto r = parseAlignmentLine(cast(string)t[0], t[1]._header, t[2]);

2
bio/sff/reader.d

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

2
bio/sff/readrange.d

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

2
bio/sff/writer.d

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

6
dub.json

@ -8,5 +8,9 @@
"copyright": "Copyright © 2016, BioD developers",
"license": "MIT",
"sourcePaths": ["bio"],
"importPaths": ["bio"]
"importPaths": ["bio"],
"dependencies": {
"undead": "~>1.0.6"
},
"buildRequirements": ["allowWarnings"]
}

2
examples/create_bam_from_scratch.d

@ -3,7 +3,7 @@
// this example shows how to create BAM files from scratch
import bio.bam.read, bio.bam.referenceinfo, bio.sam.header;
import bio.bam.reader, bio.bam.writer;
import std.stream, std.stdio;
import undead.stream, std.stdio;
void main() {
auto header = new SamHeader(); // First, create SAM header

2
test/unittests.d

@ -49,7 +49,7 @@ import bio.core.utils.roundbuf;
import std.path;
import std.range;
import std.stdio;
import std.stream;
import undead.stream;
import std.algorithm;
import std.array;
import std.conv;

Loading…
Cancel
Save