;
113 template<
classTLoader>
115: m_loader{
info.GetLoader() } {}
127CSeq_submit::GetTypeInfo(), CSeq_entry::GetTypeInfo(), CSeq_annot::GetTypeInfo(),
128CSeq_feat::GetTypeInfo(), CBioSource::GetTypeInfo(), CPubdesc::GetTypeInfo(),
129CBioseq_set::GetTypeInfo(), CBioseq::GetTypeInfo(), CSeqdesc::GetTypeInfo(),
136entry->SetSeq().SetInst().SetMol(objects::CSeq_inst::eMol_dna);
137entry->SetSeq().SetInst().SetRepr(objects::CSeq_inst::eRepr_raw);
138entry->SetSeq().SetInst().SetSeq_data().SetIupacna().Set(
"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA");
139entry->SetSeq().SetInst().SetLength(60);
142 id->SetLocal().SetStr(
"good");
143entry->SetSeq().SetId().push_back(
id);
146mdesc->SetMolinfo().SetBiomol(objects::CMolInfo::eBiomol_genomic);
147entry->SetSeq().SetDescr().Set().push_back(mdesc);
155mAppConfig(appConfig)
226 in.ReadClassMember(member);
247unique_ptr<CNcbiIstream> hold_stream;
250 if(!fname.empty()) {
252hold_stream = make_unique<CNcbiIfstream>(fname, ios::binary);
253InputStream = hold_stream.get();
272hold_stream.release();
273hold_stream.reset(decompress);
274InputStream = hold_stream.get();
277 format=
fg.GuessFormatAndContent(contentInfo);
280unique_ptr<CObjectIStream> objectStream;
286hold_stream.release();
300msgHandler.
Write();
307os <<
"Unable to read invalid ASN.1";
313os <<
": "<<
mpIstr->GetPosition();
316os <<
": unexpected end of file";
322os <<
": "+ p_exception->
ReportAll(0);
326 stringerrstr = os.str();
351 LOG_POST_XX(Corelib_App, 1,
"FAILURE: Record is not a batch Seq-submit, do not use -a u to process.");
374 LOG_POST_XX(Corelib_App, 1,
"FAILURE: Record is not a batch Bioseq-set, do not use -a t to process.");
445se->SetSet(*bioseqset);
482 for(
auto& se: ss->
SetData().SetEntrys() ) {
542 if(asninfo==
nullptr) {
544 if(content.size() == 1) {
545asninfo = *content.begin();
548 if(asninfo==
nullptr) {
555 autoobj_info =
mpIstr->Read(asninfo);
556serial.
Reset(
static_cast<CSerialObject*
>(obj_info.GetObjectPtr()));
566 stringasn_type = asninfo->
GetName();
567 boolunhandledType{
false};
571 if(asn_type ==
"Seq-submit") {
573}
else if(asn_type ==
"Seq-entry") {
575}
else if(asn_type ==
"Seq-annot") {
577}
else if(asn_type ==
"Seq-feat") {
579}
else if(asn_type ==
"BioSource") {
581}
else if(asn_type ==
"Pubdesc") {
583}
else if(asn_type ==
"Bioseq-set") {
585}
else if(asn_type ==
"Bioseq") {
587}
else if(asn_type ==
"Seqdesc") {
590unhandledType =
true;
596 stringerrstr = e.
GetMsg();
611 const string& loader_name,
618 if(!loader_name.empty())
625 if(scope->
Exists(seq_id_h)) {
638pSubmit->SetSub().Assign(*pSubmitBlock);
639pSubmit->SetData().SetEntrys().push_back(pEntry);
666 auto& reader = process.GetReader();
668 auto info= edit::CHugeAsnDataLoader::RegisterInObjectManager(
671CAutoRevoker autorevoker(
info);
676 if(
const auto& topIds = reader.GetTopIds(); !topIds.empty()) {
711 if(!process.ReadNextBlob())
714 if(process.GetReader().GetBioseqs().size() == 0) {
721 catch(
constedit::CHugeFileException& e) {
722 if(e.GetErrCode() == edit::CHugeFileException::eDuplicateSeqIds)
734 LOG_POST_XX(Corelib_App, 1,
"FAILURE: Unable to process invalid ASN.1 file "+ process.GetConstFile().m_filename);
750 const string& loader_name,
759_this->
ValidateAsync(loader_name, pSubmitBlock, seqid, msgHandler);
764 stringerrstr = e.
GetMsg();
777 auto& reader = process.GetReader();
793 autopSubmitBlock = reader.GetSubmitBlock();
794 for(
autoseqid : reader.GetTopIds())
796auto fut = mAppConfig.m_thread_pool2->launch(ValidateWorker, this, loader_name, pSubmitBlock, seqid, std::ref(msgHandler));
798val_queue.push_back(std::move(fut));
801val_queue.push_back({});
807 auto result= val_queue.pop_front();
814 autoexit_data =
result.get();
828 const string& loader_name,
829edit::CHugeFileProcess& process,
832 auto& reader = process.GetReader();
834 for(
autoseqid : reader.GetTopIds())
836 autopSubmitBlock = reader.GetSubmitBlock();
837 ValidateAsync(loader_name, pSubmitBlock, seqid, msgHandler);
865 if(asninfo == CBioseq_set::GetTypeInfo()) {
871 if(asninfo == CSeq_submit::GetTypeInfo()) {
872 const autocommandLineOptions =
m_Options;
886 LOG_POST_XX(Corelib_App, 1,
"FAILURE: Record is neither a Seq-submit nor Bioseq-set; do not use -batch to process.");
894unique_ptr<IMessageHandler> pMsgHandler;
902 result.mReported += pMsgHandler->GetNumReported();
914unique_ptr<edit::CHugeFileProcess> mpHugeFileProcess;
916 if(filename.empty())
919 autohuge_reader =
Ref(
newedit::CHugeAsnReader());
925mpHugeFileProcess.reset(
newedit::CHugeFileProcess(huge_reader.GetPointer()));
928asninfo = mpHugeFileProcess->GetFile().m_content;
931mpHugeFileProcess.reset();
937 mpIstr= mpHugeFileProcess->GetReader().MakeObjStream(0);
949 boolproceed =
true;
954 LOG_POST_XX(Corelib_App, 1,
"FAILURE: Unable to process invalid ASN.1 file "+ filename);
967 if(
mpIstr->EndOfData())
975 stringerrstr = e.
GetMsg();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eErr_SEQ_PKG_NoBioseqFound
@ eErr_GENERIC_InvalidAsn
@ eErr_GENERIC_DuplicateIDs
@ eErr_INTERNAL_Exception
CValidatorThreadPool * m_thread_pool1
unsigned int mNumInstances
void ProcessPubdesc(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
void ValidateBlobAsync(const string &loader_name, edit::CHugeFileProcess &process, IMessageHandler &msgHandler)
bool ValidateTraditionally(TTypeInfo asninfo, IMessageHandler &msgHandler)
void ValidateBlobSequential(const string &loader_name, edit::CHugeFileProcess &process, IMessageHandler &msgHandler)
void ReportReadFailure(const CException *p_exception, IMessageHandler &msgHandler)
void ProcessSeqAnnot(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
shared_ptr< SValidatorContext > m_pContext
static CThreadExitData ValidateWorker(CAsnvalThreadState *_this, const string &loader_name, CConstRef< CSubmit_block > pSubmitBlock, CConstRef< CSeq_id > seqid, IMessageHandler &msgHandler)
void ProcessBioSource(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
void ReadClassMember(CObjectIStream &in, const CObjectInfo::CMemberIterator &member, IMessageHandler &msgHandler)
std::list< CConstRef< CValidError > > m_eval
void ProcessSeqEntry(CSeq_entry &se, IMessageHandler &msgHandler)
CHugeFileValidator::TGlobalInfo m_GlobalInfo
void ProcessBioseq(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
CRef< CScope > BuildScope() const
bool ValidateBatchMode(TTypeInfo asninfo, IMessageHandler &msgHandler)
CAsnvalThreadState(const CAppConfig &, SValidatorContext::taxupdate_func_t taxon)
void ProcessBioseqset(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
void ProcessSeqSubmit(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
void ValidateOneHugeFile(edit::CHugeFileProcess &process, IMessageHandler &msgHandler)
CThreadExitData ValidateOneFile(const string &infilename, CNcbiOstream &ostr)
void ProcessSSMReleaseFile(IMessageHandler &msgHandler)
const CAppConfig & mAppConfig
void ProcessSeqFeat(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
unique_ptr< CObjectIStream > OpenFile(TTypeInfo &asn_info, const string &filename) const
void ProcessBSSReleaseFile(IMessageHandler &msgHandler)
std::atomic< size_t > m_Reported
void ValidateInput(TTypeInfo asninfo, IMessageHandler &msgHandler)
void ValidateAsync(const string &loader_name, CConstRef< CSubmit_block > pSubmitBlock, CConstRef< CSeq_id > seqid, IMessageHandler &msgHandler) const
void ProcessSeqDesc(CRef< CSerialObject > serial, IMessageHandler &msgHandler)
void ValidateOneHugeBlob(edit::CHugeFileProcess &process, IMessageHandler &msgHandler)
CRef< CObjectManager > m_ObjMgr
unique_ptr< CObjectIStream > mpIstr
Wraps CFormatGuess, and if CFormatGuess's result is Unknown, it tries every file reader until one wor...
CFormatGuess::EFormat GuessFormatAndContent(CFileContentInfo &contentInfo)
void SetRecognizedGenbankTypes(const set< TTypeInfo > &recognizedGenbankTypes)
EFormat
The formats are checked in the same order as declared here.
@ eBZip2
bzip2 compressed file
@ eBinaryASN
Binary ASN.1.
@ eLzo
lzo compressed file
@ eGZip
GNU zip compressed file.
void ReportGlobalErrors(const TGlobalInfo &globalInfo, IValidError &errors) const
void UpdateValidatorContext(TGlobalInfo &globalInfo, SValidatorContext &context) const
static void RegisterReaderHooks(CObjectIStream &objStream, SGlobalInfo &m_GlobalInfo)
void ReportPostErrors(const SValidatorContext &context, IValidError &errors) const
Reading (iterating through) elements of containers (SET OF, SEQUENCE OF).
Root class for all serialization exceptions.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
static void SetSuppressedCodes(const CUser_object &user, TCodes &errCodes)
CRef< CValidError > Validate(const CSeq_entry &se, CScope *scope=nullptr, Uint4 options=0)
virtual bool InvokeWrite() const =0
void AddValidErrItem(EDiagSev sev, unsigned int ec, const string &msg, const string &desc, const CSerialObject &obj, const string &acc, const int ver, const string &location=kEmptyStr, const int seq_offset=0) override
virtual void RequestStop()=0
auto launch(_Function &&f, TArgs &&...args)
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const struct type types[]
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
EMethod
Compression/decompression methods.
@ eNone
no compression method (copy "as is")
@ eGZipFile
.gz file (including concatenated files)
@ fDefault
Use algorithm-specific defaults.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST_XX(error_name, err_subcode, message)
@ eDiag_Error
Error message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
void Error(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#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.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
@ eEOF
Unexpected end-of-file.
void ResetHistory(EActionIfLocked action=eKeepIfLocked)
Clean all unused TSEs from the scope's cache and release the memory.
void AddDataLoader(const string &loader_name, TPriority pri=kPriority_Default)
Add data loader by name.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
CSeq_annot_Handle AddSeq_annot(CSeq_annot &annot, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add Seq-annot, return its CSeq_annot_Handle.
void RemoveTopLevelSeqEntry(const CTSE_Handle &entry)
Revoke TSE previously added using AddTopLevelSeqEntry() or AddBioseq().
bool RevokeDataLoader(CDataLoader &loader)
Revoke previously registered data loader.
bool Exists(const CSeq_id &id)
Check existence of sequence with this id.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
const TId & GetId(void) const
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
@ eNocase
Case insensitive compare.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
@ eStart
Start timer immediately after creating.
const string & GetName(void) const
Get name of this type.
ENcbiOwnership
Ownership relations between objects.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
bool IsEntrys(void) const
Check if variant Entrys is selected.
Definition of all error codes used in corelib (xncbi.lib).
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
Magic spell ;-) needed for some weird compilers... very empiric.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
std::istream & in(std::istream &in_, double &x_)
void SetLocalReadHook(const CObjectTypeInfo &obj_type_info, CObjectIStream &ostr, _Func _func)
C++ I/O stream wrappers to compress/decompress data on-the-fly.
function< CRef< CTaxon3_reply >(const vector< CRef< COrg_ref > > &list)> taxupdate_func_t
const set< TTypeInfo > s_known_types
static CRef< objects::CSeq_entry > s_BuildGoodSeq()
static void s_StartWrite(IMessageHandler &msgHandler)
CFileContentInfoGenbank mInfoGenbank
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