191 while (!line_reader.
AtEOF());
208 if (header.empty()) {
209 header = default_header;
214 if (header == CSeq_submit::GetTypeInfo()->GetName()) {
221 else if (header == CSeq_entry::GetTypeInfo()->GetName()) {
225 else if (header == CBioseq_set::GetTypeInfo()->GetName()) {
229 else if (header == CBioseq::GetTypeInfo()->GetName()) {
261 auto handle =
m_Scope->AddTopLevelSeqEntry(*se);
293 m_Scope->ResetDataAndHistory();
351 else if (root.
IsSeq()) {
424 if (desc->IsMolinfo()) {
427 else if (desc->IsSource()) {
430 else if (desc->IsTitle()) {
436 for (
const auto& annot : bioseq.
GetAnnot()) {
437 if (annot->IsFtable()) {
438 for (
const auto& feat : annot->GetData().GetFtable()) {
453 label =
n->m_Ref->GetText();
471 if (desc->IsMolinfo()) {
474 else if (desc->IsSource()) {
477 else if (desc->IsTitle()) {
483 for (
const auto& annot : seqset.
GetAnnot()) {
484 if (annot->IsFtable()) {
485 for (
const auto& feat : annot->GetData().GetFtable()) {
549 for (
auto& feat :
ftable) {
550 if (&*feat == &old_feat) {
551 feat.Reset(&new_feat);
691 unique_ptr<CNcbiIstream> InputStream(
new CNcbiIfstream(fname, ios::binary));
707 unique_ptr<CObjectIStream> objectStream;
724 if (!tofix.empty()) {
726 bool in_file =
false;
728 if (node->m_Type ==
eFile) in_file =
true;
731 for (
auto& fix : tofix) {
741 vector<vector<CDiscrepancyObject*>> all_fixes;
743 for (
auto& fix : tofix) {
747 if (node->m_Type ==
eFile) {
752 if (path != current_path) {
754 vector<CDiscrepancyObject*> fixes;
755 all_fixes.push_back(fixes);
757 all_fixes.back().push_back(&obj);
759 for (
auto& fix : all_fixes) {
770 if (node->m_Type ==
eFile) {
775 bool compressed =
false;
777 cout <<
"Autofixing " << path <<
"\n";
779 size_t dot = path.find_last_of(
'.');
780 if (dot != string::npos) {
781 size_t slash = path.find_last_of(
"/\\");
782 if (slash != string::npos && slash >= dot) {
786 string fixed_path = !compressed && (dot != string::npos) ? path.substr(0, dot) +
".autofix" + path.substr(dot) : path +
".autofix.sqn";
788 string header =
in->ReadFileHeader();
804 if (header.empty()) {
805 header = default_header;
811 if (header == CSeq_submit::GetTypeInfo()->GetName()) {
813 copier.
Copy(CSeq_submit::GetTypeInfo());
816 else if (header == CSeq_entry::GetTypeInfo()->GetName()) {
817 copier.
Copy(CSeq_entry::GetTypeInfo());
819 else if (header == CBioseq_set::GetTypeInfo()->GetName()) {
820 copier.
Copy(CBioseq_set::GetTypeInfo());
822 else if (header == CBioseq::GetTypeInfo()->GetName()) {
823 copier.
Copy(CBioseq::GetTypeInfo());
829 if (
in->EndOfData()) {
836 header =
in->ReadFileHeader();
837 in->SetStreamPos(position);
849 if (
A->m_Index !=
B->m_Index) {
881 if (
A->m_Index !=
B->m_Index) {
912 if (
A->m_Index !=
B->m_Index) {
943 if (
A->m_Index !=
B->m_Index) {
974 if (
A->m_Index !=
B->m_Index) {
1057 for (
auto& annot : bss->
GetAnnot()) {
1058 if (annot->IsFtable()) {
1059 for (
auto& feat : annot->GetData().GetFtable()) {
1098 for (
auto& annot : bs->
GetAnnot()) {
1099 if (annot->IsFtable()) {
1100 for (
auto& feat : annot->GetData().GetFtable()) {
@Auth_list.hpp User-defined methods of the data storage class.
CCopyHook_Bioseq_set(CDiscrepancyContext *context)
CDiscrepancyContext * m_Context
void CopyObject(CObjectStreamCopier &copier, const CObjectTypeInfo &passed_info) override
CDiscrepancyContext * m_Context
void CopyObject(CObjectStreamCopier &copier, const CObjectTypeInfo &passed_info) override
CCopyHook_Bioseq(CDiscrepancyContext *context)
void CopyObject(CObjectStreamCopier &copier, const CObjectTypeInfo &passed_info) override
CCopyHook_Seq_annot(CDiscrepancyContext *context)
CDiscrepancyContext * m_Context
CDiscrepancyContext * m_Context
void CopyObject(CObjectStreamCopier &copier, const CObjectTypeInfo &passed_info) override
CCopyHook_Seq_descr(CDiscrepancyContext *context)
void CopyObject(CObjectStreamCopier &copier, const CObjectTypeInfo &passed_info) override
CCopyHook_Submit_block(CDiscrepancyContext *context)
CDiscrepancyContext * m_Context
Copy hook for a standalone object.
friend class CReadHook_Bioseq_set
BIG FILE.
CRef< CBioseq > m_AF_Bioseq
friend class CReadHook_Bioseq_set_class
bool CanFixSubmit_block()
vector< CDiscrepancyObject * > * m_Fixes
CRef< CSeq_descr > m_AF_Seq_descr
void PopulateSeqSet(CParseNode &node)
CRef< objects::CScope > m_Scope
void Populate(CParseNode &node)
CParseNode * FindNode(const CRefNode &obj)
bool CanFixDesc(CRefNode &refnode)
CRef< CBioseq_set > m_AF_Bioseq_set
friend class CCopyHook_Seq_annot
CRef< CParseNode > m_RootNode
void AutofixFile(vector< CDiscrepancyObject * > &fixes, const string &default_header)
void ParseObject(const CBioseq &root)
CRef< feature::CFeatTree > m_FeatTree
friend class CCopyHook_Seq_descr
void ReplaceSeq_feat(CReportObj &obj, const CSeq_feat &old_feat, CSeq_feat &new_feat, bool alt=false)
CRef< CParseNode > m_CurrentNode
bool InGenProdSet() const
const CSerialObject * FindObject(CReportObj &obj, bool alt=false) override
objects::CScope & GetScope() const
map< string, size_t > Autofix() override
friend class CCopyHook_Bioseq_set
friend class CCopyHook_Bioseq
bool CanFixFeat(CRefNode &refnode)
void BuildSeqSummary(const CBioseq &bs, CSeqSummary &summary)
void PopulateSubmit(CParseNode &node)
void PopulateBioseq(CParseNode &node)
void Extend(CParseNode &node, CObjectIStream &stream)
friend class CReadHook_Bioseq
map< const CRefNode *, CParseNode * > m_NodeMap
friend class CCopyHook_Submit_block
CRef< CSeq_annot > m_AF_Seq_annot
static bool InNucProtSet(const CParseNode *node)
static bool CompareRefs(CRef< CReportObj > a, CRef< CReportObj > b)
void ReplaceObject(CReportObj &obj, CSerialObject *, bool alt=false)
void ParseAll(CParseNode &node)
CRef< CSubmit_block > m_AF_Submit_block
void ParseStrings(const string &fname) override
void ParseStream(CObjectIStream &stream, const string &fname, bool skip, const string &default_header=kEmptyStr) override
static bool IsSeqSet(EObjType n)
void AutofixSubmit_block()
virtual CRef< CAutofixReport > Autofix(CDiscrepancyObject *obj, CDiscrepancyContext &context) const =0
CRef< CDiscrepancyContext::CRefNode > m_Ref
CRef< CDiscrepancyContext::CRefNode > m_Fix
CRef< CDiscrepancyCore > m_Case
Read hook for data member of a containing object (eg, SEQUENCE)
void ReadClassMember(CObjectIStream &stream, const CObjectInfoMI &passed_info) override
This method will be called at approriate time when the object of requested type is to be read.
CDiscrepancyContext * m_Context
CReadHook_Bioseq_set_class(CDiscrepancyContext *context)
CReadHook_Bioseq_set(CDiscrepancyContext *context)
void ReadObject(CObjectIStream &stream, const CObjectInfo &passed_info) override
This method will be called at approriate time when the object of requested type is to be read.
CDiscrepancyContext * m_Context
CReadHook_Bioseq(CDiscrepancyContext *context)
CDiscrepancyContext * m_Context
void ReadObject(CObjectIStream &stream, const CObjectInfo &passed_info) override
This method will be called at approriate time when the object of requested type is to be read.
Read hook for a standalone object.
bool IsFtable(void) const
@Seq_descr.hpp User-defined methods of the data storage class.
namespace ncbi::objects::
Base class for all serializable objects.
Simple implementation of ILineReader for i(o)streams.
vector< CRef< CReportObj > > TReportObjectList
unique_ptr< CObjectIStream > OpenUncompressedStream(const string &fname, bool &compressed)
std::ofstream out("events_result.xml")
main entry point for tests
@ eTakeOwnership
An object can take ownership of another.
EMethod
Compression/decompression methods.
@ eNone
no compression method (copy "as is")
@ eGZipFile
.gz file (including concatenated files)
@ fDefault
Use algorithm-specific defaults.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
void DefaultRead(CObjectIStream &in, const CObjectInfoMI &object)
void Read(const CObjectInfo &object)
Read object of know type.
void DefaultRead(CObjectIStream &in, const CObjectInfo &object)
Default read.
void SetLocalReadHook(CObjectIStream &stream, CReadObjectHook *hook) const
Set local (for the specified stream) read hook.
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
virtual bool EndOfData(void)
Check if there is still some meaningful data that can be read; in text streams this function will ski...
void ReadObject(const CObjectInfo &object)
Read child object.
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
CMemberIterator FindMember(const string &memberName) const
Find class member by its name.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
virtual string ReadFileHeader(void)
Read file header.
CObjectInfo GetMember(void) const
Get class member data.
void SetStreamPos(CNcbiStreampos pos)
Set the current read position in underlying input stream This is the same as istream::seekg()
void WriteObject(const CConstObjectInfo &object)
CNcbiStreampos GetStreamPos(void) const
Get the current stream position.
TTypeInfo GetTypeInfo(void) const
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CObjectIStream & In(void) const
void DefaultCopy(CObjectStreamCopier &copier, const CObjectTypeInfo &type)
void SetLocalCopyHook(CObjectStreamCopier &stream, CCopyObjectHook *hook) const
Set local (for the specified stream) copy hook.
void DefaultSkip(CObjectIStream &in, const CObjectTypeInfo &object)
Default skip.
CObjectOStream & Out(void) const
void SetLocalReadHook(CObjectIStream &stream, CReadClassMemberHook *hook) const
void Copy(const CObjectTypeInfo &type)
Copy data.
@ eDelayBufferPolicyAlwaysParse
Parse always.
void Replace(const CSeq_feat &new_feat) const
Replace the feature with new Seq-feat object.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
TObjectType * GetPointerOrNull(void) const THROWS_NONE
Get pointer value.
#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.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
IO_PREFIX::streampos CNcbiStreampos
Portable alias for streampos.
static const char label[]
const TAuthors & GetAuthors(void) const
Get the Authors member data.
bool CanGetAuthors(void) const
Check if it is safe to call GetAuthors method.
const TSeq & GetSeq(void) const
Get the variant data.
bool IsSetClass(void) const
Check if a value has been assigned to Class data member.
const TDescr & GetDescr(void) const
Get the Descr member data.
bool CanGetDescr(void) const
Check if it is safe to call GetDescr method.
TSet & SetSet(void)
Select the variant.
bool CanGetSeq_set(void) const
Check if it is safe to call GetSeq_set method.
TClass GetClass(void) const
Get the Class member data.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSetAnnot(void) const
Check if a value has been assigned to Annot data member.
bool IsSet(void) const
Check if variant Set is selected.
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
const TAnnot & GetAnnot(void) const
Get the Annot member data.
TSeq & SetSeq(void)
Select the variant.
@ eClass_pop_set
population study
@ eClass_phy_set
phylogenetic study
@ eClass_mut_set
set of mutations
@ eClass_eco_set
ecological sample study
@ eClass_nuc_prot
nuc acid and coded proteins
@ eClass_gen_prod_set
genomic products, chrom+mRNA+protein
@ eClass_segset
segmented sequence + parts
@ eClass_small_genome_set
viral segments or mitochondrial minicircles
void SetData(TData &value)
Assign a value to Data data member.
bool CanGet(void) const
Check if it is safe to call Get method.
bool IsSetAnnot(void) const
Check if a value has been assigned to Annot data member.
const TAnnot & GetAnnot(void) const
Get the Annot member data.
const Tdata & Get(void) const
Get the member data.
bool CanGetDescr(void) const
Check if it is safe to call GetDescr method.
const TFtable & GetFtable(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TDescr & GetDescr(void) const
Get the Descr member data.
const TCit & GetCit(void) const
Get the Cit member data.
const TEntrys & GetEntrys(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TSub & GetSub(void) const
Get the Sub member data.
bool IsSetSub(void) const
Check if a value has been assigned to Sub data member.
bool IsEntrys(void) const
Check if variant Entrys is selected.
bool IsSetCit(void) const
citation for this submission Check if a value has been assigned to Cit data member.
bool CanGetData(void) const
Check if it is safe to call GetData method.
Lightweight interface for getting lines of data with minimal memory copying.
constexpr auto sort(_Init &&init)
std::istream & in(std::istream &in_, double &x_)
C++ I/O stream wrappers to compress/decompress data on-the-fly.
CConstRef< CSeqdesc > m_Molinfo
CParseNode & AddDescriptor(const CSeqdesc &seqdesc)
CConstRef< CSeqdesc > m_Title
vector< CRef< CParseNode > > m_Children
vector< CRef< CParseNode > > m_Features
vector< CRef< CParseNode > > m_Descriptors
CConstRef< CSerialObject > m_Obj
CParseNode & AddFeature(const CSeq_feat &feat)
CConstRef< CSeqdesc > m_Biosource
map< const CAuth_list *, CParseNode * > m_AuthorMap
shared_ptr< CSeqSummary > m_BioseqSummary
vector< const CAuth_list * > m_Authors
CRef< CRefNode > m_Parent
static CS_CONTEXT * context