Commit cef4d733 by Eric Coissac

--no commit message

parent 0ca8d725
......@@ -238,7 +238,7 @@ parser = argparse.ArgumentParser(description='Assembly program dedicated to orga
args = parser.parse_args()
prefix="RSZAXPI001337-84:Valeriana_montana"
prefix="toto98"
r = Index(prefix)
p=orgasm.samples.protChloroArabidopsis
p=orgasm.samples.protMitoCapra
......
......@@ -4,7 +4,7 @@ MAKEDEPEND = gcc -D$(MACHINE) -M $(CPPFLAGS) -o $*.d $<
CC=gcc
#CFLAGS= -W -Wall $(shell ./littlebigman) -D__SSE2__
CFLAGS= -W -Wall -O0 -g $(shell ./littlebigman) -D__SSE2__
CFLAGS= -W -Wall -O3 -g $(shell ./littlebigman) -msse2 -D__SSE2__
LDFLAGS= -g
default: all
......
......@@ -34,12 +34,13 @@
*/
pnuc shiftKey(pnuc dest, pnuc key,uint32_t shift, uint32_t keyLength)
{
static char buffer[512];
static char buffer[512] __attribute__ ((aligned (16))); // Force the alignment of the buffer
uint32_t n16bytes;
uint32_t remains;
uint32_t i;
um128 out;
um128 tmp;
register um128 out;
register um128 tmp;
uint8_t mask;
uint8_t cmask;
......@@ -54,12 +55,13 @@ pnuc shiftKey(pnuc dest, pnuc key,uint32_t shift, uint32_t keyLength)
if (dest == NULL)
dest = (pnuc) PTR16(buffer);
dest = (pnuc) buffer;
ASSERT(((size_t)dest & 0xF)==0,"Pointer %p is not 16bytes aligned",dest)
rep = dest;
// Limit shift in the [0;3] interval
shift = shift & 0x3;
// Shift == 0 is no shift so no computation
......@@ -89,10 +91,16 @@ pnuc shiftKey(pnuc dest, pnuc key,uint32_t shift, uint32_t keyLength)
// The shifted key occupied one extra byte
keyLength++;
// Computes the count of complete 16 bytes packs in the key
n16bytes = keyLength >>4;
// The count of bytes after the last 16 bytes packs
remains = keyLength & 0xF;
save = 0;
for (i=0; i < n16bytes; i++, key+=16,dest+=16)
{
out.i = _MM_LOAD_SI128((const __m128i*)key);
......@@ -105,9 +113,9 @@ pnuc shiftKey(pnuc dest, pnuc key,uint32_t shift, uint32_t keyLength)
out.i = _MM_OR_SI128(out.i,tmp.i);
if (i>0)
out.u8[0]|= save << rshift;
else
out.u8[0]&= rmask;
out.u8[0]|= save << lshift; // BUG ??? change rshift to lshift
// else // Not useful
// out.u8[0]&= rmask;
save = saveLast;
......@@ -195,6 +203,7 @@ int8_t cmpPrefix(buffer_t *buffer,uint32_t r1,pnuc key,uint32_t length)
*
*/
int8_t cmpCompPrefix(buffer_t *buffer,uint32_t r1,pnuc key, uint32_t length)
{
int32_t i;
......@@ -210,8 +219,8 @@ int8_t cmpCompPrefix(buffer_t *buffer,uint32_t r1,pnuc key, uint32_t length)
querylength = CODELENGTH(length);
readlength = CODELENGTH(buffer->readSize);
mask= ((uint8_t)(~0)) >> ((((4-(length & 3))) & 3) << 1);
// Mask used to clean the left side of the query and subject
mask= ((uint8_t)(~0)) >> (((4-(length & 3)) & 3) << 1);
// DEBUG("pos : %d mask : %d,%x",pos,shift,mask);
......@@ -324,31 +333,39 @@ int32_t nextForward(buffer_t *buffer, int32_t current, size_t length, int32_t* e
return 0;
}
/**
*
* buffer : a pointer to a read index structure
* pnuc : a pointer
* key : a pointer to the encoded query
* length : the length of the query
* endoflist : set to 0 by the function if it finds a solution to 1 otherwise
*
*/
int32_t lookForReverse(buffer_t *buffer, pnuc key, size_t length, int32_t* endoflist)
{
char internalbuffer[512];
char internalbuffer2[512];
uint8_t bmask[]={255,192,240,252};
pnuc dest;
pnuc dest2;
//int32_t shift;
int32_t rshift;
static uint8_t bmask[]={255,192,240,252};
char internalbuffer[512] __attribute__ ((aligned (16))); // Force the alignment of the buffer;
char internalbuffer2[512] __attribute__ ((aligned (16))); // Force the alignment of the buffer;
pnuc dest;
pnuc dest2;
int32_t rshift;
uint32_t i;
int32_t initcode;
int32_t start;
int32_t end;
int32_t middle;
int32_t comp;
int32_t initcode;
int32_t start;
int32_t end;
int32_t middle;
int32_t comp;
uint32_t lkey;
// I set the end of list flag to 0
*endoflist=0;
dest = (pnuc) PTR16(internalbuffer);
dest2 = (pnuc) PTR16(internalbuffer2);
dest = (pnuc) internalbuffer;
dest2 = (pnuc) internalbuffer2;
//shift= 4 - (length & 3);
lkey=CODELENGTH(length);
lkey=CODELENGTH(length); //-> we compute the compressed query length
// then we reverse complement the sequence
......@@ -362,6 +379,8 @@ int32_t lookForReverse(buffer_t *buffer, pnuc key, size_t length, int32_t* endof
if (rshift > 0)
{
dest = shiftKey(dest, dest2, rshift, lkey);
// Set the last bits of the query to 0
dest[lkey]&=bmask[rshift];
// we have to increase match length to take into account the
......@@ -381,9 +400,9 @@ int32_t lookForReverse(buffer_t *buffer, pnuc key, size_t length, int32_t* endof
initcode = *(((uint16_t*)(dest + lkey))-1);
#ifdef LITTLE_END
initcode = complement4nuc[initcode & 0x00FF] | (complement4nuc[initcode >> 8] << 8);
initcode = complement4nuc[initcode & 0x00FF] | (complement4nuc[(initcode >> 8) & 0x00FF] << 8);
#else
initcode = complement4nuc[(initcode & 255)] << 8 | complement4nuc[initcode >> 8];
initcode = (complement4nuc[initcode & 0x00FF] << 8) | complement4nuc[(initcode >> 8) & 0x00FF ];
#endif
// I use the hash table for identifying positions of reads
......@@ -413,7 +432,7 @@ int32_t lookForReverse(buffer_t *buffer, pnuc key, size_t length, int32_t* endof
middle = (start + end) / 2;
comp = cmpCompPrefix(buffer,buffer->order1[middle],dest,length);
if (comp < 0) start=middle+1;
if (comp < 0) start=middle+1;
if (comp >= 0) end=middle;
}
......
......@@ -420,7 +420,7 @@ void sortSuffix(buffer_t *buffer,uint32_t pos)
void indexForward(buffer_t *buffer)
{
int32_t i;
uint32_t hash;
uint16_t hash;
uint32_t swap;
uint32_t cumsum=0;
int32_t imax = 1 << 16;
......@@ -431,7 +431,7 @@ void indexForward(buffer_t *buffer)
{
hash=*((uint16_t*)(buffer->records + i * buffer->recordSize));
#ifdef LITTLE_END
hash = ((hash & 255) << 8) | (hash >> 8);
hash = ((hash & 0xFF) << 8) | (hash >> 8);
#endif
buffer->index1[hash]++;
}
......@@ -452,7 +452,7 @@ void indexForward(buffer_t *buffer)
void indexReverse(buffer_t *buffer)
{
int32_t i;
uint32_t hash;
uint16_t hash;
uint32_t swap;
uint32_t cumsum=0;
int32_t imax = 1 << 16;
......@@ -464,9 +464,9 @@ void indexReverse(buffer_t *buffer)
{
hash = *((uint16_t*)(buffer->records + i * buffer->recordSize + CODELENGTH(buffer->readSize))-1);
#ifdef LITTLE_END
hash = complement4nuc[hash & 0x00FF] | complement4nuc[hash >> 8] << 8;
hash = complement4nuc[hash & 0x00FF] | (complement4nuc[(hash >> 8) & 0x00FF] << 8);
#else
hash = complement4nuc[hash & 0x00FF] << 8 | complement4nuc[hash >> 8];
hash = (complement4nuc[hash & 0x00FF] << 8) | complement4nuc[(hash >> 8) & 0x00FF];
#endif
buffer->index2[hash]++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment