6 Commits

14 changed files with 8920 additions and 124 deletions

56
Makefile Executable file
View File

@ -0,0 +1,56 @@
PREFIX=/usr/local
SOURCES = libfasta/fasta_header_parser.c \
libfasta/fasta_seq_writer.c \
libfasta/fasta_header_handler.c \
libfasta/header_mem_handler.c \
libfasta/sequence.c \
libfile/fileHandling.c \
liblcs/sse_banded_LCS_alignment.c \
liblcs/upperband.c \
libutils/utilities.c \
libutils/debug.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE = libsuma.a
RANLIB = ranlib
CC=gcc
LDFLAGS=
CFLAGS = -O3 -w
default: all
all: $(LIBFILE)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(LIB)
libfasta/fasta_header_parser.c: libfasta/fasta_header_parser.l
flex -Pheader_yy -t $< > $@
libfasta/dic_parser.c: libfasta/dic_parser.l
lex -Phashtable_yy -t $< > $@
clean:
rm -rf $(OBJECTS) $(LIBFILE)
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@
install: all
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 $(LIBFILE) $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/
for lib in libfasta liblcs libsse libutils libfile ; do \
install -d $(DESTDIR)$(PREFIX)/include/$$lib ; \
cp $$lib/*.h $(DESTDIR)$(PREFIX)/include/$$lib ; \
done

View File

@ -1,10 +0,0 @@
CC=gcc
LDFLAGS=
CFLAGS = -O3 -w
default: all
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(LIB)

BIN
libfasta/.DS_Store vendored

Binary file not shown.

View File

@ -1,33 +0,0 @@
SOURCES = fasta_header_parser.c \
fasta_seq_writer.c \
fasta_header_handler.c \
header_mem_handler.c \
sequence.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE = libfasta.a
RANLIB = ranlib
include ../global.mk
all: $(LIBFILE)
fasta_header_parser.c: fasta_header_parser.l
flex -Pheader_yy -t $< > $@
dic_parser.c: dic_parser.l
lex -Phashtable_yy -t $< > $@
clean:
rm -rf $(OBJECTS) $(LIBFILE)
rm -f *.a
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@

View File

@ -162,19 +162,24 @@ void seq_fillSeqOnlyATGC(char *seq, fastaSeqPtr seqElem, int seqLen)
{ {
char* seqTemp; char* seqTemp;
char c; char c;
int32_t index = 0, seqIndex = 0, len = strlen(seq); int32_t index = 1, seqIndex = 0, len = strlen(seq);
char* seqAlphabets = "acgtACGT"; char* seqAlphabets = "acgtACGT";
int notAllATGC = 0; int notAllATGC = 0;
int goOnParsing = 1;
seqTemp = (char*) util_malloc(seqLen*sizeof(char), __FILE__, __LINE__); seqTemp = (char*) util_malloc(seqLen*sizeof(char), __FILE__, __LINE__);
while (index < len) while (goOnParsing)
{ {
c = seq[index++]; c = seq[index++];
if (strchr(seqAlphabets, c) != NULL) if (strchr(seqAlphabets, c) != NULL)
seqTemp[seqIndex++] = tolower(c); seqTemp[seqIndex++] = tolower(c);
else if (seq[index+1]=='\0')
goOnParsing = 0; // end of the sequence has been reached.
else if (c != '\n') else if (c != '\n')
notAllATGC = 1; notAllATGC = 1;
if (index == len)
goOnParsing = 0;
} }
if (notAllATGC) if (notAllATGC)

BIN
libfile/.DS_Store vendored

Binary file not shown.

View File

@ -1,25 +0,0 @@
SOURCES = fileHandling.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= libfile.a
RANLIB=ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
rm -f *.P
rm -f *.a
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@

BIN
liblcs/.DS_Store vendored

Binary file not shown.

View File

@ -1,25 +0,0 @@
SOURCES = sse_banded_LCS_alignment.c \
upperband.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= liblcs.a
RANLIB=ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
rm -f *.P
rm -f *.a
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@

BIN
libsse/.DS_Store vendored

Binary file not shown.

View File

@ -4,11 +4,16 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef __SSE2__
#include <xmmintrin.h> #if defined(__SSE2__)
#define USE_SSE2
#elif defined(__ARM_NEON)
#define USE_SSE2
#include "sse2neon.h"
#else #else
// no SSE2 support, use emulation
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
#endif /* __SSE2__ */ #endif
#ifndef MAX #ifndef MAX
#define MAX(x,y) (((x)>(y)) ? (x):(y)) #define MAX(x,y) (((x)>(y)) ? (x):(y))
@ -55,7 +60,7 @@ typedef union
} uint64_v; } uint64_v;
#ifdef __SSE2__ #ifdef USE_SSE2
static inline int8_t _s2_extract_epi8(__m128i r, const int p) static inline int8_t _s2_extract_epi8(__m128i r, const int p)
{ {

8848
libsse/sse2neon.h Normal file

File diff suppressed because it is too large Load Diff

BIN
libutils/.DS_Store vendored

Binary file not shown.

View File

@ -1,25 +0,0 @@
SOURCES = utilities.c \
debug.c
SRCS=$(SOURCES)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
LIBFILE= libutils.a
RANLIB=ranlib
include ../global.mk
all: $(LIBFILE)
clean:
rm -rf $(OBJECTS) $(LIBFILE)
rm -f *.P
rm -f *.a
$(LIBFILE): $(OBJECTS)
ar -cr $@ $?
$(RANLIB) $@