Commit dfda06d3 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-a/3572-3573-more-airr-fields' into 'dev'

Feature a/3572 3573 more airr fields

Closes #3573 and #3572

See merge request !338
parents da25d7dc 3af3afbf
Pipeline #46221 passed with stages
in 8 minutes and 6 seconds
......@@ -13,14 +13,23 @@ string getout(json v)
string Output::get(string key)
{
if (!j.count(key)) return NULL_VAL ;
return getout(j[key]);
}
string Output::get(string key, string subkey)
{
if (!j.count(key)) return NULL_VAL ;
if (!j[key].count(subkey)) return NULL_VAL ;
return getout(j[key][subkey]);
}
string Output::get(string key, string subkey, string subsubkey)
{
if (!j.count(key)) return NULL_VAL ;
if (!j[key].count(subkey)) return NULL_VAL ;
if (!j[key][subkey].count(subsubkey)) return NULL_VAL ;
return getout(j[key][subkey][subsubkey]);
}
......@@ -56,6 +65,18 @@ int CloneOutput::reads()
return j["reads"][0];
}
string CloneOutput::getWarnings()
{
string warnings = "" ;
if (!j.count("warn")) return warnings ;
for (json w: j["warn"])
{
warnings += w["code"].get<std::string>() + " ";
}
}
CloneOutput::~CloneOutput()
{
......@@ -120,6 +141,13 @@ void SampleOutputVidjil::out(ostream &s)
// AIRR .tsv output
string TF_format_bool(string val)
{
if (val == "false") return "F" ;
if (val == "true") return "T" ;
return val ;
}
map <string, string> CloneOutputAIRR::fields()
{
map <string, string> fields;
......@@ -133,6 +161,14 @@ map <string, string> CloneOutputAIRR::fields()
fields["v_call"] = get(KEY_SEG, "5", "name");
fields["d_call"] = get(KEY_SEG, "4", "name");
fields["j_call"] = get(KEY_SEG, "3", "name");
fields["cdr3_aa"] = get(KEY_SEG, "cdr3", "aa");
fields["junction"] = NULL_VAL;
fields["junction_aa"] = get(KEY_SEG, "junction", "aa");
fields["productive"] = TF_format_bool(get(KEY_SEG, "junction", "productive"));
fields["rev_comp"] = NULL_VAL;
fields["warnings"] = getWarnings();
return fields;
}
......@@ -145,6 +181,13 @@ void SampleOutputAIRR::out(ostream &s)
"v_call", "d_call", "j_call",
"sequence_id",
"sequence",
"productive",
"junction_aa",
"junction",
"cdr3_aa",
"warnings",
"rev_comp",
"sequence_alignment",
"germline_alignment",
"v_cigar", "d_cigar", "j_cigar",
......
......@@ -37,6 +37,7 @@ public:
virtual ~CloneOutput();
int reads();
string getWarnings();
void setSeg(string subkey, json val);
......
......@@ -5,13 +5,16 @@ $ There are four lines, all with tabs
4:\t
$ The required AIRR fields are present
:consensus_count
:v_call d_call j_call
:sequence_id
:sequence
:sequence_alignment
:germline_alignment
:v_cigar d_cigar j_cigar
:v_cigar d_cigar j_cigar
:junction
:junction_aa
:productive
:rev_comp
$ Three clones on IGH
3:IGH
......@@ -20,12 +23,23 @@ $ One clone has 8 reads, two clones have 5 reads
1:IGH 8
2:IGH 5
$ Two clones are productive, no clone is labeled as non-productive
2:\tT\t
0:\tF\t
$ v_call for 2 clones (-z 2)
2:IGHV
$ First clone window appears third times (clone_id, sequence_id, sequence)
w3:TATTACTGTACCCGGGAGGAACAATATAGCAGCTGGTACTTTGACTTCTG
$ Junction of the first clone appears once, but CDR3 twice (it is also included in the junction)
1:CTREEQYSSWYFDFW
w2:TREEQYSSWYFDF
$ The first clone has three warnings
1:W51 W69 W69
$ No spurious character
0:"
0:@
......
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