cerr <<
"s_TimerCallback "<< Diff.
GetAsDouble() << endl;
119 virtual void*
Main(
void);
125list< CRef<CSeq_align> > MergedAligns;
127cerr <<
"Merge Thread Starting : "<<
TId<< endl;
145}
catch(
CException& e) { cerr <<__LINE__<<
"Thread Queue Exception: "<< e.
ReportAll() << endl;
break; }
147list< CRef<CSeq_align> > In,
Out;
148In.insert(In.end(), InAligns.begin(), InAligns.end());
152cerr <<
"T: "<<
TId<<
" : " 155<<
" : "<< In.size() <<
" aligns"<< endl;
164OutAligns.push_back(*OutIter);
169cerr <<
"Merge Thread Finished : "<<
TId<< endl;
183 virtual void*
Main(
void);
191 size_tGroupCount = 0, AlignCount=0;
198}
catch(
CException& e) { cerr <<
"Thread Output Queue Timeout, repeat."<< endl;
continue; }
209cerr <<
"Output Thread Finished, Wrote "<<GroupCount<<
" sets for "<< AlignCount<<
" alignments"<<endl;
216 virtual void Init(
void);
234argList->AddDefaultKey(
"threads",
"integer",
"thread count. core logic is sequential, but seperate seq-id-pairs can thread.",
CArgDescriptions::eInteger,
"1");
260list<CRef<CSeq_align> > OrigAligns;
265}
catch(...) {
break; }
266OrigAligns.push_back(Align);
268 if(OrigAligns.empty()) {
276}
catch(...) {
break; }
277OrigAligns.push_back(Align);
280 if(OrigAligns.empty()) {
288}
catch(...) {
break; }
289OrigAligns.insert(OrigAligns.end(), AlignSet->
Get().begin(), AlignSet->
Get().end());
388cerr <<
"OrigAligns.size: "<< OrigAligns.size() << endl;
389 if(OrigAligns.empty()) {
390cerr <<
"No alignments read in."<< endl;
411list< CRef<CSeq_align> > MergedAligns;
413 intThreadCount = args[
"threads"].AsInteger();
414 doubleTimer = args[
"timer"].AsDouble();
415 intRatio = args[
"ratio"].AsInteger();
418Scoring.
Match= Ratio;
425 if(ThreadCount > 0) {
426 typedefpair<objects::CSeq_id_Handle, objects::ENa_strand> TSeqIdPair;
427 typedefpair<TSeqIdPair, TSeqIdPair> TMapKey;
428 typedefvector<CRef<objects::CSeq_align> >
TAlignVec;
430 typedefpair<TMapKey, TAlignVec> TAlignGroupPair;
431TAlignGroupMap AlignGroupMap;
439AlignGroupMap[Key].push_back(*AlignIter);
441cerr <<
"Thread Queue Length: "<< AlignGroupMap.size() << endl;
444 ITERATE(TAlignGroupMap, AlignGroupIter, AlignGroupMap) {
445ThreadQueue.
Push(AlignGroupIter->second);
449list< CMergeTreeThread* > Threads;
450 for(
int i= 0;
i< ThreadCount;
i++) {
461Threads.push_back(New);
466FileOutThread->
InQueue= &ThreadResults;
470 ITERATE(list< CMergeTreeThread* >, ThreadIter, Threads) {
471(*ThreadIter)->Run();
473FileOutThread->
Run();
474cerr<<
"Threads Launched, Joining"<< endl;
475 ITERATE(list< CMergeTreeThread* >, ThreadIter, Threads) {
476(*ThreadIter)->Join();
479FileOutThread->
Join();
480cerr<<
"Threads Joined, Exiting."<< endl;
490 else if(ThreadCount == 0) {
500TreeMerger.
Merge(OrigAligns, MergedAligns);
502cerr <<
"MergedAligns.size: "<< MergedAligns.size() << endl;
518 main(
intargc,
const char* argv[])
static void AddArgumentDescriptions(CArgDescriptions &arg_desc, TLoaders loaders=fDefault)
Add a standard set of arguments used to configure the object manager.
static CRef< objects::CScope > GetDefaultScope(const CArgs &args)
virtual void * Main(void)
Derived (user-created) class must provide a real thread function.
CMergeTree::SScoring Scoring
virtual void * Main(void)
Derived (user-created) class must provide a real thread function.
virtual int Run()
Run the application.
virtual void Init(void)
Initialize the application.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
Convenience trait implementation which tells that the queue can be used from many threads.
Thread-safe queue object with a blocking mechanism.
void Push(const TValue &elem, const CTimeSpan *timeout=NULL)
Add new element to the end of queue.
bool IsEmpty(void) const
Check if the queue is empty.
TValue Pop(const CTimeSpan *timeout=NULL)
Retrieve an element from the queue.
void Merge(const list< CRef< objects::CSeq_align > > &Input, list< CRef< objects::CSeq_align > > &Output)
void SetScope(objects::CScope *Scope)
void SetScoring(CMergeTree::SScoring Scoring)
CMergeTree::TInterruptFnPtr SetInterruptCallback(CMergeTree::TInterruptFnPtr callback, void *callback_data)
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
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.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eInputFile
Name of file (must exist and be readable)
@ eDouble
Convertible into a floating point number (double)
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
#define MSerial_AsnBinary
#define MSerial_AsnText
I/O stream manipulators â.
const string AsFastaString(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
bool Run(TRunMode flags=fRunDefault)
Run the thread.
void Join(void **exit_data=0)
Wait for the thread termination.
double GetAsDouble(void) const
Return time span as number of seconds.
@ eCurrent
Use current time. See also CCurrentTime.
void CORE_SetLOCK(MT_LOCK lk)
Set the MT critical section lock/unlock handler â to be used by the core internals for protection of ...
MT_LOCK MT_LOCK_cxx2c(CRWLock *lock=0, bool pass_ownership=false)
Convert a C++ Toolkit lock object to an MT_LOCK lock.
const Tdata & Get(void) const
Get the member data.
ENa_strand
strand of nucleic acid
@ eNa_strand_both
in forward orientation
bool s_TimerCallback(void *Data)
CSyncQueue< TAlignVec, deque< TAlignVec >, CSyncQueue_Traits_ConcurrencyOn > TSyncQueue
string s_Strand(ENa_strand strand)
vector< CRef< objects::CSeq_align > > TAlignVec
int main(int argc, const char *argv[])
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines NCBI C++ diagnostic APIs, classes, and macros.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Multi-threading â classes, functions, and features.
Useful/utility classes and methods.
void Out(T t, int w, CNcbiOstream &to=cout)
Definition of synchronized queue (CSyncQueue template) and templates related to it.
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