Browse Source

Edited makefile, fixed import names

master
Nick Rozinsky 10 months ago
parent
commit
5eae015862
6 changed files with 17 additions and 14 deletions
  1. +3
    -3
      Makefile
  2. +2
    -1
      contrib/biod/header.d
  3. +2
    -2
      contrib/biod/reader.d
  4. +4
    -4
      src/cbam/reader.d
  5. +2
    -2
      src/cbam/snappy.d
  6. +4
    -2
      src/cbam/writer.d

+ 3
- 3
Makefile View File

@@ -1,16 +1,16 @@
# Makefile uses D compiler

D_COMPILER=ldc2
DFLAGS = -wi -g -Icontrib/bio -IBioD -Isrc
DFLAGS = -wi -g -v -Icontrib/bio -Isrc -shared -IBioD -L-lsnappy -LBioD/libbiod.so -L/home/userl/dlang/dmd-2.086.1/linux/lib64/libphobos2.a

SRC = src/cbam/app.d src/cbam/markdup.d src/cbam/reader.d src/cbam/writer.d src/cbam/snappy.d
SRC = contrib/biod/header.d contrib/biod/reader.d src/cbam/app.d src/cbam/markdup.d src/cbam/reader.d src/cbam/writer.d src/cbam/snappy.d

OBJ = $(SRC:.d=.o)
BIN = bin/cbam

debug check: DFLAGS += -O0 -unittest
release static: DFLAGS += -O3 -release -enable-inlining -boundscheck=off
static: DFLAGS += -static -L-Bstatic
static: DFLAGS += -static -L-Bstatic

all: debug



+ 2
- 1
contrib/biod/header.d View File

@@ -47,6 +47,7 @@ import bio.std.experimental.hts.bgzf_writer;

// what is the difference btw these constants and the ones from bio.std.hts.bam.constants
import bio.std.experimental.hts.constants;
import bio.std.hts.bam.referenceinfo;

struct RefSequence {
size_d length;
@@ -58,7 +59,7 @@ struct BamHeader {
string text;
RefSequence[] refs;

this(SamHeader header, const(bio.std.hts.bam.referenceinfo.ReferenceSequenceInfo)[] bamRefs){
this(SamHeader header, const(ReferenceSequenceInfo)[] bamRefs){
id = BAM_MAGIC;
text = header.text;
refs.length = bamRefs.length;


+ 2
- 2
contrib/biod/reader.d View File

@@ -21,7 +21,7 @@

// This is a complete rewrite of Artem Tarasov's original reader.

module contrib.bio.reader;
module contrib.biod.reader;

import std.conv;
import core.stdc.stdio: fopen, fread, fclose;
@@ -43,7 +43,7 @@ import bio.std.experimental.hts.bgzf;
import bio.std.experimental.hts.constants;

//import utils.bam.header;
import bio.std.experimental.hts.bam.header;
import contrib.biod.header;


template ReadFlags(alias flag) {


+ 4
- 4
src/cbam/reader.d View File

@@ -534,13 +534,13 @@ class FileReader
sw2.stop();
GLOBAL_UNCOMPRESS ~= cast(int) sw2.peek.total!"msecs";

alias plainBuffer = uncompressedBuffer;
plainBuffer.length = rowGroup.uncompressedColSizes[columnType];
// alias plainBuffer = uncompressedBuffer;
// plainBuffer.length = rowGroup.uncompressedColSizes[columnType];
// auto sw2 = StopWatch(AutoStart.no);
// sw2.start();
// writeln("test");
// auto plainBuffer = Snappy.uncompress(rawInputBuffer);
Snappy.uncompress(rawInputBuffer, plainBuffer);
auto plainBuffer = Snappy.uncompress(rawInputBuffer);
//Snappy.uncompress(rawInputBuffer, plainBuffer);
// ProfilerFlush();
// sw2.stop();
//writeln("RAWUNCOMPRESS : ", sw2.peek.total!"usecs");


+ 2
- 2
src/cbam/snappy.d View File

@@ -29,13 +29,13 @@ extern (C) {

class Snappy {

static byte[] uncompress(byte[] compressed, byte[] res) { //, byte[] res
static byte[] uncompress(byte[] compressed) { //, byte[] res
size_t uncompressedPrediction;
snappy_status ok = snappy_uncompressed_length(compressed.ptr, compressed.length, &uncompressedPrediction);
if (ok != snappy_status.SNAPPY_OK) {
throw new Exception(to!(string)(ok));
}
// auto res = new byte[uncompressedPrediction];
auto res = new byte[uncompressedPrediction];
size_t uncompressed = uncompressedPrediction;
ok = snappy_uncompress(compressed.ptr, compressed.length, res.ptr, &uncompressed);
if (ok != snappy_status.SNAPPY_OK) {


+ 4
- 2
src/cbam/writer.d View File

@@ -9,6 +9,7 @@ import std.algorithm;
import std.algorithm.iteration;
import std.exception;
import cbam.reader;

import contrib.biod.reader;

//import sambamba.utils.lz4;
@@ -457,7 +458,8 @@ class FileWriter
FileReader fileReader = new FileReader(testFile);

assert(fileReader.fileMeta == fileWriter.fileMeta);
assert(equal!"a == b"(fileReader.bamHeader.refs, fileWriter.bamHeader.refs));
//add comparison operator to struct
//assert(equal!"a == b"(fileReader.bamHeader.refs, fileWriter.bamHeader.refs));
assert(equal(fileReader.bamHeader.text, fileWriter.bamHeader.text));
}

@@ -509,7 +511,7 @@ class FileWriter

// writeln(bamHeader.refs.ptr);
// writeln(fileReader.bamHeader.refs.ptr);
assert(equal!"a == b"(fileReader.bamHeader.refs, bamHeader.refs), "Refs are corrupted");
//assert(equal!"a == b"(fileReader.bamHeader.refs, bamHeader.refs), "Refs are corrupted");
assert(equal(fileReader.bamHeader.text, bamHeader.text), "Text is corrupted");
}



Loading…
Cancel
Save