64 if (find(ids.begin(), ids.end(),
id) == ids.end()) {
94 if (! loc.
IsMix())
return false;
97 if ((*it)->IsPacked_int()) {
109 bool any_nulls_seen =
false;
116 any_nulls_seen =
true;
119 if( any_nulls_seen && ! new_mix_pieces.empty() ) {
122 new_mix_pieces.push_back( null_piece );
126 old_piece->
SetInt().Assign(seqint);
127 new_mix_pieces.push_back( old_piece );
130 if( any_nulls_seen && ! new_mix_pieces.empty() ) {
133 new_mix_pieces.push_back( null_piece );
137 new_mix_pieces.push_back( old_piece );
142 new_loc->
SetMix(*new_mix);
154 bool suppress_accession)
163 for( ; loc_ci; ++loc_ci ) {
168 if( cached_handle ) {
179 if (! show_all_accns) {
185 handles_set.
insert( handle );
187 if( ! handles_set.
empty() )
189 vector<CSeq_id_Handle> handles_vec;
191 back_inserter(handles_vec) );
196 ctx.GetScope().GetAccVers( &results, handles_vec );
197 _ASSERT( handles_vec.size() == results.size() );
198 for(
unsigned int id_idx = 0; id_idx < handles_vec.size(); ++id_idx ) {
202 handles_vec[id_idx], acc_handle );
212 x_Add(*flat, oss,
ctx,
type,
true, show_all_accns, add_join, suppress_accession);
214 x_Add(loc, oss,
ctx,
type,
true, show_all_accns, add_join, suppress_accession);
228 bool suppress_accession)
234 bool is_flat_order =
false;
236 const char*
prefix =
"join(";
242 oss <<
"complement(";
243 x_Add(*rev_loc, oss,
ctx,
type,
false, show_all_accns, add_join, suppress_accession);
252 is_flat_order =
true;
260 is_flat_order =
true;
268 switch ( loc.
Which() ) {
279 if (fuzz && fuzz->
IsLim() &&
283 oss << uLength <<
")";
321 const char* delim =
"";
324 if (!
x_Add(**it, oss,
ctx,
type, show_comp, show_all_accns, suppress_accession)) {
348 oss <<
"complement(";
351 const char* delim =
"";
377 const char* delim =
"";
378 if ( !has_one || add_join ) {
381 bool join_inside_order =
false;
390 const bool this_is_virtual = next_is_virtual;
398 if( is_flat_order ) {
399 if( ( this_loc.
IsInt() || this_loc.
IsPnt() ) &&
400 ! join_inside_order && ! this_is_virtual && ! next_is_virtual ) {
402 join_inside_order =
true;
407 if( this_is_virtual && ! print_virtual ) {
411 if (!
x_Add(this_loc, oss,
ctx,
type, show_comp, show_all_accns,
false, suppress_accession)) {
419 if( is_flat_order ) {
420 if( join_inside_order && next_is_virtual ) {
422 join_inside_order =
false;
426 if( join_inside_order ) {
429 if ( !has_one || add_join ) {
436 const char* delim =
"";
440 if (!
x_Add(**it, oss,
ctx,
type, show_comp, show_all_accns, suppress_accession)) {
458 x_Add(bond.
GetA(), oss,
ctx,
type, show_comp, show_all_accns, suppress_accession);
461 x_Add(bond.
GetB(), oss,
ctx,
type, show_comp, show_all_accns, suppress_accession);
482 if (!
si.IsSetFuzz_to()) {
492 if (to_fuzz.
IsLim()) {
493 switch( to_fuzz.
GetLim() ) {
515 bool suppress_accession)
517 bool do_html =
ctx.Config().DoHTML();
528 oss <<
"complement(";
561 bool suppress_accession)
567 const bool do_html =
ctx.Config().DoHTML();
574 oss <<
"complement(";
596 bool suppress_accession)
604 switch ( fuzz->
Which() ) {
607 oss <<
'(' << pnt - fuzz->
GetP_m() <<
'.';
608 if( bFromSeqPoint ) {
609 oss << pnt <<
")..(" << pnt <<
'.';
611 oss << pnt + fuzz->
GetP_m() <<
')';
616 oss << ( bFromSeqPoint ?
"" :
"(" )
618 << ( bFromSeqPoint ?
'^' :
'.' )
620 << ( bFromSeqPoint ?
"" :
")");
627 const long start =
static_cast<long>(pnt -
delta);
628 const long end =
static_cast<long>(pnt +
delta);
629 if( bFromSeqPoint ) {
630 oss << start <<
'^' << end;
632 oss <<
'(' << start <<
'.' << end <<
')';
638 switch ( fuzz->
GetLim() ) {
640 if( bFromSeqPoint ) {
641 oss << pnt <<
'^' << (pnt + 1);
646 oss << (html ==
eHTML_Yes ?
">" :
">") << pnt;
649 if( bFromSeqPoint ) {
650 oss << (pnt - 1) <<
'^' << pnt;
655 oss << (html ==
eHTML_Yes ?
"<" :
"<") << pnt;
692 bool suppress_accession)
696 if (! show_all_accns) {
697 if (
ctx.GetHandle().IsSynonym(
id)) {
699 oss <<
ctx.GetAccession() <<
':';
705 if (suppress_accession) {
722 switch ( idp->
Which() ) {
759 CFlatSeqLoc::TToAccessionMap::const_iterator map_iter =
760 m_TheMap.find(
query);
761 if( map_iter == m_TheMap.end() ) {
764 return map_iter->second;
bool IsReverse(ENa_strand s)
TLength GetLength(void) const
const CInt_fuzz * GetFuzz() const
CFastMutex m_MutexForTheMap
void Insert(CSeq_id_Handle from, CSeq_id_Handle to)
CSeq_id_Handle Get(CSeq_id_Handle query)
bool x_FuzzToDisplayed(const CSeq_interval &si) const
bool x_Add(const CSeq_loc &loc, CNcbiOstrstream &oss, CBioseqContext &ctx, TType type, bool show_comp, bool show_all_accns=false, bool join_whole_loc=false, bool suppress_accession=false)
CFlatSeqLoc(const CSeq_loc &loc, CBioseqContext &ctx, TType type=eType_location, bool show_all_accns=false, bool add_join=false, bool suppress_accession=false)
static CGuardedToAccessionMap m_ToAccessionMap
bool x_IsAccessionVersion(CSeq_id_Handle id)
void x_AddID(const CSeq_id &id, CNcbiOstrstream &oss, CBioseqContext &ctx, TType type, bool show_all_accns=false, bool suppress_accession=false)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
static const char si[8][64]
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static bool s_NeedsFlattening(const CSeq_loc &loc)
static bool s_IsVirtualSeqInt(const CSeq_interval &seqint, const CBioseq_Handle &seq)
static bool s_IsVirtualLocation(const CSeq_loc &loc, const CBioseq_Handle &seq)
static CConstRef< CSeq_loc > s_FlattenLoc(const CSeq_loc &loc)
static bool s_IsVirtualId(const CSeq_id_Handle &id, const CBioseq_Handle &seq)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
const CTextseq_id * GetTextseq_Id(void) const
Return embedded CTextseq_id, if any.
void Rewind(void)
Reset the iterator to the initial state.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
CSeq_id_Handle GetSeq_id_Handle(void) const
const CSeq_loc & GetEmbeddingSeq_loc(void) const
Get the nearest seq-loc containing the current range.
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 & GetSeq_id(void) const
Get seq_id of the current location.
void SetNull(void)
Override all setters to incorporate cache invalidation.
@ eEmpty_Allow
ignore empty locations
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
CSeq_loc * SeqLocRevCmpl(const CSeq_loc &loc, CScope *scope)
Get reverse complement of the seq-loc (?)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
vector< CSeq_id_Handle > TSeq_id_Handles
Bulk retrieval methods.
@ eGetBioseq_Loaded
Search in all loaded TSEs in the scope.
vector< CSeq_id_Handle > TId
TInst_Repr GetInst_Repr(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
bool IsLim(void) const
Check if variant Lim is selected.
TPct GetPct(void) const
Get the variant data.
TLim GetLim(void) const
Get the variant data.
TMin GetMin(void) const
Get the Min member data.
E_Choice Which(void) const
Which variant is currently selected.
TMax GetMax(void) const
Get the Max member data.
TP_m GetP_m(void) const
Get the variant data.
const TRange & GetRange(void) const
Get the variant data.
@ eLim_tl
space to left of position
@ eLim_tr
space to right of position
@ e_Pct
% plus or minus (x10) 0-1000
@ e_P_m
plus or minus fixed amount
bool IsMix(void) const
Check if variant Mix is selected.
const TB & GetB(void) const
Get the B member data.
list< CRef< CSeq_interval > > Tdata
ENa_strand
strand of nucleic acid
const Tdata & Get(void) const
Get the member data.
TStrand GetStrand(void) const
Get the Strand member data.
const TId & GetId(void) const
Get the Id member data.
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
const TWhole & GetWhole(void) const
Get the variant data.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
bool IsSetFuzz(void) const
Check if a value has been assigned to Fuzz data member.
list< CRef< CSeq_loc > > Tdata
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
bool CanGetA(void) const
Check if it is safe to call GetA method.
E_Choice Which(void) const
Which variant is currently selected.
const TId & GetId(void) const
Get the Id member data.
E_Choice Which(void) const
Which variant is currently selected.
const TId & GetId(void) const
Get the Id member data.
TStrand GetStrand(void) const
Get the Strand member data.
const Tdata & Get(void) const
Get the member data.
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TEquiv & GetEquiv(void) const
Get the variant data.
list< CRef< CSeq_loc > > Tdata
vector< TSeqPos > TPoints
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
const TA & GetA(void) const
Get the A member data.
bool CanGetB(void) const
Check if it is safe to call GetB method.
bool CanGetPoint(void) const
Check if it is safe to call GetPoint method.
bool CanGetFuzz(void) const
Check if it is safe to call GetFuzz method.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
const TPoints & GetPoints(void) const
Get the Points member data.
bool IsSetId(void) const
WARNING: this used to be optional Check if a value has been assigned to Id data member.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
bool IsNull(void) const
Check if variant Null is selected.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
const TMix & GetMix(void) const
Get the variant data.
bool IsPnt(void) const
Check if variant Pnt is selected.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
const TBond & GetBond(void) const
Get the variant data.
@ e_Gi
GenInfo Integrated Database.
@ e_Equiv
equivalent sets of locations
@ e_Empty
to NULL one Seq-id in a collection
@ e_Feat
indirect, through a Seq-feat
@ eRepr_virtual
no seq data
double value_type
The numeric datatype used by the parser.
const CharType(& source)[N]
Int4 delta(size_t dimension_, const Int4 *score_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
const char * strLinkBaseEntrezViewer
static const char * prefix[]
Generic utility macros and templates for exploring NCBI objects.