Commit 24e760fa authored by Mathieu Giraud's avatar Mathieu Giraud

core/tools.{h,cpp}: testing if there is some extended nucleotides

parent b901014b
......@@ -55,6 +55,27 @@ string string_of_int(int number)
}
bool is_extended_nucleotide(char nuc) {
switch(nuc) {
case 'A': case 'a':
case 'C': case 'c':
case 'G': case 'g':
case 'T': case 't':
return false ;
default:
return true;
}
}
bool has_extended_nucleotides(string s) {
for (unsigned int i = 0; i<s.length(); i++)
if (is_extended_nucleotide(s[i]))
return true ;
return false ;
}
char complement_nucleotide(char nuc) {
switch(nuc) {
......
......@@ -71,6 +71,16 @@ bool pair_occurrence_sort(pair<T, int> a, pair<T, int> b);
string string_of_int(int number);
/**
* @param nuc is A, C, G, T or any extended nucleotide (or lowercase)
* @return is nuc an extended nucleotide ?
*/
bool is_extended_nucleotide(char nuc);
bool has_extended_nucleotides(string s);
/**
* @param nuc is A, C, G, T or any extended nucleotide (or lowercase)
* @return the complementary nucleotide of nuc
......
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