Commit 12d38e5e authored by Marc Duez's avatar Marc Duez
Browse files

segment.cpp / vidjil.cpp : add segment status to json output

parent c1c66534
......@@ -523,10 +523,34 @@ FineSegmenter::FineSegmenter(Sequence seq, Fasta &rep_V, Fasta &rep_J,
if (!segmented)
{
because = DONT_KNOW;
info = " @" + string_of_int (Vend + FIRST_POS) + " @" + string_of_int(Jstart + FIRST_POS) ;
if (Jstart - Vend < delta_min)
{
because = UNSEG_BAD_DELTA_MIN ;
}
if (Jstart - Vend > delta_max)
{
because = UNSEG_BAD_DELTA_MAX ;
}
if (Vend == (int) string::npos)
{
because = UNSEG_TOO_FEW_V ;
}
if (Jstart == (int) string::npos)
{
because = UNSEG_TOO_FEW_J ;
}
return ;
}
because = reversed ? SEG_MINUS : SEG_PLUS ;
//overlap VJ
if(Jstart-Vend <=0){
int b_r, b_l;
......@@ -691,6 +715,7 @@ void FineSegmenter::FineSegmentD(Fasta &rep_V, Fasta &rep_D, Fasta &rep_J){
JsonList FineSegmenter::toJsonList(Fasta &rep_V, Fasta &rep_D, Fasta &rep_J){
JsonList result;
result.add("status", because);
result.add("sequence", revcomp(sequence, reversed) );
if (isSegmented()) {
result.add("name", code_short);
......@@ -698,6 +723,7 @@ JsonList FineSegmenter::toJsonList(Fasta &rep_V, Fasta &rep_D, Fasta &rep_J){
result.add("Nlength", (del_V+del_J+seg_N.size()) );
result.add("Vend", Vend);
JsonArray jsonV;
JsonArray jsonJ;
......
......@@ -168,6 +168,7 @@ class KmerSegmenter : public Segmenter
class FineSegmenter : public Segmenter
{
public:
int because;
vector<pair<int, int> > score_V;
vector<pair<int, int> > score_D;
vector<pair<int, int> > score_J;
......
......@@ -1441,13 +1441,16 @@ int main (int argc, char **argv)
JsonArray json_nb_segmented;
json_nb_segmented.add(nb_segmented);
JsonArray json_timestamp;
json_timestamp.add(time_buffer);
JsonArray jsonSortedWindows = windowsStorage->sortedWindowsToJsonArray(json_data_segment,
norm_list,
nb_segmented);
json->add("vidjil_json_version", VIDJIL_JSON_VERSION);
json->add("timestamp", time_buffer);
json->add("timestamp", json_timestamp);
json->add("commandline", stream_cmdline.str());// TODO: escape "s in argv
json->add("segmentation_info", stream_segmentation_info.str());
json->add("germline", germline_system);
......
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