77 #define HGVS_THROW(err_code, message) NCBI_THROW(CHgvsParser::CHgvsParserException, err_code, message)
79 #define HGVS_ASSERT_RULE(i, rule_id) \
80 if((i->value.id()) != (SGrammar::rule_id)) \
81 {HGVS_THROW(eGrammatic, "Unexpected rule " + CHgvsParser::SGrammar::s_GetRuleName(i->value.id()) ); }
97 uo->
SetType().SetStr(
"hgvs_asserted_seq");
100 if(
literal.GetSeq_data().IsIupacna()) {
102 }
else if(
literal.GetSeq_data().IsNcbieaa()) {
105 HGVS_THROW(eLogic,
"Seq-data is neither IUPAC-AA or IUPAC-NA");
121 orig->ResetLocation();
124 vr.
SetData().SetSet().SetVariations().push_back(
orig);
127 if(
orig->IsSetExt() &&
orig->GetExt().GetType().GetStr() ==
"hgvs_asserted_seq") {
129 vr.
SetData().SetSet().SetVariations().push_back(asserted_vr);
135 delta->SetSeq().SetLiteral().SetLength(
orig->GetExt().GetField(
"length").GetData().GetInt());
136 if(
orig->GetExt().HasField(
"iupacna")) {
137 delta->SetSeq().SetLiteral().SetSeq_data().SetIupacna().Set(
orig->GetExt().GetField(
"iupacna").GetData().GetStr());
139 delta->SetSeq().SetLiteral().SetSeq_data().SetNcbieaa().Set(
orig->GetExt().GetField(
"ncbieaa").GetData().GetStr());
142 if(
orig->GetData().GetInstance().GetDelta().size() > 0
143 &&
orig->GetData().GetInstance().GetDelta().front()->IsSetAction()
147 offset_di->Assign(*
orig->GetData().GetInstance().GetDelta().front());
148 asserted_vr->SetData().SetInstance().SetDelta().push_back(offset_di);
151 asserted_vr->SetData().SetInstance().SetDelta().push_back(
delta);
153 if(
orig->GetData().GetInstance().GetDelta().size() > 0
154 &&
orig->GetData().GetInstance().GetDelta().back() !=
orig->GetData().GetInstance().GetDelta().front()
155 &&
orig->GetData().GetInstance().GetDelta().back()->IsSetAction()
159 offset_di->Assign(*
orig->GetData().GetInstance().GetDelta().back());
160 asserted_vr->SetData().SetInstance().SetDelta().push_back(offset_di);
177 if(m_loc.loc.IsNull()) {
178 HGVS_THROW(eContext,
"No seq-loc in context");
190 if(m_seq_id.IsNull()) {
199 HGVS_THROW(eContext,
"No CDS feature in context");
206 if(
check && m_mol_type == eMol_not_set) {
207 HGVS_THROW(eContext,
"No sequence in context");
216 m_mol_type = mol_type;
217 if(m_seq_id.IsNull()) {
220 m_seq_id->Assign(
id);
225 HGVS_THROW(eContext,
"Cannnot get bioseq for seq-id " +
id.AsFastaString());
228 if(mol_type == eMol_c) {
236 HGVS_THROW(eContext,
"Multiple CDS features on the sequence");
241 HGVS_THROW(eContext,
"Could not find CDS feat");
250 if(
literal.GetLength() != loc.GetTotalRange().GetLength()) {
251 HGVS_THROW(eSemantic,
"Literal length does not match location length");
258 if(
literal.GetSeq_data().IsIupacna()) {
259 seq1 =
literal.GetSeq_data().GetIupacna();
262 }
else if(
literal.GetSeq_data().IsNcbieaa()) {
263 seq1 =
literal.GetSeq_data().GetNcbieaa();
267 HGVS_THROW(eLogic,
"Seq-literal of unsupported type");
270 if(seq1 != seq2 && seq2 !=
"") {
271 HGVS_THROW(eSemantic,
"Expected sequence '" + seq1 +
"'; found '" + seq2 +
"'");
277 TRuleNames::const_iterator it = s_GetRuleNames().find(
id);
278 if(it == s_GetRuleNames().end()) {
279 HGVS_THROW(eLogic,
"Rule name not hardcoded");
294 if(
i->children.size() == 1) {
295 string s(it->value.begin(), it->value.end());
303 }
else if(
i->children.size() == 3) {
305 string s(it->value.begin(), it->value.end());
313 }
else if(
i->children.size() == 5) {
315 string s1(it->value.begin(), it->value.end());
318 string s2(it->value.begin(), it->value.end());
320 if(s1 ==
"?" && s2 ==
"?") {
323 }
else if(s1 !=
"?" && s2 !=
"?") {
327 }
else if(s2 ==
"?") {
330 }
else if(s1 ==
"?") {
340 fuzzy_int.
fuzz = fuzz;
354 bool is_relative_to_stop_codon =
false;
355 if(
i->children.size() == 2) {
356 is_relative_to_stop_codon =
true;
357 string s(it->value.begin(), it->value.end());
359 HGVS_THROW(eGrammatic,
"Expected literal '*'");
362 HGVS_THROW(eContext,
"Expected 'c.' context for stop-codon-relative coordinate");
378 if(int_fuzz.
value > 0 && !is_relative_to_stop_codon) {
420 if(
i->children.size() == 1) {
429 string s_sign(it->value.begin(), it->value.end());
430 int sign1 = s_sign ==
"-" ? -1 : 1;
451 string s_ivs(it->value.begin(), it->value.end());
453 string s_ivs_num(it->value.begin(), it->value.end());
458 size_t target_exon_num = sign1 < 0 ? ivs_num + 1 : ivs_num;
465 for(
CFeat_CI ci(bsh, sel); ci; ++ci) {
467 if(exon_num == target_exon_num) {
491 HGVS_THROW(eSemantic,
"Points in a fuzzy pos are on different sequences");
494 HGVS_THROW(eSemantic,
"Range-loc start/stop are on different strands.");
507 HGVS_THROW(eSemantic,
"Base-points in an intronic fuzzy position must be equal");
529 pnt.
pnt.Assign(*pnt1.
pnt);
534 if(!pnt1->IsSetFuzz() && !pnt2->IsSetFuzz()) {
537 pnt->SetFuzz().SetRange().SetMin(min_pos);
538 pnt->SetFuzz().SetRange().SetMax(max_pos);
540 }
else if(pnt1->IsSetFuzz() && pnt2->IsSetFuzz()) {
548 pnt->SetFuzz().SetRange().SetMin(min_pos);
549 pnt->SetFuzz().SetRange().SetMax(max_pos);
584 pnt->
Assign(pnt1->IsSetFuzz() ? *pnt2 : *pnt1);
585 pnt->SetFuzz().
Assign(pnt1->IsSetFuzz() ? pnt1->GetFuzz()
603 TIterator it =
i->children.rbegin()->children.begin();
604 string mol(it->value.begin(), it->value.end());
614 it = (
i->children.rbegin() + 1)->children.begin();
615 string id_str(it->value.begin(), it->value.end());
618 ctx.SetId(*
id, mol_type);
620 if(
i->children.size() == 3) {
621 it = (
i->children.rbegin() + 2)->children.begin();
622 string tag_str(it->value.begin(), it->value.end());
641 bool flip_strand =
false;
642 if(
i->children.size() == 3) {
669 HGVS_THROW(eSemantic,
"Expected protein context");
673 HGVS_THROW(eSemantic,
"Expected single aa literal in prot-pos");
687 context.Validate(*prot_literal, *tmp_loc);
713 HGVS_THROW(eSemantic,
"Range-loc start/stop are on different seq-ids.");
716 HGVS_THROW(eSemantic,
"Range-loc start/stop are on different strands.");
776 bool flip_strand =
false;
777 if(
i->children.size() == 3) {
791 HGVS_THROW(eSemantic,
"Intronic seq-locs are not supported in this context");
806 delta->SetSeq().SetLoc(*loc);
810 HGVS_THROW(eSemantic,
"Intronic loc is not supported in this context");
812 delta->SetSeq().SetLoc().Assign(*ofloc.
loc);
815 delta->SetSeq().SetLiteral(*raw_seq);
819 delta->SetSeq().SetLiteral().SetLength(int_fuzz.
value);
826 delta->SetSeq().SetLiteral().SetFuzz(*int_fuzz.
fuzz);
837 string ncbieaa = hgvsaa;
895 string seq_str(it->value.begin(), it->value.end());
900 literal->SetSeq_data().SetNcbieaa().Set(seq_str);
906 literal->SetSeq_data().SetIupacna().Set(seq_str);
909 literal->SetLength(seq_str.size());
929 vr->SetLocation().Assign(
context.GetLoc());
945 di_del->SetSeq().SetThis();
946 var_inst.
SetDelta().push_back(di_del);
949 var_inst.
SetDelta().push_back(di_ins);
962 vr->SetLocation().Assign(
context.GetLoc());
966 di->SetSeq().SetThis();
1000 HGVS_THROW(eSemantic,
"Encountered target location for an insertion with the length != 2");
1003 pnt_loc->
SetPnt().SetId().Assign(*
context.GetLoc().GetId());
1007 vr->SetLocation(*pnt_loc);
1013 var_inst.
SetDelta().push_back(delta_ins);
1026 vr->SetLocation().Assign(
context.GetLoc());
1029 delta->SetSeq().SetThis();
1030 delta->SetMultiplier(2);
1038 if(!dup_seq->GetSeq().IsLiteral()) {
1039 HGVS_THROW(eSemantic,
"Expected literal after 'dup'");
1040 }
else if(dup_seq->GetSeq().GetLiteral().GetLength() !=
context.GetOffsetLoc().GetLength()) {
1041 HGVS_THROW(eSemantic,
"The expected duplication length is not equal to the location length");
1042 }
else if(dup_seq->GetSeq().GetLiteral().IsSetSeq_data()) {
1059 vr->SetLocation().Assign(
context.GetLoc());
1064 HGVS_THROW(eSemantic,
"Expected literal of length 1 left of '>'");
1074 HGVS_THROW(eSemantic,
"Expected literal of length 1 right of '>'");
1078 delta->SetSeq().SetLiteral(*seq_to);
1096 vr->SetLocation(*loc);
1099 delta->SetSeq().SetLoc().Assign(*loc);
1100 delta->SetSeq().SetLoc().FlipStrand();
1104 if(it !=
i->children.end()) {
1105 string len_str(it->value.begin(), it->value.end());
1108 HGVS_THROW(eSemantic,
"Inversion length not equal to location length");
1135 if(
context.GetLoc().IsPnt()) {
1141 loc->
SetInt().SetFrom(
context.GetLoc().GetPnt().GetPoint() - d);
1144 loc->
SetInt().SetFrom(
context.GetLoc().GetPnt().GetPoint());
1145 loc->
SetInt().SetTo(
context.GetLoc().GetPnt().GetPoint() + d);
1155 vr->SetLocation().Assign(*loc);
1162 for(; it !=
i->children.end(); ++it) {
1163 string s1(it->value.begin(), it->value.end());
1168 delta->SetSeq().SetLoc().Assign(*loc);
1171 vr2->SetData().SetInstance().SetDelta().push_back(
delta);
1172 vr2->SetLocation().Assign(*loc);
1173 vr->SetData().SetSet().SetVariations().push_back(vr2);
1178 delta->SetSeq().SetLoc().Assign(*loc);
1185 delta->SetMultiplier_fuzz(*int_fuzz.
fuzz);
1187 vr->SetData().SetInstance().SetDelta().push_back(
delta);
1203 vr->SetLocation(*loc);
1205 delta->SetSeq().SetLoc().SetNull();
1219 vr->SetLocation().Assign(
context.GetLoc());
1228 delta->SetSeq().SetLoc().SetEquiv().Set().push_back(loc_this);
1229 delta->SetSeq().SetLoc().SetEquiv().Set().push_back(loc_other);
1243 HGVS_THROW(eContext,
"Frameshift can only be specified in protein context");
1246 vr->SetData().SetNote(
"Frameshift");
1247 vr->SetLocation().Assign(
context.GetLoc());
1249 typedef CVariation_ref::TConsequence::value_type::TObjectType TConsequence;
1251 cons->SetFrameshift();
1252 vr->SetConsequence().push_back(cons);
1256 if(it !=
i->children.end()) {
1259 string s(it->value.begin(), it->value.end());
1261 cons->SetFrameshift().SetX_length(x_length);
1274 HGVS_THROW(eContext,
"Expected protein context");
1280 string ext_type_str(it->value.begin(), it->value.end());
1282 string ext_len_str(it->value.begin(), it->value.end());
1285 vr->SetLocation().SetPnt().SetId().Assign(
context.GetId());
1289 delta->SetSeq().SetLiteral().SetLength(
abs(ext_len));
1291 TDelta delta_this(
new TDelta::TObjectType);
1292 delta_this->SetSeq().SetThis();
1294 if(ext_type_str ==
"extMet") {
1296 HGVS_THROW(eSemantic,
"extMet must be followed by a negative integer");
1298 vr->SetLocation().SetPnt().SetPoint(0);
1301 var_inst.
SetDelta().push_back(delta_this);
1302 }
else if(ext_type_str ==
"extX") {
1304 HGVS_THROW(eSemantic,
"exX must be followed by a non-negative integer");
1307 vr->SetLocation().SetPnt().SetPoint(
context.GetLength() - 1);
1309 var_inst.
SetDelta().push_back(delta_this);
1312 HGVS_THROW(eGrammatic,
"Unexpected ext_type: " + ext_type_str);
1327 string seq_str(it2->value.begin(), it2->value.end());
1331 HGVS_THROW(eContext,
"Expected protein context");
1338 vr->SetLocation().Assign(
context.GetLoc());
1341 delta->SetSeq().SetLiteral().SetSeq_data().SetNcbieaa().Set(seq_str);
1342 delta->SetSeq().SetLiteral().SetLength(1);
1362 vr->SetLocation(*loc);
1365 delta->SetSeq().SetThis();
1380 string s(it->value.begin(), it->value.end());
1384 }
else if(s ==
"=") {
1387 HGVS_THROW(eGrammatic,
"Unexpected inst terminal: " + s);
1419 string s(it->value.begin(), it->value.end());
1420 if(it->value.id() ==
i->value.id() && s ==
"(") {
1423 vr->SetValidated(
false);
1445 string s(it->value.begin(), it->value.end());
1446 if(it->value.id() ==
i->value.id() && s ==
"(") {
1449 vr->SetValidated(
false);
1455 local_context.
SetLoc(ofloc);
1457 vr =
x_expr3(it, local_context);
1466 di1->SetMultiplier(-1);
1478 di2->SetMultiplier(-1);
1514 }
else if(it->value.id() ==
i->value.id()) {
1517 vr->SetData().SetUnknown();
1518 vr->SetLocation().SetEmpty().Assign(
context.GetId());
1519 }
else if(s ==
"0?" || s ==
"0") {
1520 vr->SetData().SetUnknown();
1521 typedef CVariation_ref::TConsequence::value_type::TObjectType TConsequence;
1523 cons->SetNote(
"loss of product");
1524 vr->SetConsequence().push_back(cons);
1526 vr->SetLocation().SetEmpty().Assign(
context.GetId());
1528 vr->SetValidated(
false);
1530 }
else if(s ==
"=") {
1533 HGVS_THROW(eGrammatic,
"Unexpected expr terminal: " + s);
1549 string s(it->value.begin(), it->value.end());
1550 if(it->value.id() ==
i->value.id() && s ==
"(") {
1553 vr->SetValidated(
false);
1559 for(; it !=
i->children.end(); ++it) {
1561 vr->SetData().SetSet().SetVariations().push_back(inst_ref);
1582 for(
TIterator it =
i->children.begin(); it !=
i->children.end(); ++it) {
1584 if(it !=
i->children.begin()) {
1585 string delim(it->value.begin(), it->value.end());
1586 if(it->value.id() !=
i->value.id()) {
1592 HGVS_THROW(eSemantic,
"Non-unique delimiters within a list");
1653 vr->ResetLocation();
1654 feat->
SetData().SetVariation(*vr);
1662 return *v.
SetData().SetSet().SetVariations().begin();
1671 tree_parse_info<>
info = pt_parse(hgvs_expression.c_str(), *
s_grammar, +space_p);
1685 feat->
SetData().SetVariation().SetName(hgvs_expression);
1716 const CSeq_loc& parent_loc,
1748 if(
variation.IsSetLocation() || is_top_level) {
1750 outs = loc_str + outs;
1768 bool append_delta =
false;
1769 bool flipped_strand =
false;
1775 flipped_strand =
true;
1785 append_delta =
true;
1790 append_delta =
true;
1796 }
else if(
len < 10) {
1805 bool is_dup =
false;
1808 if(
delta.GetSeq().IsThis() &&
delta.IsSetMultiplier() &&
delta.GetMultiplier() == 2) {
1817 append_delta =
true;
1825 bool ins_after =
false;
1826 if(inst.
GetDelta().begin()->GetObject().GetSeq().IsThis()) {
1828 }
else if(inst.
GetDelta().rbegin()->GetObject().GetSeq().IsThis()) {
1835 ins_after = !ins_after;
1856 hgvs_loc.
Reset(
new CSeq_loc);
1861 append_delta =
true;
1866 append_delta =
true;
1878 loc.Assign(*hgvs_loc);
1885 if(
delta.GetSeq().IsThis()) {
1895 }
else if(
delta.GetSeq().IsLiteral()) {
1897 }
else if(
delta.GetSeq().IsLoc()) {
1901 if(flipped_strand) {
1905 string delta_loc_str;
1915 out += delta_loc_str;
1922 if(
delta.IsSetMultiplier()) {
1925 delta.GetMultiplier(),
1926 delta.IsSetMultiplier_fuzz() ? &
delta.GetMultiplier_fuzz() :
NULL);
1929 multiplier_str =
"[" + multiplier_str +
"]";
1934 out += multiplier_str;
1941 loc.Assign(*hgvs_loc);
1980 out += multiplier_str;
2013 string loc_str =
"";
2020 if(loc.IsInt() && loc.GetInt().IsSetFuzz_from()) {
2021 p_start->
SetFuzz().Assign(loc.GetInt().GetFuzz_from());
2028 if(loc.IsInt() && loc.GetInt().IsSetFuzz_to()) {
2029 p_stop->
SetFuzz().Assign(loc.GetInt().GetFuzz_to());
2033 loc_str = s_start +
"_" + s_stop;
2036 string out = (with_header ? header :
"") + loc_str;
2053 long point_pos = mapped_pnt->
GetPoint() + 1;
2054 point_pos -= first_pos;
2055 if(point_pos <= 0) {
2069 string moltype =
"";
2090 return accver +
":" + moltype;
2101 out =
"(" + from +
"_" + to +
")";
2102 }
else if(fuzz->
IsLim()) {
2133 len += d_len * multiplier;
2155 for(
int i = 0;
i < multiplier;
i++) {
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
namespace ncbi::objects::
static TSeqPos Convert(const CSeq_data &in_seq, CSeq_data *out_seq, CSeq_data::E_Choice to_code, TSeqPos uBeginIdx=0, TSeqPos uLength=0, bool bAmbig=false, Uint4 seed=17734276)
static TSeqPos ReverseComplement(CSeq_data *in_seq, TSeqPos uBeginIdx=0, TSeqPos uLength=0)
static void Validate(const CSeq_data &in_seq, vector< TSeqPos > *badIdx, TSeqPos uBeginIdx=0, TSeqPos uLength=0)
Template class for iteration on objects of class C.
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
CUser_field & SetField(const string &str, const string &delim=".", const string &obj_subtype=kEmptyStr, NStr::ECase use_case=NStr::eCase)
Access a named field in this user object.
Set of related Variations.
void Validate(const CSeq_literal &literal) const
void SetLoc(const SOffsetLoc &loc)
const CSeq_loc & GetLoc() const
const CSeq_feat & GetCDS() const
void SetId(const CSeq_id &id, EMolType mol_type)
const SOffsetLoc & GetOffsetLoc() const
EMolType GetMolType(bool check=true) const
const CSeq_id & GetId() const
CVariation_inst::TDelta::value_type TDelta
static SOffsetPoint x_general_pos(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_ssr(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_expr2(TIterator const &i, const CContext &context)
static string s_hgvsaa2ncbieaa(const string &hgvsaa)
Convert HGVS amino-acid code to ncbieaa.
CRef< CSeq_feat > AsVariationFeat(const string &hgvs_expression, TOpFlags=fOpFlags_Default)
static CRef< CVariation_ref > x_prot_missense(TIterator const &i, const CContext &context)
string x_SeqIdToHgvsHeader(const CSeq_id &id)
Convert seq-id to HGVS seq-id header, e.g. "NM_123456.7:c." or "NG_123456.7:p".
string x_GetInstData(const CVariation_inst &inst, const CSeq_loc &this_loc)
static CRef< CVariation_ref > x_nuc_subst(TIterator const &i, const CContext &context)
static SOffsetLoc x_range(TIterator const &i, const CContext &context)
TSeqPos x_GetInstLength(const CVariation_inst &inst, const CSeq_loc &this_loc)
static CRef< CVariation_ref > x_duplication(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_prot_ext(TIterator const &i, const CContext &context)
string x_AsHgvsExpression(const CVariation_ref &variation, const CSeq_loc &parent_loc, bool is_top_level)
variatino must have seq-loc specified
string AsHgvsExpression(const CSeq_feat &feat)
static CRef< CVariation_ref > x_mut_inst(TIterator const &i, const CContext &context)
string x_SeqPntToStr(const CSeq_point &pnt, TSeqPos first_pos)
static SFuzzyInt x_int_fuzz(TIterator const &i, const CContext &context)
static CRef< CSeq_loc > x_seq_loc(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_list(TIterator const &i, const CContext &context)
string x_IntWithFuzzToStr(int value, const CInt_fuzz *fuzz=NULL)
static CContext x_header(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_identity(const CContext &context)
static CRef< CVariation_ref > x_delins(TIterator const &i, const CContext &context)
static CRef< CSeq_literal > x_raw_seq(TIterator const &i, const CContext &context)
string x_InstToString(const CVariation_inst &inst, CSeq_loc &loc)
Only subset of insts can be expressed as HGVS, this will throw otherwise.
static CRef< CVariation_ref > x_insertion(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_unwrap_iff_singleton(CVariation_ref &v)
static CSafeStatic< SGrammar > s_grammar
static SOffsetPoint x_prot_pos(TIterator const &i, const CContext &context)
static SOffsetPoint x_pos_spec(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_translocation(TIterator const &i, const CContext &context)
string x_LocToSeqStr(const CSeq_loc &loc)
static CRef< CVariation_ref > x_deletion(TIterator const &i, const CContext &context)
static string s_hgvsUCaa2hgvsUL(const string &hgvsaa)
Convert non-HGVS compliant all-uppercase AAs to UpLow, e.g. ILECYS ->IleCys.
static TDelta x_seq_ref(TIterator const &i, const CContext &context)
static SOffsetLoc x_location(TIterator const &i, const CContext &context)
string x_SeqLocToStr(const CSeq_loc &loc, bool with_header)
static CRef< CVariation_ref > x_expr1(TIterator const &i, const CContext &context)
TParseTreeMatch::const_tree_iterator TIterator
string x_SeqLiteralToStr(const CSeq_literal &literal, bool flip_strand)
static CRef< CSeq_point > x_abs_pos(TIterator const &i, const CContext &context)
static SOffsetPoint x_fuzzy_pos(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_expr3(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_nuc_inv(TIterator const &i, const CContext &context)
@ fOpFlags_RelaxedAA
try assumbing all-uppercase three-letter AA representation
static CRef< CVariation_ref > x_conversion(TIterator const &i, const CContext &context)
static CRef< CVariation_ref > x_prot_fs(TIterator const &i, const CContext &context)
static CRef< CSeq_feat > x_root(TIterator const &i, const CContext &context)
static void s_FactorOutLocsInPlace(CVariation_ref &v)
std::ofstream out("events_result.xml")
main entry point for tests
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_RETHROW_SAME(prev_exception, message)
Generic macro to re-throw the same exception.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
const TPrim & Get(void) const
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
void FlipStrand(void)
Flip the strand (e.g. plus to minus)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
TRange GetTotalRange(void) const
CBeginInfo Begin(C &obj)
Get starting point of object hierarchy.
TSeqPos GetStop(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the stop of the location.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
string GetAccessionForId(const objects::CSeq_id &id, CScope &scope, EAccessionVersion use_version=eWithAccessionVersion, EGetIdType flags=0)
Retrieve the accession string for a Seq-id.
@ eWithAccessionVersion
accession.version (when possible)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
const TDescr & GetDescr(void) const
const CSeqFeatData & GetData(void) const
TInst_Mol GetInst_Mol(void) const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
const CSeq_loc & GetLocation(void) const
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
const_iterator begin(void) const
const_iterator end(void) const
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CTempString literal(const char(&str)[Size])
Templatized initialization from a string literal.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string & ToUpper(string &str)
Convert string to upper case – string& version.
@ fWithSign
Prefix the output value with a sign ('+'/'-')
TGenome GetGenome(void) const
Get the Genome member data.
bool IsSetGenome(void) const
Check if a value has been assigned to Genome data member.
void SetMin(TMin value)
Assign a value to Min data member.
bool IsLim(void) const
Check if variant Lim is selected.
TRange & SetRange(void)
Select the variant.
TLim GetLim(void) const
Get the variant data.
TMin GetMin(void) const
Get the Min member data.
void SetMax(TMax value)
Assign a value to Max data member.
TLim & SetLim(void)
Select the variant.
void SetType(TType &value)
Assign a value to Type data member.
bool IsRange(void) const
Check if variant Range is selected.
void SetData(TData &value)
Assign a value to Data data member.
TMax GetMax(void) const
Get the Max member data.
const TRange & GetRange(void) const
Get the variant data.
@ eLim_tl
space to left of position
@ eLim_tr
space to right of position
void SetLocation(TLocation &value)
Assign a value to Location data member.
bool IsCdregion(void) const
Check if variant Cdregion is selected.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
const TVariation & GetVariation(void) const
Get the variant data.
void SetPoint(TPoint value)
Assign a value to Point data member.
void SetId(TId &value)
Assign a value to Id data member.
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
void SetStrand(TStrand value)
Assign a value to Strand data member.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
bool IsSetFuzz(void) const
Check if a value has been assigned to Fuzz data member.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
const TId & GetId(void) const
Get the Id member data.
TStrand GetStrand(void) const
Get the Strand member data.
bool IsPnt(void) const
Check if variant Pnt is selected.
const TIupacaa & GetIupacaa(void) const
Get the variant data.
void SetLength(TLength value)
Assign a value to Length data member.
list< CRef< CSeqdesc > > Tdata
bool IsNcbipna(void) const
Check if variant Ncbipna is selected.
bool IsNcbieaa(void) const
Check if variant Ncbieaa is selected.
bool IsNcbi8aa(void) const
Check if variant Ncbi8aa is selected.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
bool IsIupacaa(void) const
Check if variant Iupacaa is selected.
const TIupacna & GetIupacna(void) const
Get the variant data.
bool IsNcbistdaa(void) const
Check if variant Ncbistdaa is selected.
const TSource & GetSource(void) const
Get the variant data.
bool IsSource(void) const
Check if variant Source is selected.
bool IsNcbi4na(void) const
Check if variant Ncbi4na is selected.
const Tdata & Get(void) const
Get the member data.
bool IsNcbi8na(void) const
Check if variant Ncbi8na is selected.
TLength GetLength(void) const
Get the Length member data.
const TNcbieaa & GetNcbieaa(void) const
Get the variant data.
bool IsNcbipaa(void) const
Check if variant Ncbipaa is selected.
bool IsNcbi2na(void) const
Check if variant Ncbi2na is selected.
bool IsIupacna(void) const
Check if variant Iupacna is selected.
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
@ e_Iupacna
IUPAC 1 letter nuc acid code.
@ e_Iupacaa
IUPAC 1 letter amino acid code.
TType GetType(void) const
Get the Type member data.
list< CRef< CVariation_ref > > TVariations
const TSet & GetSet(void) const
Get the variant data.
TType GetType(void) const
Get the Type member data.
void SetType(TType value)
Assign a value to Type data member.
const TLoc & GetLoc(void) const
Get the variant data.
const TDelta & GetDelta(void) const
Get the Delta member data.
void SetData(TData &value)
Assign a value to Data data member.
const TData & GetData(void) const
Get the Data member data.
const TSeq & GetSeq(void) const
Get the Seq member data.
const TLiteral & GetLiteral(void) const
Get the variant data.
bool IsSet(void) const
Check if variant Set is selected.
void SetType(TType value)
Assign a value to Type data member.
TMultiplier GetMultiplier(void) const
Get the Multiplier member data.
list< CRef< CDelta_item > > TDelta
TVariations & SetVariations(void)
Assign a value to Variations data member.
bool IsLiteral(void) const
Check if variant Literal is selected.
bool IsSetMultiplier(void) const
Multiplier allows representing a tandem, e.g.
TDelta & SetDelta(void)
Assign a value to Delta data member.
bool IsThis(void) const
Check if variant This is selected.
bool IsLoc(void) const
Check if variant Loc is selected.
const TVariations & GetVariations(void) const
Get the Variations member data.
@ eType_snv
delta=[morph of length 1] NOTE: this is snV not snP; the latter requires frequency-based validation t...
@ eType_inv
delta=[del, ins.seq= RevComp(variation-location)]
@ eType_mnp
delta=[morph of length >1]
@ eType_microsatellite
delta=[del, ins.seq= repeat-unit with fuzzy multiplier] variation-location is the microsat expansion ...
@ eType_delins
delta=[del, ins]
@ eType_prot_nonsense
delta=[del]; variation-location is the tail of the protein being truncated
@ eType_transposon
delta=[del, ins.seq= known donor or 'this'] variation-location is equiv of transposon locs.
@ eType_prot_silent
delta=[morph of length 1, same AA as at variation-location]
@ eType_prot_missense
delta=[morph of length 1]
@ eType_translocation
delta=like delins
@ eType_prot_neutral
delta=[morph of length 1]
@ eAction_offset
go downstream by distance specified by multiplier (upstream if < 0), in genomic context.
@ eAction_del_at
excise sequence at location if multiplier is specified, delete len(location)*multiplier positions dow...
@ eAction_ins_before
insert seq before the location.start
@ eData_set_type_haplotype
changes on the same allele, e.g r.[13g>a;15u>c]
@ eData_set_type_compound
complex change at the same location on the same molecule
@ eData_set_type_genotype
changes on different alleles in the same genotype, e.g. g.[476C>T]+[476C>T]
@ eData_set_type_package
set represents a package of observations at a given location, generally containing asserted + referen...
@ eData_set_type_individual
same organism; allele relationship unknown, e.g. g.[476C>T(+)183G>C]
@ eData_set_type_mosaic
different genotypes in the same individual
@ eData_set_type_alleles
set represents a set of observed alleles
@ eData_set_type_products
different products arising from the same variation in a precursor, e.g. r.[13g>a, 13_88del]
@ eObservation_asserted
inst represents the asserted base at a position
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
#define HGVS_ASSERT_RULE(i, rule_id)
#define HGVS_THROW(err_code, message)
const GenericPointer< typename T::ValueType > T2 value
void AttachAssertedSequence(CVariation_ref &vr, const CSeq_literal &literal)
void RepackageAssertedSequence(CVariation_ref &vr)
Int4 delta(size_t dimension_, const Int4 *score_)
static const char delimiter[]
static CSafeStatic< TRuleNames > s_rule_names
static const string & s_GetRuleName(parser_id id)
static TRuleNames & s_GetRuleNames()
static bool s_is_list(parser_id id)
TSeqPos GetLength() const
void Assign(const SOffsetPoint &other)
static CS_CONTEXT * context