Package: sumaclust
Version: 1.0.35-2
Severity: normal
Tags: patch upstream

Version 1.0.35-2 of sumaclust runs on arm64 but the last sequence of input 
files is always skipped.
This appears to be linked to the way sequences are read in libfasta/sequence.c. 
I have proposed a patch to upstream, which seems to solve the problem. I am 
waiting for its opinion on it.

Best,
Pierre
From: Pierre Gruet <pgtdeb...@free.fr>
Date: Wed, 8 Apr 2020 11:18:01 +0200
Subject: Reading only-ACGT sequences safely

---
 sumalibs/libfasta/sequence.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sumalibs/libfasta/sequence.c b/sumalibs/libfasta/sequence.c
index 2cf3d10..db999f8 100755
--- a/sumalibs/libfasta/sequence.c
+++ b/sumalibs/libfasta/sequence.c
@@ -162,19 +162,25 @@ 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 (c == '\n')
+                        goOnParsing = 0; //End of line character terminating 
the sequence has been reached.
                else if (c != '\n')
                        notAllATGC = 1;
+                
+                if (index == len)
+                        goOnParsing = 0;
        }
 
        if (notAllATGC)

Reply via email to