Commit 57d31ed2 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

core/segment: Store if the window has been shifted/shortened

It is good to know so that we can warn the user.

See #2913
parent 8aa67229
......@@ -208,9 +208,10 @@ Sequence Segmenter::getSequence() const {
return s ;
}
string Segmenter::getJunction(int l, int shift) const {
string Segmenter::getJunction(int l, int shift) {
assert(isSegmented());
shiftedJunction = false;
// '-w all'
if (l == NO_LIMIT_VALUE)
return getSequence().sequence;
......@@ -225,6 +226,9 @@ string Segmenter::getJunction(int l, int shift) const {
if (length_shift.first < MINIMAL_WINDOW_LENGTH && length_shift.first < l)
return "" ;
if (length_shift.first < l || length_shift.second != 0)
shiftedJunction = true;
// Window succesfully extracted
return getSequence().sequence.substr(central_pos + length_shift.second - length_shift.first / 2, length_shift.first);
}
......@@ -257,7 +261,9 @@ bool Segmenter::isDSegmented() const {
return dSegmented;
}
bool Segmenter::isJunctionShifted() const {
return shiftedJunction;
}
// E-values
void Segmenter::checkLeftRightEvaluesThreshold(double threshold, int strand)
......
......@@ -161,6 +161,7 @@ protected:
string CDR3aa;
bool reversed, segmented, dSegmented;
bool shiftedJunction;
int because;
/**
......@@ -205,8 +206,10 @@ protected:
* is not long enough.
* The junction is revcomp-ed if the original string comes from reverse
* strand.
* @post If the size or position of the window had to be dynamically adapted to fit
* in the read, isJunctionShifted() will return true
*/
string getJunction(int l, int shift=0) const;
string getJunction(int l, int shift=0);
/**
* @return the left position (on forward strand) of the segmentation.
......@@ -243,6 +246,12 @@ protected:
*/
bool isDSegmented() const;
/**
* @return true iff the junction has been shifted or shortened
* dynamically to fit into the sequence
*/
bool isJunctionShifted() const;
/**
* @return the status of the segmentation. Tells if the Sequence has been segmented
* of if it has not, what the reason is.
......
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