arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
92 "Demonstration of huge file readers",
96arg_desc->AddFlag(
"rw1848",
"Testing RW-1848");
98arg_desc->AddFlag(
"traditional",
"Open file in traditional mode");
105 stringfilename =
GetArgs()[
"i"].AsString();
106std::cerr <<
"Opening "<< filename << std::endl;
108 if(
GetArgs()[
"traditional"]) {
112edit::CHugeFileProcess huge;
127auto entry = Ref(new CSeq_entry);
128entry->SetSet().SetClass(CBioseq_set::eClass_genbank);
129entry->SetSet().SetSeq_set();
134 auto info= edit::CHugeAsnDataLoader::RegisterInObjectManager(
154scope->AddDataLoader(
context.m_loader_name);
162 autotop_seh = edit::CHugeFileProcess::GetTopLevelEntry(bh);
163 autoentry = top_seh.GetCompleteSeq_entry();
168 autolocation_id = (**feat).GetLocation().GetId();
170 boolgood_id =
false;
171 for(
autoseqid : bh.
GetId()) {
178std::cerr <<
" misplaced feature:"<< location_id->AsFastaString() <<
"\n";
181std::cerr <<
" mixed location\n";
188 if(idlist.size() < 2)
189 throwstd::runtime_error(
"Too little dataset");
194 auto& id1 = **(idlist.begin());
195 auto& id2 = **(++idlist.begin());
203std::cout <<
"Reading "<< idlist.size() <<
" records"<< std::endl;
211 outfile.exceptions(ios::failbit | ios::badbit);
225 autoid_it = idlist.begin();
226 for(
size_t i=0;
i<100 &&
i<idlist.size(); ++
i)
228std::cout <<
" "<< (**id_it).AsFastaString() << std::endl;
241 for(
autoit: idlist)
247<< (*it).AsFastaString()
248<<
":"<< scope->GetSequenceLength(*it)
249<<
":"<< scope->GetSequenceType(*it)
250<<
":"<< scope->GetTaxId(*it)
251<<
":"<< scope->GetLabel(*it);
275scope->ResetHistory();
290std::list<CBioseq_Handle> modified_records;
292 for(
auto id: idlist)
298 if(50 <=
i&&
i< 100) {
302modified_records.push_back(beh);
330scope->ResetHistory();
340 for(
auto id: idlist)
384 for(
auto id: idlist)
413scope->ResetHistory();
424orig_feat.
Reset(&(*cds_it->GetSeq_feat()));
428cout <<
"Orig seqfeat handle was found"<< endl;
434new_gene->
Assign(*old_gene);
448cout <<
"Replaced the old gene with the new one "<< endl;
452 autoffh = cds_it->GetSeq_feat_Handle();
454cout <<
"Works if handle is obtained from the iterator!"<< endl;
461cout <<
"New fh was found!"<< endl;
473 autoit = idlist.begin();
476 structprocessing_token
489 autopull_next = [
this, &scope, &index, &it, &idlist] (processing_token& token) ->
bool 492scope->ResetHistory();
494 if(it == idlist.end())
498token.m_index = index;
501token.m_bh = scope->GetBioseqHandle(**it);
511 autoprocess_func = [
this](processing_token& token)
514 if(50 <= token.m_index && token.m_index < 100) {
523token.m_seh = token.m_bh.GetParentEntry();
530writer.
WriteAsyncST(top_object, pull_next, process_func);
557orig_feat.
Reset(&(*cds_it->GetSeq_feat()));
561cout <<
"Orig seqfeat handle was found"<< endl;
567new_gene->
Assign(*old_gene);
579cout <<
"Replaced the old gene with the new one! "<< endl;
584 autoffh = cds_it->GetSeq_feat_Handle();
586cout <<
"It works if handle is obtained from the iterator!"<< endl;
592cout <<
"New fh was found!"<< endl;
599 int main(
intargc,
const char* argv[])
void WriteAsyncST(CConstRef< CSerialObject > topobject, TPullNextFunction pull_next_token, TProcessFunction process_func={}, TProcessFunction chain_func={})
void PushNextEntry(CConstRef< CSeq_entry > entry)
void StartWriter(CConstRef< CSerialObject > topobject)
void ProcessHugeSeqEntry(CSeq_entry_Handle seh) const
CConstRef< CSeq_entry > m_top_entry
void x_ShowSeqSizes(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist) const
void x_ReadAndWritePush(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist, CObjectOStream *output) const
CConstRef< CSerialObject > x_PopulateTopObject() const
void x_TestRW1848(CBioseq_Handle bh) const
int Run()
Run the application.
void x_ShowIds(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist) const
CRef< CScope > x_PopulateScope(TAppContext &context) const
void x_RunDemo(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist) const
void Init()
Initialize the application.
bool x_ModifyBioSeq(CBioseq_EditHandle beh) const
void x_ReadAndWritePull(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist, CObjectOStream *output) const
void x_ReadTwoScopes(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist) const
int x_ProcessFileTraditionally() const
void x_AddUserObjects(TAppContext &context, const std::list< CConstRef< CSeq_id >> &idlist, const string filename) const
CSeq_feat_EditHandle â.
namespace ncbi::objects::
static SQLCHAR output[256]
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ eInputFile
Name of file (must exist and be readable)
@ eOutputFile
Name of file (must be writable)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
static string ConvertToOSPath(const string &path)
Convert "path" on any OS to the current OS-dependent path.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
const string AsFastaString(void) const
string AsString(void) const
@ e_YES
SeqIds compared, but are different.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
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...
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
bool RevokeDataLoader(CDataLoader &loader)
Revoke previously registered data loader.
@ eGetBioseq_Loaded
Search in all loaded TSEs in the scope.
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to seq-annot for this feature.
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CSeq_id_Handle GetAccessSeq_id_Handle(void) const
Get any CSeq_id_Handle handle that can be used to access this bioseq Use GetSeq_id_Handle() if it's n...
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CSeq_entry_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
void Reset(void)
Reset handle and make it not to point to any bioseq.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
TMol GetSequenceType(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeq_annot_EditHandle GetAnnot(void) const
void Replace(const CSeq_feat &new_feat) const
Replace the feature with new Seq-feat object.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
const TId & GetId(void) const
TMol GetBioseqMolType(void) const
Get some values from core:
CSeq_entry_EditHandle GetParentEntry(void) const
Navigate object tree.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
TObjectType * GetPointerOrNull(void) const THROWS_NONE
Get pointer value.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
void SetComment(const TComment &value)
Assign a value to Comment data member.
const TLocation & GetLocation(void) const
Get the Location member data.
bool IsSeq(void) const
Check if variant Seq is selected.
int main(int argc, const char *argv[])
static CSeq_entry_Handle s_GetParentEntry(CSeq_entry_Handle seh)
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
The NCBI C++/STL use hints.
Utility macros and typedefs for exploring NCBI objects from seq.asn.
#define FOR_EACH_FEATURE_ON_ANNOT
Utility macros and typedefs for exploring NCBI objects from seqset.asn.
#define FOR_EACH_SEQANNOT_ON_SEQSET(Itr, Var)
FOR_EACH_SEQANNOT_ON_SEQSET EDIT_EACH_SEQANNOT_ON_SEQSET.
CRef< CObjectManager > m_ObjMgr
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