ids = handle.
GetId();
94 for(
const auto&
id: ids) {
95 if(&
id!= &ids.front()) {
114 return*
id.
Get().m_Handle;
121 for(
const auto&
id: ids) {
122 if(&
id!= &ids.front()) {
125os <<
id.AsString();
130 template<
typenameTParam,
typenameTFunction>
131 string ToString(
constTParam& param, TFunction func)
191 for(
const auto&
id: ids) {
246 if(os) *os <<
m_Test1<<
" --> ";
300 for(; iter; ++iter) {
306 m_SIH= *ids.begin();
334GetParentBioseq_set();
421 for(
CFeat_CIfeat_it(scope, seq_loc, sel); feat_it; ++feat_it) {
462annot->
SetData().SetFtable();
466new_feat->
SetTitle(
"Test Feature");
467new_feat->
SetData().SetComment();
498 virtual void Init(
void);
499 virtual int Run(
void);
513: m_DbEngine(
"AsnDB")
553arg_desc->AddKey(
"gi",
"SeqEntryID",
"GI id of the Seq-Entry to fetch",
559 stringprog_description =
"Example of the C++ Object Manager usage\n";
560arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(), prog_description,
false);
632os << ot.
GetName() <<
"... ";
635 if(!ot.
Do(*scope, &os)) {
642 if(ot.
Check(*scope, &os))
662// Get list of synonyms for the Seq-id.
663// * With GenBank loader this request should not load the whole Bioseq.
664CBioseq_Handle::TId ids = scope.GetIds(seq_id);
666ITERATE (CBioseq_Handle::TId, id_it, ids) {
667if (id_it != ids.begin())
668os << " + "; // print id separator
669os << id_it->AsString();
674// Get Bioseq handle for the Seq-id.
675// * Most of requests will use this handle.
676CBioseq_Handle bioseq_handle = scope.GetBioseqHandle(seq_id);
678// Terminate the program if the GI cannot be resolved to a Bioseq.
679if ( !bioseq_handle ) {
680ERR_POST(Fatal << "Bioseq not found, with GI=" << seq_id.GetGi());
682s_PrintIds(bioseq_handle, os);
685// Use CSeqdesc iterator.
686// Iterate through all descriptors -- starting from the Bioseq, go
687// all the way up the Seq-entries tree, to the top-level Seq-entry (TSE).
689CBioseq_EditHandle edit = bioseq_handle.GetEditHandle();
690CSeq_entry_Handle parent = bioseq_handle.GetParentEntry();
692edit.AddId(GetNewIdHandle());
693// edit.RemoveId(idh);
695os << "---------------- Before descr is added -----------" << endl;
696s_PrintDescr(bioseq_handle, os);
697os << "----------------------- end ----------------------" << endl;
699CRef<CSeqdesc> desc(new CSeqdesc);
700desc->SetComment("-------------- ADDED COMMENT1 ------------");
701CScopeTransaction trans = scope.GetTransaction();
702CBioseq_EditHandle edit = bioseq_handle.GetEditHandle();
703edit.AddSeqdesc(*desc);
706os << "------------- After descr is added -----" << endl;
707s_PrintDescr(bioseq_handle, os);
708os << "-------------------- end -------------" << endl;
710os << "Before featre is removed : ";
711CSeq_annot_Handle annot;
712s_PrintFeat(bioseq_handle, os);
714CScopeTransaction tr = scope.GetTransaction();
715for (CFeat_CI feat_it(bioseq_handle); feat_it; ++feat_it) {
716annot = feat_it.GetAnnot();
717// annot.GetEditHandle().Remove();
718const CMappedFeat& feat = *feat_it;
719feat.GetSeq_feat_Handle().Remove();
725os << "Before featre is added : ";
727CScopeTransaction tr = scope.GetTransaction();
729CSeq_feat *nf = new CSeq_feat;
730nf->SetTitle("Add Featue");
731nf->SetData().SetComment();
732nf->SetLocation().SetWhole().Assign(*bioseq_handle.GetSeqId());
733annot.GetEditHandle().AddFeat(*nf);
734for (CFeat_CI feat_it(bioseq_handle); feat_it; ++feat_it) {
735CSeq_annot_Handle annot = feat_it.GetAnnot();
736CSeq_feat *nf = new CSeq_feat;
737nf->SetTitle("Add Featue");
738nf->SetData().SetComment();
739nf->SetLocation().SetWhole().Assign(*bioseq_handle.GetSeqId());
740annot.GetEditHandle().AddFeat(*nf);
744os << "After featre is added : ";
745s_PrintFeat(bioseq_handle, os);
747os << "Changes are made." << endl;
751void CEditBioseqSampleApp::x_RunCheck(const CSeq_id& seq_id,
754CRef<CScope> pscope = CreateScope();
755CScope& scope = *pscope;
757CBioseq_Handle bioseq_handle = scope.GetBioseqHandle(seq_id);
758s_PrintIds(bioseq_handle, os);
759os << "*******************************" << endl;
760s_PrintDescr(bioseq_handle, os);
761os << "*******************************" << endl;
762s_PrintFeat(bioseq_handle, os);
764os << "Check is done." << endl;
int NcbiSys_main(int argc, ncbi::TXChar *argv[])
static const CSeq_id_Handle & s_GetNewIdHandle()
string ToString(const TParam ¶m, TFunction func)
void s_PrintIds1(const CBioseq_Handle::TId &ids, CNcbiOstream &os)
void s_PrintIds(const CBioseq_Handle &handle, CNcbiOstream &os)
virtual bool Check(CScope &scope, CNcbiOstream *os)
const CSeq_id_Handle & m_SeqId
virtual bool Do(CScope &scope, CNcbiOstream *os)
CAddBioseqChecker(const CSeq_id_Handle &seq_id)
virtual ~CAddBioseqChecker()
virtual ~CAddFeatChecker()
CAddFeatChecker(const CSeq_id_Handle &seq_id)
virtual bool Do(CScope &scope, CNcbiOstream *os)
virtual bool Check(CScope &scope, CNcbiOstream *os)
const CSeq_id_Handle & m_SeqId
virtual bool Check(CScope &scope, CNcbiOstream *os)
virtual bool Do(CScope &scope, CNcbiOstream *os)
const CSeq_id_Handle & m_SeqId
CAddIdChecker(const CSeq_id_Handle &seq_id)
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CRef< CDataLoader >, CRef< IEditsDBEngine >, CRef< IEditSaver > saver=CRef< IEditSaver >(), CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
list< TOperation > TOperations
AutoPtr< IOperationTest > TOperation
CRef< CScope > x_CreateScope()
virtual void Init(void)
Initialize the application.
virtual int Run(void)
Run the application.
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
unique_ptr< CSeq_id_Handle > m_Handle
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
virtual ~CRemoveBioseqChecker()
CBioseq_EditHandle::ERemoveMode m_RemoveMode
CRemoveBioseqChecker(const CSeq_id_Handle &seq_id, bool keep_seqentry)
const CSeq_id_Handle & m_SeqId
virtual bool Check(CScope &scope, CNcbiOstream *os)
CRef< CBioseq_set > m_BSet
virtual bool Do(CScope &scope, CNcbiOstream *os)
virtual bool Check(CScope &scope, CNcbiOstream *os)
virtual ~CRemoveFeatChecker()
const CSeq_id_Handle & m_SeqId
virtual bool Do(CScope &scope, CNcbiOstream *os)
CRemoveFeatChecker(const CSeq_id_Handle &seq_id)
virtual ~CRemoveIdChecker()
const CSeq_id_Handle & m_SeqId
virtual bool Do(CScope &scope, CNcbiOstream *os)
CRemoveIdChecker(const CSeq_id_Handle &seq_id)
virtual bool Check(CScope &scope, CNcbiOstream *os)
CResetIdChecker(const CSeq_id_Handle &seq_id)
virtual bool Check(CScope &scope, CNcbiOstream *os)
virtual bool Do(CScope &scope, CNcbiOstream *os)
const CSeq_id_Handle & m_SeqId
virtual ~CResetIdChecker()
T & Get(void)
Create the variable if not created yet, return the reference.
void Commit()
Finish the editing operation.
void SetNameDesc(const string &name)
CSeq_feat_EditHandle â.
namespace ncbi::objects::
IOperationTest(const string &name)
virtual bool Check(CScope &scope, CNcbiOstream *os)=0
void SetName(const string &name)
virtual ~IOperationTest()
virtual bool Do(CScope &scope, CNcbiOstream *os)=0
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define GI_FROM(T, value)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
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.
@ eIntId
Convertible to TIntId (int or Int8 depending on NCBI_INT8_GI)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
@ eSerial_AsnText
ASN.1 text.
static CSeq_id_Handle GetGiHandle(TGi gi)
Faster way to create a handle for a gi.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
TIds GetIds(const CSeq_id &id, TGetFlags flags=0)
Get "native" bioseq ids without filtering and matching.
CScopeTransaction GetTransaction()
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
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.
CBioseq_set_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
vector< CSeq_id_Handle > TId
bool AddId(const CSeq_id_Handle &id) const
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CConstRef< TObject > GetCompleteObject(void) const
CBioseq_EditHandle AttachBioseq(CBioseq &seq, int index=-1) const
Attach a bioseq.
void Remove(void) const
Remove the feature from Seq-annot.
CSeq_feat_EditHandle AddFeat(const CSeq_feat &new_obj) const
void Remove(ERemoveMode mode=eRemoveSeq_entry) const
CBioseq_set_Handle GetParentBioseq_set(void) const
Get parent bioseq-set handle.
CConstRef< TObject > GetCompleteObject(void) const
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
bool RemoveId(const CSeq_id_Handle &id) const
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CSeq_annot_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
ERemoveMode
Remove current bioseq from its location.
bool HasParentEntry(void) const
Check if current seq-entry has a parent.
const TId & GetId(void) const
SAnnotSelector & SetResolveAll(void)
SetResolveAll() is equivalent to SetResolveMethod(eResolve_All).
@ eLevel_Mains
Main bioseq only.
void Reset(void)
Reset reference object.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetTitle(const TTitle &value)
Assign a value to Title data member.
void SetData(TData &value)
Assign a value to Data data member.
@ e_not_set
No variant selected.
void SetData(TData &value)
Assign a value to Data data member.
TId & SetId(void)
Assign a value to Id data member.
void ResetId(void)
Reset Id data member.
@ eMol_not_set
> cdna = rna
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
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