2 Commits

Author SHA1 Message Date
Celine Mercier
9f08b85eaf Optimised sequence parsing (from previous commit) 2020-04-13 13:48:09 +02:00
Celine Mercier
d7cd7e2677 Made sequence parsing more robust (issue with arm64 systems) 2020-04-13 11:59:09 +02:00

View File

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