66 size_t num_objects = objs.size();
68 if( num_objects <= 0 ){
70 }
else if( num_objects == 1 ){
71 return vector<int>( 1, 0 );
74 vector<int> groups( num_objects, -1 );
75 vector<CSeq_id_Handle> loc_handles;
76 vector< set<CSeq_id_Handle> > aln_handles;
78 for(
size_t ix = 0; ix < num_objects; ix++ ){
79 const CSeq_loc* loc =
dynamic_cast<const CSeq_loc*
>( objs[ix].object.GetPointer() );
81 CScope* scope =
const_cast<CScope*
>( objs[ix].scope.GetPointer() );
85 vector<CSeq_id_Handle>::iterator found =
86 find( loc_handles.begin(), loc_handles.end(), idh )
88 if( found != loc_handles.end() ){
89 groups[ix] =
static_cast<int>(found - loc_handles.begin());
91 groups[ix] =
static_cast<int>(loc_handles.size());
92 loc_handles.push_back( idh );
100 CScope* scope =
const_cast<CScope*
>( objs[ix].scope.GetPointer() );
108 for(
int q = 0; q < num_seqs; q++ ){
115 vector< set<CSeq_id_Handle> >::iterator found =
116 find( aln_handles.begin(), aln_handles.end(), idh_set )
118 if( found != aln_handles.end() ){
119 groups[ix] = (
int)(found - aln_handles.begin() + num_objects);
121 groups[ix] = (
int)(aln_handles.size() + num_objects);
122 aln_handles.push_back( idh_set );
136 TIdsToObjectsMap handle_groups;
143 if(
object.IsNull() || scope.
IsNull() ){
147 vector<CSeq_id_Handle> idh_vec;
171 for(
int seqix = 0; seqix < num_seqs; seqix++ ){
178 idh_vec.push_back( *idh_itr );
181 if( idh_vec.size() == 1 ){
182 idh_vec.push_back( idh_vec.front() );
187 handle_groups[idh_vec].push_back( *obtr );
192 const vector<CSeq_id_Handle>& idh_vec = sidhtr->first;
198 ITERATE( vector<CSeq_id_Handle>, idhtr, idh_vec ){
206 label += (idh ? idh : *idhtr).
GetSeqId()->GetSeqIdString(
true );
209 if( !
label.empty() ){
210 objects_map[
label] = group;
215 single.push_back( *scobtr );
219 objects_map[
label].push_back( *scobtr );
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
CViewTypeDescriptor - holds description of a view type.
IOpenViewManager - interface dealing with a series of open view operations.
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
virtual int TestInputObjects(TConstScopedObjects &objects)=0
tests input objects (not using object conversion) and returns a combination of ETestResult flags bett...
virtual IOpenViewManager * GetOpenViewManager()
virtual bool IsCompatibleWith(const CObject &object, objects::CScope &scope)
virtual vector< int > CombineInputObjects(const TConstScopedObjects &objects)
virtual const CProjectViewTypeDescriptor & GetProjectViewTypeDescriptor() const =0
returns a Descriptor for the View Type supported by the Factory
virtual void CombineObjects(const TConstScopedObjects &objects, TObjectsMap &objects_map)
iterator_bool insert(const value_type &val)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
vector< SConstScopedObject > TConstScopedObjects
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)