Esempio n. 1
0
void HashErrorModel::setCell(const BaseData& data, char refBase)
{
    if(ourUseFast)
    {
        if(mismatchTableFast.empty())
        {
            mismatchTableFast.resize(BaseData::getFastKeySize());
        }
        SMatchesFast& matchInfo = mismatchTableFast[data.getFastKey()];
        if(BaseUtilities::areEqual(refBase, data.curBase))
        {
            ++(matchInfo.m);
        }
        else
        {
            ++(matchInfo.mm);
        }
        matchInfo.qempSimple = 255;
        return;
    }
    SMatches& matchInfo = mismatchTable[data.getKey()];

    if(BaseUtilities::areEqual(refBase, data.curBase))
    {
        ++(matchInfo.m);
    }
    else
    {
        ++(matchInfo.mm);
    }
    matchInfo.qempSimple = 255;
}
Esempio n. 2
0
uint8_t HashErrorModel::getQemp(BaseData& data)
{
    if(ourUseFast)
    {
        SMatchesFast& matchInfo = mismatchTableFast[data.getFastKey()];

        // If no matches or mismatches, return the original quality.
        if((matchInfo.m == 0) && (matchInfo.mm == 0))
        {
            return(data.qual);
        }

        if(matchInfo.qempSimple == 255)
        {
            matchInfo.qempSimple = 
                getQempSimple(matchInfo.m, matchInfo.mm);
        }
        return(matchInfo.qempSimple);
    }
    
    // If it is not in the table, return the original quality.
    try 
    {
        SMatches& matchMismatch = mismatchTable.at(data.getKey());
        if(ourUseLogReg)
        {
            return(matchMismatch.qempLogReg);
        }
        if(matchMismatch.qempSimple == 255)
        {
            matchMismatch.qempSimple = 
                getQempSimple(matchMismatch.m, matchMismatch.mm);
        }
        return(matchMismatch.qempSimple);
    }
    catch(std::out_of_range& oor)
    {
        // just return the original quality.
        return(data.qual);
    }
}