constexpr
size_tnum_test_cases =
static_cast<size_t>(eTestNames::max_test_names);
51 using TArray= std::array<const CDiscrepancyCaseProps**, num_test_cases>;
59 #ifdef NCBI_COMPILER_ANY_CLANG 60 # pragma GCC diagnostic push 61 # pragma GCC diagnostic ignored "-Wundefined-var-template" 64 #ifdef NCBI_COMPILER_ANY_CLANG 65 # pragma GCC diagnostic pop 69 template<std::size_t... I>
72 return{xGetProps<I>()...};
79 returnxAssembleArray(std::make_index_sequence<num_test_cases>{});
83 staticconstexpr
TTestNamesSetautofix_names{DISC_AUTOFIX_TESTNAMES};
87 static constTAliasMap& GetAliasMap();
99 for(
autoalias_name: *aliases) {
100s_alias_map[alias_name] =
static_cast<eTestNames
>(
i);
115 if(name < eTestNames::max_test_names) {
117 if(prop_ref && *prop_ref) {
122 throwstd::out_of_range(
"eTestNames");
125std::ostream&
operator<<(std::ostream&
str, NDiscrepancy::eTestNames name)
135 if(props.
sName== name)
136 return static_cast<eTestNames
>(
i);
147 returneTestNames::notset;
157vector<string_view> V;
160V.reserve(alias_names->size());
161 for(
autorec: *alias_names)
194 for(
autotn:
tests) {
210 if(props->sName[0] !=
'_'&& (props->Group & group) == group) {
211 names.set(props->Name);
221 auto& node =
m_Map[name];
231 if(unique &&
hash.find(&obj) !=
hash.end()) {
241 for(
auto& it : objs) {
242 Add(list,
hash, *it, unique);
254<<
":"<<
m_Objs.size() <<
":"<< other.
m_Objs.size()
259 for(
autoit: other.
m_Map) {
260 auto& rec =
m_Map[it.first];
262rec->Merge(*it.second);
303 boolautofix =
false;
306 for(
const auto& it :
m_Map) {
309severity = it.second->m_Severity;
311 if(severity < sub->GetSeverity()) {
321 for(
auto& ob : details) {
322 Add(objs,
hash, *ob, unique);
326 for(
auto& ob : objs) {
327 if(ob->CanAutofix()) {
337 str.erase(
n, k -
n+ 2);
367 size_t n=
str.find(
"[n]");
368 if(
n!= string::npos) {
371 else if((
n=
str.find(
"[n/2]")) != string::npos) {
375 if(
n!= string::npos) {
376 if((
n=
str.find(
"[s]")) != string::npos) {
377unit =
str.substr(0,
n);
379 else if(0 ==
str.find(
"CDS ")) {
382 else if((
n=
str.find(
"s ")) != string::npos) {
383unit =
str.substr(0,
n);
387item->m_Autofix = autofix;
388item->m_Severity = severity;
389item->m_Ext =
m_Ext;
406 for(
const auto& rep : items) {
408 for(
auto& obj : objs) {
427 for(
const auto& it : report_objs) {
437 autoref = disc_obj.
RefNode();
447disc_obj->
m_Case= disc_core;
449disc_obj->
m_Fix= ref;
471 stringss =
"EXCEPTION caught: "; ss += e.
what();
498 str.erase(
n, k -
n+ 2);
521 #define REGISTER_DISCREPANCY_TYPE(type) \ 522 if (test->GetType() == eTestTypes::type) { \ 523 auto* p = test.GetPointer(); \ 524 m_All_##type.push_back(p); \ 543 if(!fname.empty()) {
559 if(pTypeInfo == CBioseq::GetTypeInfo()) {
564 if(pTypeInfo == CBioseq_set::GetTypeInfo()) {
569 if(pTypeInfo == CSeq_entry::GetTypeInfo()) {
574 if(pTypeInfo == CSeq_submit::GetTypeInfo()) {
580 "Unsupported type - "+ pTypeInfo->GetName());
587 auto&
test= *tt.second;
594 unsignedseverity = 0;
596 auto&
test= *tt.second;
598 for(
const auto& rep :
test.GetReport()) {
599 unsignedsev = rep->GetSeverity();
600severity = sev > severity ? sev : severity;
617 for(
autoit: other_ptr.m_Tests) {
618 if(it.second && !it.second->Empty())
620 auto& current =
m_Tests[it.first];
621 if(current && !current->Empty())
622current->Merge(*it.second);
631 voidCDiscrepancyContext::TestString(
const string&
str)
649 for(
const auto& it :
m_List) {
651 for(
const auto& tt :
tmp) {
657 for(
const auto& tt :
tmp) {
668 for(
const auto& tt :
out) {
670 if(!details.empty() || tt->GetCount() > 0) {
673 for(
auto& ob : details) {
676 if(tt->CanAutofix()) {
677di->m_Autofix =
true;
682 else if(tt->IsFatal()) {
693 for(
const auto& it :
tests) {
695 for(
const auto& it2 : list) {
712 test->Call(*
this);
715 test->Call(*
this);
718 test->Call(*
this);
722 test->Call(*
this);
725 test->Call(*
this);
730 test->Call(*
this);
736 test->Call(*
this);
739 test->Call(*
this);
742 test->Call(*
this);
746 test->Call(*
this);
749 test->Call(*
this);
754 test->Call(*
this);
760 test->Call(*
this);
764 test->Call(*
this);
770 test->Call(*
this);
779<<
" are not yet implemented...");
794 size_tbrk =
m_Text.find(
'\n');
795 returnbrk == string::npos ?
m_Text:
m_Text.substr(0, brk) +
" "+
m_Text.substr(brk + 1);
800 return "np|"+ (
m_Text.empty() ?
"(EMPTY BIOSEQ-SET)":
m_Text);
802 return "ss|"+ (
m_Text.empty() ?
"(EMPTY BIOSEQ-SET)":
m_Text);
804 return m_Text.empty() ?
"BioseqSet":
"Set containing "+
m_Text;
808 return m_Text.empty() ?
"Cit-sub":
"Cit-sub for "+
m_Text;
827 if(node->m_Type ==
eBioseq) {
828 size_tbrk = node->m_Text.find(
'\n');
829 returnbrk == string::npos ?
kEmptyStr: node->m_Text.substr(0, brk);
840vector<const CRefNode*>
A,
B;
844reverse(
A.begin(),
A.end());
848reverse(
B.begin(),
B.end());
849 size_t n=
min(
A.size(),
B.size());
850 for(
size_t i= 0;
i<
n;
i++) {
851 if(
A[
i] !=
B[
i]) {
864 if(
A[
i]->m_Index !=
B[
i]->m_Index) {
865 return A[
i]->m_Index <
B[
i]->m_Index;
869 return A.size() ==
B.size() ? &*
a< &*
b:
A.size() <
B.size();
878 for(
const auto& tst :
m_Tests) {
880 for(
const auto& it : list) {
881 for(
auto& obj : it->GetDetails()) {
882 if(obj->CanAutofix()) {
883tofix.push_back(obj);
897retval[rec.first] = rec.second;
static constexpr auto xGetProps()
static const TAliasMap & GetAliasMap()
static const TTestNamesSet & GetAutofixTests()
static constexpr TArray xAssembleArray(std::index_sequence< I... >)
static const CDiscrepancyCaseProps & GetProps(eTestNames name)
std::array< const CDiscrepancyCaseProps **, num_test_cases > TArray
static constexpr TArray PopulateTests()
vector< CDiscrepancyCore * > m_All_PUBDESC
vector< CDiscrepancyCore * > m_All_SUBMIT
vector< CDiscrepancyCore * > m_All_DESC
TDiscrepancyCaseMap GetTests() const override
void AddTest(eTestNames name) override
ct::const_bitset< static_cast< size_t >eTestTypes::max_num_types), eTestTypes > m_Enabled
TDiscrepancyCoreMap m_Tests
void Push(const CSerialObject &root, const string &fname) override
CRef< CParseNode > m_RootNode
void ParseObject(const CBioseq &root)
vector< CDiscrepancyCore * > m_All_SEQ_SET
CRef< CParseNode > m_CurrentNode
vector< CDiscrepancyCore * > m_All_BIOSRC
unsigned Summarize() override
map< string, size_t > Autofix() override
CSeq_feat_run GetAllFeat()
static string TypeName(EObjType n)
void CollectFeature(const CSeq_feat &feat)
map< const CRefNode *, CParseNode * > m_NodeMap
static bool CompareRefs(CRef< CReportObj > a, CRef< CReportObj > b)
vector< CDiscrepancyCore * > m_All_FEAT
vector< CDiscrepancyCore * > m_All_STRING
vector< CDiscrepancyCore * > m_All_AUTHORS
static bool IsSeqSet(EObjType n)
vector< CDiscrepancyCore * > m_All_SEQUENCE
void Merge(CDiscrepancyCore &other)
virtual void Visit(CDiscrepancyContext &context)=0
TReportObjectList GetObjects() const override
TReportItemList m_ReportItems
const TReportItemList & GetReport() const override
void Call(CDiscrepancyContext &context)
vector< CRef< CDiscrepancyGroup > > m_List
TReportItemList Collect(TDiscrepancyCaseMap &tests, bool all=true) const
CDiscrepancyGroup(const string &name="", const string &test="")
TReportObjectList & SetDetails()
void SetAutofix(bool value)
static CDiscrepancyObject * CreateInternal(CDiscrepancyContext::CRefNode *ref, CRef< CDiscrepancyCore > disc_core, bool autofix)
CRef< CDiscrepancyContext::CRefNode > m_Ref
CReportObj * Clone(bool fix, CConstRef< CObject > data) const
CConstRef< CObject > m_More
CRef< CDiscrepancyContext::CRefNode > m_Fix
CRef< CDiscrepancyCore > m_Case
CDiscrepancyObject(CDiscrepancyContext::CRefNode *ref, CDiscrepancyContext::CRefNode *fix=nullptr, const CObject *more=nullptr)
void Summarize() override
TDiscrepancyCoreMap m_Tests
void Merge(CDiscrepancyProduct &other) override
static CRef< CDiscrepancySet > New(objects::CScope &scope)
static std::atomic< bool > m_Gui
static string Format(const string &str, unsigned int count)
static CRef< CReportItem > Create(const string &test_name, const string &name, const CReportObj &main_obj, const TReportObjectList &report_objs, bool autofix=false)
virtual vector< CRef< CReportItem > > GetSubitems() const =0
virtual string GetUnit() const =0
virtual ESeverity GetSeverity() const =0
virtual TReportObjectList GetDetails() const =0
virtual bool CanAutofix() const =0
static void Add(TReportObjectList &list, TReportObjectSet &hash, CReportObj &obj, bool unique=true)
CReportNode & Merge(CReportNode &other)
CReportNode & operator[](const string &name)
CRef< CReportItem > Export(CDiscrepancyCore &test, bool unique=true) const
CReportItem::ESeverity m_Severity
void Copy(CRef< CReportNode > other)
static CRef< CReportObj > Create(CRef< CDiscrepancyCore > disc_core, const CReportObj &obj, bool autofix)
Base class for all serializable objects.
const_iterator begin() const
const_iterator find(const key_type &key) const
vector< CRef< CReportItem > > TReportItemList
vector< CRef< CReportObj > > TReportObjectList
eTestNames GetDiscrepancyCaseName(string_view name)
string_view GetDiscrepancyDescr(string_view name)
#define REGISTER_DISCREPANCY_TYPE(type)
TGroup GetDiscrepancyGroup(eTestNames name)
vector< string > GetDiscrepancyNames(TGroup group)
static CCaseRegistry::TAliasMap xPopulateAliases()
vector< string_view > GetDiscrepancyAliases(eTestNames name)
TTestNamesSet GetDiscrepancyTests(TGroup group)
std::ostream & operator<<(std::ostream &str, NDiscrepancy::eTestNames name)
static constexpr CCaseRegistry::TArray g_test_registry
std::ofstream out("events_result.xml")
main entry point for tests
bool Empty(const CNcbiOstrstream &src)
static const struct name_t names[]
#define test(a, b, c, d, e)
static const char * str(char *buf, int n)
static DbTestEntry * tests
static char test_name[128]
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
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 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 const char label[]
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 smart and slim</td> n<td> orig</td> n</tr> n<tr> n<td> last_modified</td> n<td> optional</td> n<td> Integer</td> n<td class=\"description\"> The blob last modification If provided then the exact match will be requested with n the Cassandra storage corresponding field value</td> n<td> Positive integer Not provided means that the most recent match will be selected</td> n<td></td> n</tr> n<tr> n<td> use_cache</td> n<td> optional</td> n<td> String</td> n<td class=\"description\"> The option controls if the Cassandra LMDB cache and or database should be used It n affects the seq id resolution step and the blob properties lookup step The following n options are BIOSEQ_INFO and BLOB_PROP at all
constexpr bool empty(list< Ts... >) noexcept
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
C++ I/O stream wrappers to compress/decompress data on-the-fly.
const std::initializer_list< const char * > * Aliases
string GetBioseqLabel() const
CRef< CRefNode > m_Parent
static CS_CONTEXT * context
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4