Skip to content

Commit 8435b46

Browse files
committed
[FIXES-#117] ignore mask in alphabet detection
1 parent 279e6ca commit 8435b46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/shared_misc.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define LAMBDA_SHARED_MISC_H_
2424

2525
#include <unistd.h>
26+
#include <locale>
2627
#include <type_traits>
2728
#include <forward_list>
2829
#include <sys/sysctl.h>
@@ -107,6 +108,10 @@ AlphabetEnum detectSeqFileAlphabet(std::string const & path)
107108

108109
readRecord(meta, seq, infile);
109110

111+
// for the alphabet test, ignore masks
112+
for (char & c : seq)
113+
c = std::toupper(c, std::locale());
114+
110115
if ((CharString(String<Dna5>(seq)) == seq) || (CharString(String<Rna5>(seq)) == seq))
111116
{
112117
return AlphabetEnum::DNA5;
@@ -123,7 +128,7 @@ AlphabetEnum detectSeqFileAlphabet(std::string const & path)
123128
return AlphabetEnum::AMINO_ACID;
124129
}
125130

126-
throw std::runtime_error("Your query file contains illegal characters in the first sequence.\n");
131+
throw std::runtime_error("Your query file contains illegal characters in the first sequence.");
127132

128133
// unreachable
129134
return AlphabetEnum::AMINO_ACID;

0 commit comments

Comments
 (0)