コード例 #1
0
ファイル: SeqCoord.cpp プロジェクト: 1dayac/CNVera
// Return a seqcoord representing the complement of the interval
// For example if the seqcoord represents the matched portion of a string, 
// this returns a seqcoord of the unmatched portion
SeqCoord SeqCoord::complement() const
{
    SeqCoord out;
    out.seqlen = seqlen;

    if(isFull())
    {
        out.setEmpty();
    }
    else if(isEmpty())
    {
        out.setFull();
    }
    else if(isLeftExtreme())
    {
        out.interval.start = std::max(interval.start, interval.end) + 1;
        out.interval.end = out.seqlen - 1;
    }
    else
    {
        assert(isRightExtreme());
        out.interval.start = 0;
        out.interval.end = std::min(interval.start, interval.end) - 1;
    }
    assert(out.isValid());
    return out;
}