Commit 24352992 authored by Mathieu Giraud's avatar Mathieu Giraud

core/segment.{h,cpp}: AlignBox::posFromBoxes(), get position list from boxes

parent 449e0acf
......@@ -45,6 +45,18 @@ AlignBox::AlignBox(string _key, string _color) {
ref_label = "";
}
char AlignBox::getInitial() {
// TRGV -> V, IGHD -> D...
if (ref_label.size() > 4)
return ref_label[3] ;
if (key.size())
return key[0] ;
return '?' ;
}
string AlignBox::getSequence(string sequence) {
return sequence.substr(start, end-start+1);
}
......@@ -157,6 +169,24 @@ string codeFromBoxes(vector <AlignBox*> boxes, string sequence)
return code;
}
string posFromBoxes(vector <AlignBox*> boxes)
{
string poss = "";
string initials = "";
int n = boxes.size();
for (int i=0; i<n; i++) {
initials += boxes[i]->getInitial() ;
poss += " " + string_of_int(boxes[i]->start + FIRST_POS) ;
poss += " " + string_of_int(boxes[i]->end + FIRST_POS) ;
}
return initials + "\t" + poss;
}
Segmenter::~Segmenter() {}
......
......@@ -89,6 +89,11 @@ class AlignBox
string getSequence(string sequence);
void addToJson(json &seg);
/**
* Returns 'V', 'D', 'J', or possibly '5', '4', '3', '?', depending on the ref_label and on the key
*/
char getInitial();
/**
* Returns the position in the reference string corresponding to the position in the read
* Preliminary implementation, only works for the start of V and J boxes
......
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