A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/huge__file__demo_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/huge_asn/huge_file_demo/huge_file_demo.cpp Source File

91

arg_desc->SetUsageContext(

GetArguments

().GetProgramBasename(),

92  "Demonstration of huge file readers"

,

96

arg_desc->AddFlag(

"rw1848"

,

"Testing RW-1848"

);

98

arg_desc->AddFlag(

"traditional"

,

"Open file in traditional mode"

);

105  string

filename =

GetArgs

()[

"i"

].AsString();

106

std::cerr <<

"Opening "

<< filename << std::endl;

108  if

(

GetArgs

()[

"traditional"

]) {

112

edit::CHugeFileProcess huge;

127

auto entry = Ref(new CSeq_entry);

128

entry->SetSet().SetClass(CBioseq_set::eClass_genbank);

129

entry->SetSet().SetSeq_set();

134  auto info

= edit::CHugeAsnDataLoader::RegisterInObjectManager(

154

scope->AddDataLoader(

context

.m_loader_name);

162  auto

top_seh = edit::CHugeFileProcess::GetTopLevelEntry(bh);

163  auto

entry = top_seh.GetCompleteSeq_entry();

168  auto

location_id = (**feat).GetLocation().GetId();

170  bool

good_id =

false

;

171  for

(

auto

seqid : bh.

GetId

()) {

178

std::cerr <<

" misplaced feature:"

<< location_id->AsFastaString() <<

"\n"

;

181

std::cerr <<

" mixed location\n"

;

188  if

(idlist.size() < 2)

189  throw

std::runtime_error(

"Too little dataset"

);

194  auto

& id1 = **(idlist.begin());

195  auto

& id2 = **(++idlist.begin());

203

std::cout <<

"Reading "

<< idlist.size() <<

" records"

<< std::endl;

211  outfile

.exceptions(ios::failbit | ios::badbit);

225  auto

id_it = idlist.begin();

226  for

(

size_t i

=0;

i

<100 &&

i

<idlist.size(); ++

i

)

228

std::cout <<

" "

<< (**id_it).AsFastaString() << std::endl;

241  for

(

auto

it: idlist)

247

<< (*it).AsFastaString()

248

<<

":"

<< scope->GetSequenceLength(*it)

249

<<

":"

<< scope->GetSequenceType(*it)

250

<<

":"

<< scope->GetTaxId(*it)

251

<<

":"

<< scope->GetLabel(*it);

275

scope->ResetHistory();

290

std::list<CBioseq_Handle> modified_records;

292  for

(

auto id

: idlist)

298  if

(50 <=

i

&&

i

< 100) {

302

modified_records.push_back(beh);

330

scope->ResetHistory();

340  for

(

auto id

: idlist)

384  for

(

auto id

: idlist)

413

scope->ResetHistory();

424

orig_feat.

Reset

(&(*cds_it->GetSeq_feat()));

428

cout <<

"Orig seqfeat handle was found"

<< endl;

434

new_gene->

Assign

(*old_gene);

448

cout <<

"Replaced the old gene with the new one "

<< endl;

452  auto

ffh = cds_it->GetSeq_feat_Handle();

454

cout <<

"Works if handle is obtained from the iterator!"

<< endl;

461

cout <<

"New fh was found!"

<< endl;

473  auto

it = idlist.begin();

476  struct

processing_token

489  auto

pull_next = [

this

, &scope, &index, &it, &idlist] (processing_token& token) ->

bool 492

scope->ResetHistory();

494  if

(it == idlist.end())

498

token.m_index = index;

501

token.m_bh = scope->GetBioseqHandle(**it);

511  auto

process_func = [

this

](processing_token& token)

514  if

(50 <= token.m_index && token.m_index < 100) {

523

token.m_seh = token.m_bh.GetParentEntry();

530

writer.

WriteAsyncST

(top_object, pull_next, process_func);

557

orig_feat.

Reset

(&(*cds_it->GetSeq_feat()));

561

cout <<

"Orig seqfeat handle was found"

<< endl;

567

new_gene->

Assign

(*old_gene);

579

cout <<

"Replaced the old gene with the new one! "

<< endl;

584  auto

ffh = cds_it->GetSeq_feat_Handle();

586

cout <<

"It works if handle is obtained from the iterator!"

<< endl;

592

cout <<

"New fh was found!"

<< endl;

599 int main

(

int

argc,

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