Skip to content
Permalink
Browse files

Use kseq.h from ksw2 instead of the one we had previously bundled

  • Loading branch information...
milot-mirdita committed Aug 6, 2019
1 parent b87122c commit 937d4146a90f1d3d2bf864347c23d683ecb53752
@@ -84,7 +84,6 @@ include_directories(lib/tinyexpr)
add_subdirectory(lib/tinyexpr EXCLUDE_FROM_ALL)

include_directories(lib)
include_directories(lib/kseq)
include_directories(lib/simd)
include_directories(lib/gzstream)
include_directories(lib/alp)

This file was deleted.

This file was deleted.

@@ -39,7 +39,7 @@

#define __KS_TYPE(type_t) \
typedef struct __kstream_t { \
unsigned char *buf; \
char *buf; \
int begin, end, is_eof; \
type_t f; \
} kstream_t;
@@ -53,7 +53,7 @@
{ \
kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t)); \
ks->f = f; \
ks->buf = (unsigned char*)malloc(__bufsize); \
ks->buf = (char*)malloc(__bufsize); \
return ks; \
} \
static inline void ks_destroy(kstream_t *ks) \
@@ -30,7 +30,7 @@
#include <iterator>

#include "kseq.h"
#include "kseq_buffer_reader.h"
#include "KSeqBufferReader.h"

KSEQ_INIT(kseq_buffer_t*, kseq_buffer_reader)

@@ -17,6 +17,8 @@ set(commons_header_files
commons/HeaderSummarizer.h
commons/IndexReader.h
commons/itoa.h
commons/KSeqBufferReader.h
commons/KSeqWrapper.h
commons/MathUtil.h
commons/MemoryMapped.h
commons/MMseqsMPI.h
@@ -0,0 +1,36 @@
#ifndef KSEQ_BUFFER_READER_H
#define KSEQ_BUFFER_READER_H

typedef struct kseq_buffer {
char* buffer;
size_t position, length;

kseq_buffer () : buffer(NULL), position(0), length(0) {};
kseq_buffer (char* buffer, size_t length) : buffer(buffer), position(0), length(length) {};
} kseq_buffer_t;

inline ssize_t kseq_buffer_reader(kseq_buffer_t *inBuffer, char *outBuffer, size_t nbyte) {
if (inBuffer->position > inBuffer->length) {
return 0;
}

size_t bytes = nbyte;
if (inBuffer->position + bytes > inBuffer->length) {
bytes = inBuffer->length - inBuffer->position;
}

if (bytes == 0) {
return 0;
}

for (size_t i = inBuffer->position; i < inBuffer->position + bytes; ++i) {
size_t index = i - inBuffer->position;
outBuffer[index] = inBuffer->buffer[i];
}

inBuffer->position += bytes;

return bytes;
}

#endif
@@ -1,8 +1,9 @@
#ifndef MMSEQS_KSEQWRAPPER_H
#define MMSEQS_KSEQWRAPPER_H

#include "kseq.h"

#include <string>
#include <kseq/kseq.h>

class KSeqWrapper {
public:
@@ -16,7 +16,7 @@
#endif

#include "kseq.h"
#include "kseq_buffer_reader.h"
#include "KSeqBufferReader.h"

KSEQ_INIT(kseq_buffer_t*, kseq_buffer_reader)

0 comments on commit 937d414

Please sign in to comment.
You can’t perform that action at this time.