53 static const char*
kFrom =
"from";
54 static const char*
kTo =
"to";
67 if (filter.empty())
return;
85 string filter_str = filter;
200 "Error: NULL feature evaluation");
203 const objects::CSeq_feat& feat =
m_EvalFeat->GetOriginalFeature();
205 if (feat.GetData().IsClone()) {
207 if (feat.GetData().GetClone().IsSetConcordant()) {
208 value = feat.GetData().GetClone().GetConcordant();
213 if (feat.GetData().GetClone().IsSetConcordant()) {
214 value = !feat.GetData().GetClone().GetConcordant();
234 if (identifier ==
"len") {
235 const objects::CSeq_loc& loc =
m_EvalFeat->GetLocation();
237 value = loc.GetTotalRange().GetLength();
240 }
else if (identifier ==
kFrom) {
241 const objects::CSeq_loc& loc =
m_EvalFeat->GetLocation();
243 value = loc.GetTotalRange().GetFrom();
246 }
else if (identifier ==
kTo) {
247 const objects::CSeq_loc& loc =
m_EvalFeat->GetLocation();
249 value = loc.GetTotalRange().GetTo();
253 for (
const auto& iter :
m_EvalFeat->GetOriginalFeature().GetExts()) {
254 if (iter->GetType().IsStr() &&
255 iter->GetType().GetStr() ==
"Support" &&
256 iter->GetFieldRef(
"Total") &&
257 !iter->GetFieldRef(
"Total").IsNull()) {
258 const auto& d = iter->GetFieldRef(
"Total")->GetData();
262 value = float(d.GetReal() + 0.5);
276 "Error: NULL feature evaluation");
278 const objects::CSeq_feat& feat =
m_EvalFeat->GetOriginalFeature();
280 value = feat.GetNamedQual(
"Variant Quality");
284 }
else if (identifier ==
kPilot) {
285 value = feat.GetNamedQual(
"Pilot");
287 feat.GetData().IsVariation()) {
288 const objects::CVariation_ref& var = feat.GetData().GetVariation();
289 ITERATE (objects::CVariation_ref::TPhenotype, pnt_iter, var.GetPhenotype()) {
290 if ((*pnt_iter)->CanGetClinical_significance()) {
291 switch ((*pnt_iter)->GetClinical_significance()) {
292 case objects::CPhenotype::eClinical_significance_non_pathogenic:
295 case objects::CPhenotype::eClinical_significance_pathogenic:
296 value =
"pathogenic";
298 case objects::CPhenotype::eClinical_significance_probable_pathogenic:
299 value =
"likely_pathogenic";
301 case objects::CPhenotype::eClinical_significance_probable_non_pathogenic:
302 value =
"likely_benign";
304 case objects::CPhenotype::eClinical_significance_unknown:
305 value =
"likely_unknown";
307 case objects::CPhenotype::eClinical_significance_untested:
308 value =
"not_tested";
310 case objects::CPhenotype::eClinical_significance_other:
322 feat.GetData().IsVariation()) {
323 value = feat.GetNamedQual(
"sampleset_type");
326 if (feat.IsSetExts()) {
327 const objects::CSeq_feat::TExts& exts = feat.GetExts();
328 ITERATE (objects::CSeq_feat::TExts, iter, exts) {
329 if ( (*iter)->GetType().IsStr() &&
331 (*iter)->GetFieldRef(
"Status") &&
332 (*iter)->GetFieldRef(
"Status")->GetData().IsStr()) {
333 value = (*iter)->GetFieldRef(
"Status")->GetData().GetStr();
370 m_Int = (*m_Node)->GetInt();
394 m_Double = (double)(*m_Node)->GetInt();
426 m_Bool = (*m_Node)->GetBool();
455 m_String = (*m_Node)->GetStrValue();
495 tr->SetUserObject(v);
501 const string&
id = tr->GetOriginalText();
525 "Incorrect query node count");
578 "Incorrect query node count");
589 "The first argument has to be an indentifier");
611 if ((*iter)->IsLeaf()) {
651 const string&
id = node->GetStrValue();
712 }
else if ( !sub_v2->
IsValid() ) {
746 "Error: Unexpected logical operand:" + node->GetOriginalText());
889 bool is_between =
false;
898 is_between = (
result >= 0);
911 is_between = (
result <= 0);
927 for (
size_t i = 1;
i < args.size() && !found; ++
i) {
949 "Error - Unhandled comparison operator: " + node->GetOriginalText());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Query parser exceptions class CFeatFilterQueryException.
TIdentifierDict m_IdDict
Identifier dictionary.
const TIdentifierDict * GetIdDictionary() const
virtual bool ResolveIdentifier(const std::string &identifier, bool &value)
The following functions search in the feature asn for a value with the name 'identifier' and,...
bool NeedFiltering() const
bool Pass(const objects::CMappedFeat *feat)
CFeatureFilter()
class CFeatureFilter implementation
const objects::CMappedFeat * m_EvalFeat
Evaluated object.
void Init(const string &filter)
void AddId(const string &id, CQueryParseNode::EType type)
virtual bool HasIdentifier(const std::string &id)
Search for 'identifier' in nodes feature list and true if it exists.
class CSGQueryFunctionCompare
virtual void Evaluate(CQueryParseTree::TNode &node)
class CSGQueryFunctionCompare
class CSGQueryFunctionLogic
virtual void Evaluate(CQueryParseTree::TNode &node)
class CSGQueryFunctionLogic
class CSGQueryFunctionValue
virtual void Evaluate(CQueryParseTree::TNode &node)
class CSGQueryFunctionValue
class CSGQueryNodePreprocessor
TIdentifierDict * m_Dictionary
CSGQueryNodePreprocessor(TIdentifierDict *d)
class CSGQueryNodePreprocessor implementation
ETreeTraverseCode operator()(CTreeNode< CQueryParseNode > &tr, int delta)
Int8 m_Int
Int data, if data was an integer or converted into one.
bool PromoteTo(CQueryParseNode::EType type)
promote this value to the given type.
bool IsDataField() const
Get to indicate if this is a field from the tree or simple string.
void SetDataType(CQueryParseNode::EType dt)
Set/get underlying data type.
double m_Double
Floating point data, if data was a double or converted into one.
std::string m_String
String data, if data came from a string or data fied in the tree.
CQueryParseNode::EType GetDataType() const
bool m_Bool
Bool data, if data base a constant boolean or converted into one.
void SetDataField(bool f)
definition of a Culling tree
Base class for query node user defined object.
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
static const char * kConcordant
static const char * kValidationStatus
static const char * kDiscordant
static const char * kClinicalAssertion
static const char * kSamplesetType
static const char * kVariantQuality
static const char * kIntronReads
static const char * kPilot
static const char * kFrom
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
int64_t Int8
8-byte (64-bit) signed integer
const IQueryParseUserObject * GetUserObject() const
Get user object.
void Parse(const char *query_str, ECase case_sense=eCaseInsensitive, ESyntaxCheck syntax_check=eSyntaxCheck, bool verbose=false, const TFunctionNames &functions=TFunctionNames(0), unsigned line=0, unsigned linePos=0)
Query parser front-end function.
vector< CQueryParseTree::TNode * > TArgVector
Vector for easy argument access.
const TNode * GetQueryTree() const
virtual bool ResolveIdentifier(const std::string &, bool &)
If query has an identifier, this will resolve it in an application-specific way.
void AddFunc(CQueryParseNode::EType func_type, CQueryFunctionBase *func)
Register function implementation.
void MakeArgVector(CQueryParseTree::TNode &qnode, TArgVector &args)
Created vector of arguments (translate sub-nodes to vector)
virtual void Evaluate(CQueryParseTree &qtree)
Run query tree evaluation.
@ eCaseInsensitive
Case insensitive parsing (AnD)
@ eNotSet
Produced by the (private) default constructor.
@ eFloatConst
Floating point const.
@ eIntConst
Integer const.
@ eBoolConst
Boolean (TRUE or FALSE)
@ eString
String ("free text")
@ eSyntaxCheck
Best possible check for errors.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StringToBool(const CTempString str)
Convert string to bool.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static bool MatchesMask(CTempString str, CTempString mask, ECase use_case=eCase)
Match "str" against the "mask".
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static const string BoolToString(bool value)
Convert bool to string.
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another 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.
@ eNocase
Case insensitive compare.
TNodeList::iterator TNodeList_I
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
unsigned int CountNodes(unsigned int depth=1, TCountNodes how=0) const
Count nodes of the tree of which this node is a root.
TNodeList_CI SubNodeBegin(void) const
Return first const iterator on subnode list.
bool IsLeaf() const
Report whether this is a leaf node.
TNodeList_CI SubNodeEnd(void) const
Return last const iterator on subnode list.
@ eTreeTraverse
Keep traversal.
double value_type
The numeric datatype used by the parser.
const GenericPointer< typename T::ValueType > T2 value
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Int4 delta(size_t dimension_, const Int4 *score_)