Commit 2f64e20b authored by Cyprien Borée's avatar Cyprien Borée Committed by Mathieu Giraud

Add isGeneric and SPECIFIC_KMERS_NUMBERS in kmerAffect

isGeneric is a method returning true if the current K-mer is not odd (ambiguous, unknown).
It is used instead of calling successively isAmbiguous() || isUnknown()...

SPECIFIC_KMERS_NUMBER is a constant representing the amount of odd K-mers. For now there is
only two (ambiguous/unknown) but in the future it might grow.

For more informations about it, see #3282.
parent df17a08c
......@@ -73,14 +73,8 @@ BioReader FilterWithACAutomaton::filterBioReaderWithACAutomaton(
//All k-mers selected : iterate over all map
if(kmer_threshold == ALL_KMERS_VALUE || kmer_threshold > (int)mapAho.size()){
for(auto const mx: mapAho){
tmpKmer = mx.first;
asciiChar = tmpKmer.getLabel().at(0);
asciiNum = int(asciiChar);
if(asciiNum > indexes->size() - 1){
break;
}
for(int i = indexes->at(asciiNum - 1); i < indexes->at(asciiNum); ++i){
result.add(origin.read(i));
if(mx.first.isGeneric()){
transferBioReaderSequences(origin, result, mx.first);
}
}
/* The most significant k-mers selected : iterate over a portion of the
......
......@@ -178,6 +178,10 @@ bool KmerAffect::isUnknown() const {
return affect.c == (int) AFFECT_UNKNOWN_CHAR;
}
bool KmerAffect::isGeneric() const {
return !(isUnknown() || isAmbiguous());
}
string KmerAffect::toString() const {
return ::toString(affect);
}
......
......@@ -152,6 +152,11 @@ public:
* @return true iff the value is the same as the one given by default constructor
*/
bool isNull() const;
/**
* @return true if the K-mer is not odd (ambiguous or unknown)
*/
bool isGeneric() const;
string toString() const;
string toStringValues()const;
......@@ -184,6 +189,9 @@ ostream &operator<<(ostream &os, const KmerAffect &kmer);
/* Define how an unknown kmeraffect looks like in a string */
#define AFFECT_UNKNOWN_TO_STRING "_"
/* Define how meny specific k-mers exist. For now there is only ambiguous and unknown. */
#define SPECIFIC_KMERS_NUMBER 2
/**
* Constant defining any not-unknown affectation
* Could be used by .getIndexLoad(), but now any non-AFFECT_UNKNOWN kmer will work.
......
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