NCBI C++ ToolKit
flat_seqloc.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: flat_seqloc.cpp 99483 2023-04-04 17:43:43Z stakhovv $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Aaron Ucko, NCBI
27 *
28 * File Description:
29 * new (early 2003) flat-file generator -- location representation
30 *
31 * ===========================================================================
32 */
33 
34 
35 
36 #include <ncbi_pch.hpp>
38 #include <objects/seq/Bioseq.hpp>
41 
42 #include <objmgr/scope.hpp>
43 #include <objmgr/bioseq_handle.hpp>
44 #include <objmgr/util/sequence.hpp>
45 #include <objmgr/impl/synonyms.hpp>
46 
49 #include <algorithm>
50 #include <objmgr/util/objutil.hpp>
51 
54 USING_SCOPE(sequence);
55 
56 CFlatSeqLoc::CGuardedToAccessionMap CFlatSeqLoc::m_ToAccessionMap;
57 
59 {
60  if (!id || !seq) {
61  return true;
62  }
63  CBioseq_Handle::TId ids = seq.GetId();
64  if (find(ids.begin(), ids.end(), id) == ids.end()) {
66  return bsh ? bsh.GetInst_Repr() == CSeq_inst::eRepr_virtual : false;
67  }
68  return false;
69 }
70 
71 
72 static bool s_IsVirtualSeqInt
73 (const CSeq_interval& seqint,
74  const CBioseq_Handle& seq)
75 {
76  return seqint.IsSetId() ?
78  false;
79 }
80 
81 
82 static bool s_IsVirtualLocation(const CSeq_loc& loc, const CBioseq_Handle& seq)
83 {
84  const CSeq_id* id = loc.GetId();
85  return id ?
87  false;
88 }
89 
90 
91 static bool s_NeedsFlattening (const CSeq_loc &loc)
92 
93 {
94  if (! loc.IsMix()) return false;
95 
96  ITERATE (CSeq_loc_mix::Tdata, it, loc.GetMix().Get()) {
97  if ((*it)->IsPacked_int()) {
98  return true;
99  }
100  }
101 
102  return false;
103 }
104 
105 
107 
108 {
109  bool any_nulls_seen = false;
110  CRef<CSeq_loc_mix> new_mix(new CSeq_loc_mix);
111  CSeq_loc_mix::Tdata & new_mix_pieces = new_mix->Set();
112 
113  ITERATE (CSeq_loc_mix::Tdata, it, loc.GetMix().Get()) {
114  const CSeq_loc& curr = **it;
115  if (curr.IsNull()) {
116  any_nulls_seen = true;
117  } else if (curr.IsPacked_int()) {
119  if( any_nulls_seen && ! new_mix_pieces.empty() ) {
120  CRef<CSeq_loc> null_piece( new CSeq_loc );
121  null_piece->SetNull();
122  new_mix_pieces.push_back( null_piece );
123  }
124  CRef<CSeq_loc> old_piece(new CSeq_loc);
125  const CSeq_interval& seqint = **pit;
126  old_piece->SetInt().Assign(seqint);
127  new_mix_pieces.push_back( old_piece );
128  }
129  } else {
130  if( any_nulls_seen && ! new_mix_pieces.empty() ) {
131  CRef<CSeq_loc> null_piece( new CSeq_loc );
132  null_piece->SetNull();
133  new_mix_pieces.push_back( null_piece );
134  }
135  CRef<CSeq_loc> old_piece(new CSeq_loc);
136  old_piece->Assign(curr);
137  new_mix_pieces.push_back( old_piece );
138  }
139  }
140 
141  CRef<CSeq_loc> new_loc(new CSeq_loc);
142  new_loc->SetMix(*new_mix);
143 
144  return new_loc;
145 }
146 
147 
149 (const CSeq_loc& loc,
151  TType type,
152  bool show_all_accns,
153  bool add_join,
154  bool suppress_accession)
155 {
156  // load the map that caches conversion to accession, because
157  // it's *much* faster when done in bulk vs. one at a time.
158  // Try accession DG000029 for an example that's really sped up
159  // by this code, or gbcon180 in general.
160  {
161  set<CSeq_id_Handle> handles_set;
162  CSeq_loc_CI loc_ci( loc );
163  for( ; loc_ci; ++loc_ci ) {
164  CSeq_id_Handle handle = loc_ci.GetSeq_id_Handle();
165 
166  // skip ones whose value we've already cached
167  CSeq_id_Handle cached_handle = m_ToAccessionMap.Get(handle);
168  if( cached_handle ) {
169  continue;
170  }
171 
172  // if it's already an accession, then it maps to itself
173  if( x_IsAccessionVersion( handle ) ) {
174  m_ToAccessionMap.Insert( handle, handle );
175  continue;
176  }
177 
178  // don't translate ones that are synonyms of this bioseq
179  if (! show_all_accns) {
180  if( ctx.GetHandle().IsSynonym( loc_ci.GetSeq_id() ) ) {
181  continue;
182  }
183  }
184 
185  handles_set.insert( handle );
186  }
187  if( ! handles_set.empty() )
188  {
189  vector<CSeq_id_Handle> handles_vec;
190  copy( handles_set.begin(), handles_set.end(),
191  back_inserter(handles_vec) );
192 
193  CScope::TSeq_id_Handles results;
194  // GetAccVers will divide our request into smaller requests,
195  // so don't worry about overwhelming ID2
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 ) {
199  CSeq_id_Handle acc_handle = results[id_idx];
200  if( acc_handle ) {
202  handles_vec[id_idx], acc_handle );
203  }
204  }
205  }
206 
207  }
208 
209  CNcbiOstrstream oss;
210  if (s_NeedsFlattening (loc)) {
211  CConstRef<CSeq_loc> flat = s_FlattenLoc (loc);
212  x_Add(*flat, oss, ctx, type, true, show_all_accns, add_join, suppress_accession);
213  } else {
214  x_Add(loc, oss, ctx, type, true, show_all_accns, add_join, suppress_accession);
215  }
217 }
218 
219 
221 (const CSeq_loc& loc,
222  CNcbiOstrstream& oss,
224  TType type,
225  bool show_comp,
226  bool show_all_accns,
227  bool add_join,
228  bool suppress_accession)
229 {
230  CScope& scope = ctx.GetScope();
231  const CBioseq_Handle& seq = ctx.GetHandle();
232 
233  // some later logic needs to know we're inside an "order"
234  bool is_flat_order = false;
235 
236  const char* prefix = "join(";
237 
238  // deal with complement of entire location
239  if ( type == eType_location ) {
240  if ( show_comp && GetStrand(loc, &scope) == eNa_strand_minus ) {
241  CRef<CSeq_loc> rev_loc(SeqLocRevCmpl(loc, &scope));
242  oss << "complement(";
243  x_Add(*rev_loc, oss, ctx, type, false, show_all_accns, add_join, suppress_accession);
244  oss << ')';
245  return true;
246  }
247 
248  if ( loc.IsMix() ) {
249  ITERATE (CSeq_loc_mix::Tdata, it, loc.GetMix().Get()) {
250  if ( (*it)->IsNull() || s_IsVirtualLocation(**it, seq) ) {
251  prefix = "order(";
252  is_flat_order = true;
253  break;
254  }
255  }
256  } else if ( loc.IsPacked_int() ) {
258  if ( s_IsVirtualSeqInt(**it, seq) ) {
259  prefix = "order(";
260  is_flat_order = true;
261  break;
262  }
263  }
264  }
265  }
266 
267  // handle each location component
268  switch ( loc.Which() ) {
269  case CSeq_loc::e_Null:
270  {{
271  const CFlatGapLoc* gap = dynamic_cast<const CFlatGapLoc*>(&loc);
272  if (! gap) {
273  oss << "gap()";
274  break;
275  }
276  size_t uLength = gap->GetLength();
277  const CInt_fuzz* fuzz = gap->GetFuzz();
278  oss << "gap(";
279  if (fuzz && fuzz->IsLim() &&
280  fuzz->GetLim() == CInt_fuzz::eLim_unk) {
281  oss << "unk";
282  }
283  oss << uLength << ")";
284 
285  //oss << (uLength==100 ? "gap(" : "gap(") << uLength << ")";
286  break;
287  }}
288  case CSeq_loc::e_Empty:
289  {{
290  oss << "gap()";
291  break;
292  }}
293  case CSeq_loc::e_Whole:
294  {{
295  if (add_join)
296  oss << prefix;
297  x_AddID(loc.GetWhole(), oss, ctx, type, show_all_accns, suppress_accession);
298  TSeqPos len = sequence::GetLength(loc, &scope);
299  oss << "1";
300  if (len > 1) {
301  oss << ".." << len;
302  }
303  if (add_join)
304  oss << ')';
305  break;
306  }}
307  case CSeq_loc::e_Int:
308  {{
309  if (add_join)
310  oss << prefix;
311  x_Add(loc.GetInt(), oss, ctx, type, show_comp, show_all_accns, suppress_accession);
312  if (add_join)
313  oss << ')';
314  break;
315  }}
317  {{
318  // Note: At some point, we should add the "join inside order" logic here (like for the e_Mix case), but since I didn't immediately find a
319  // test case in the repository, I'm taking the conservative approach and leaving it alone for now.
320  oss << prefix;
321  const char* delim = "";
323  oss << delim;
324  if (!x_Add(**it, oss, ctx, type, show_comp, show_all_accns, suppress_accession)) {
325  delim = "";
326  } else {
327  delim = ",";
328  }
329  }
330  oss << ')';
331  break;
332  }}
333  case CSeq_loc::e_Pnt:
334  {{
335  if (add_join)
336  oss << prefix;
337  x_Add(loc.GetPnt(), oss, ctx, type, show_comp, show_all_accns, suppress_accession);
338  if (add_join)
339  oss << ')';
340  break;
341  }}
343  {{
344  const CPacked_seqpnt& ppnt = loc.GetPacked_pnt();
345  ENa_strand strand = ppnt.IsSetStrand() ? ppnt.GetStrand() : eNa_strand_unknown;
346  x_AddID(ppnt.GetId(), oss, ctx, type, show_all_accns, suppress_accession);
347  if (strand == eNa_strand_minus && show_comp) {
348  oss << "complement(";
349  }
350  oss << prefix;
351  const char* delim = "";
353  oss << delim;
354  const CInt_fuzz* fuzz = ppnt.CanGetFuzz() ? &ppnt.GetFuzz() : nullptr;
355  if (!x_Add(*it, fuzz, oss, ( ctx.Config().DoHTML() ? eHTML_Yes : eHTML_None ), eForce_None, eSource_Other, show_all_accns, suppress_accession )) {
356  delim = "";
357  } else {
358  delim = ",";
359  }
360  }
361  if (strand == eNa_strand_minus && show_comp) {
362  oss << ")";
363  }
364  break;
365  }}
366  case CSeq_loc::e_Mix:
367  {{
368  /// odd corner case:
369  /// a mix with one interval should not have a prefix, except when
370  /// prefix is requested unconditionally.
371  const bool print_virtual = ( type != eType_location );
373  ++it;
374  bool has_one = !it;
375  it.Rewind();
376 
377  const char* delim = "";
378  if ( !has_one || add_join ) {
379  oss << prefix;
380  }
381  bool join_inside_order = false; // true when we're inside a join() inside an order()
382  bool next_is_virtual = ( !it || it.GetEmbeddingSeq_loc().IsNull() || s_IsVirtualLocation( it.GetEmbeddingSeq_loc(), seq ) );
383  for ( ; it; ++it ) {
384  oss << delim;
385 
386  const CSeq_loc& this_loc = it.GetEmbeddingSeq_loc();
387 
388  // save some work by using what was done on the last loop iteration
389  // (this is set before the loop on the first iteration)
390  const bool this_is_virtual = next_is_virtual;
391 
392  // get iterator to next one
393  CSeq_loc_CI next = it;
394  ++next;
395 
396  // begin join in order, if necessary
397  next_is_virtual = ( ! next || next.GetEmbeddingSeq_loc().IsNull() || s_IsVirtualLocation( next.GetEmbeddingSeq_loc(), seq ) );
398  if( is_flat_order ) {
399  if( ( this_loc.IsInt() || this_loc.IsPnt() ) &&
400  ! join_inside_order && ! this_is_virtual && ! next_is_virtual ) {
401  oss << "join(";
402  join_inside_order = true;
403  }
404  }
405 
406  // skip gaps, etc.
407  if( this_is_virtual && ! print_virtual ) {
408  delim = "";
409  } else {
410  // add the actual location
411  if (!x_Add(this_loc, oss, ctx, type, show_comp, show_all_accns, false, suppress_accession)) {
412  delim = "";
413  } else {
414  delim = ",";
415  }
416  }
417 
418  // end join in order, if necessary
419  if( is_flat_order ) {
420  if( join_inside_order && next_is_virtual ) {
421  oss << ')';
422  join_inside_order = false;
423  }
424  }
425  }
426  if( join_inside_order ) {
427  oss << ')';
428  }
429  if ( !has_one || add_join ) {
430  oss << ')';
431  }
432  break;
433  }}
434  case CSeq_loc::e_Equiv:
435  {{
436  const char* delim = "";
437  oss << "one-of(";
438  ITERATE (CSeq_loc_equiv::Tdata, it, loc.GetEquiv().Get()) {
439  oss << delim;
440  if (!x_Add(**it, oss, ctx, type, show_comp, show_all_accns, suppress_accession)) {
441  delim = "";
442  } else {
443  delim = ",";
444  }
445  }
446  oss << ')';
447  break;
448  }}
449  case CSeq_loc::e_Bond:
450  {{
451  const CSeq_bond& bond = loc.GetBond();
452  if ( !bond.CanGetA() ) {
453  return false;
454  }
455  if (add_join)
456  oss << prefix;
457  oss << "bond(";
458  x_Add(bond.GetA(), oss, ctx, type, show_comp, show_all_accns, suppress_accession);
459  if ( bond.CanGetB() ) {
460  oss << ",";
461  x_Add(bond.GetB(), oss, ctx, type, show_comp, show_all_accns, suppress_accession);
462  }
463  oss << ")";
464  if (add_join)
465  oss << ")";
466  break;
467  }}
468  case CSeq_loc::e_Feat:
469  default:
470  return false;
471  /*NCBI_THROW(CException, eUnknown,
472  "CFlatSeqLoc::CFlatSeqLoc: unsupported (sub)location type "
473  + NStr::IntToString(loc.Which()));*/
474  } // end of switch statement
475 
476  return true;
477 }
478 
479 
481 {
482  if (!si.IsSetFuzz_to()) {
483  return false;
484  }
485 
486  const CInt_fuzz& to_fuzz = si.GetFuzz_to();
487 /* Range fuzziness is not displayed
488  if (to_fuzz.IsRange()) {
489  return true;
490  }
491 */
492  if (to_fuzz.IsLim()) {
493  switch( to_fuzz.GetLim() ) {
494  case CInt_fuzz::eLim_tr:
495  case CInt_fuzz::eLim_gt:
496  case CInt_fuzz::eLim_tl:
497  case CInt_fuzz::eLim_lt:
498  return true;
499  default:
500  break;
501  }
502  }
503  return false;
504 }
505 
506 
507 
509 (const CSeq_interval& si,
510  CNcbiOstrstream& oss,
512  TType type,
513  bool show_comp,
514  bool show_all_accns,
515  bool suppress_accession)
516 {
517  bool do_html = ctx.Config().DoHTML();
518 
519  TSeqPos from = si.GetFrom(), to = si.GetTo();
520  ENa_strand strand = si.CanGetStrand() ? si.GetStrand() : eNa_strand_unknown;
521  bool comp = show_comp && (strand == eNa_strand_minus);
522 
523  if (type == eType_location &&
524  s_IsVirtualId(CSeq_id_Handle::GetHandle(si.GetId()), ctx.GetHandle()) ) {
525  return false;
526  }
527  if (comp) {
528  oss << "complement(";
529  }
530  x_AddID(si.GetId(), oss, ctx, type, show_all_accns, suppress_accession);
531 
532  // get the fuzz we need, but certain kinds of fuzz do not belong in an interval
533  const CSeq_interval::TFuzz_from *from_fuzz = (si.IsSetFuzz_from() ? &si.GetFuzz_from() : nullptr);
534 
535  x_Add(from, from_fuzz, oss, ( do_html ? eHTML_Yes : eHTML_None ));
536 
537  if ( (type == eType_assembly) ||
538  ((from != to || x_FuzzToDisplayed(si)) ) )
539  {
540  oss << "..";
541 
542  const CSeq_interval::TFuzz_from *to_fuzz = (si.IsSetFuzz_to() ? &si.GetFuzz_to() : nullptr);
543 
544  x_Add(to, to_fuzz, oss, ( do_html ? eHTML_Yes : eHTML_None ));
545  }
546  if (comp) {
547  oss << ')';
548  }
549 
550  return true;
551 }
552 
553 
555 (const CSeq_point& pnt,
556  CNcbiOstrstream& oss,
558  TType type,
559  bool show_comp,
560  bool show_all_accns,
561  bool suppress_accession)
562 {
563  if ( !pnt.CanGetPoint() ) {
564  return false;
565  }
566 
567  const bool do_html = ctx.Config().DoHTML();
568  const bool is_comp =
569  pnt.IsSetStrand() && IsReverse(pnt.GetStrand()) && show_comp;
570 
571  TSeqPos pos = pnt.GetPoint();
572  x_AddID(pnt.GetId(), oss, ctx, type, show_all_accns, suppress_accession);
573  if( is_comp ) {
574  oss << "complement(";
575  }
576  x_Add(pos, pnt.IsSetFuzz() ? &pnt.GetFuzz() : nullptr,
577  oss, ( do_html ? eHTML_Yes : eHTML_None ),
579  eSource_Point );
580  if( is_comp ) {
581  oss << ')';
582  }
583 
584  return true;
585 }
586 
587 
589 (TSeqPos pnt,
590  const CInt_fuzz* fuzz,
591  CNcbiOstrstream& oss,
592  EHTML html,
593  EForce force,
594  ESource source,
595  bool show_all_accns,
596  bool suppress_accession)
597 {
598  // need to convert to 1-based coordinates
599  pnt += 1;
600 
601  const bool bFromSeqPoint = (source == eSource_Point);
602 
603  if (fuzz) {
604  switch ( fuzz->Which() ) {
605  case CInt_fuzz::e_P_m:
606  {
607  oss << '(' << pnt - fuzz->GetP_m() << '.';
608  if( bFromSeqPoint ) {
609  oss << pnt << ")..(" << pnt << '.';
610  }
611  oss << pnt + fuzz->GetP_m() << ')';
612  break;
613  }
614  case CInt_fuzz::e_Range:
615  {
616  oss << ( bFromSeqPoint ? "" : "(" )
617  << (fuzz->GetRange().GetMin() + 1)
618  << ( bFromSeqPoint ? '^' : '.' )
619  << (fuzz->GetRange().GetMax() + 1)
620  << ( bFromSeqPoint ? "" : ")");
621  break;
622  }
623  case CInt_fuzz::e_Pct: // actually per thousand...
624  {
625  // calculate in floating point to avoid overflow (or underflow)
626  const double delta = 0.001 * pnt * fuzz->GetPct();
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;
631  } else {
632  oss << '(' << start << '.' << end << ')';
633  }
634  break;
635  }
636  case CInt_fuzz::e_Lim:
637  {
638  switch ( fuzz->GetLim() ) {
639  case CInt_fuzz::eLim_tr:
640  if( bFromSeqPoint ) {
641  oss << pnt << '^' << (pnt + 1);
642  break;
643  }
644  // sometimes FALL-THROUGH
645  case CInt_fuzz::eLim_gt:
646  oss << (html == eHTML_Yes ? "&gt;" : ">") << pnt;
647  break;
648  case CInt_fuzz::eLim_tl:
649  if( bFromSeqPoint ) {
650  oss << (pnt - 1) << '^' << pnt;
651  break;
652  }
653  // sometimes FALL-THROUGH
654  case CInt_fuzz::eLim_lt:
655  oss << (html == eHTML_Yes ? "&lt;" : "<") << pnt;
656  break;
657  default:
658  oss << pnt;
659  if( force == eForce_ToRange ) {
660  oss << ".." << pnt;
661  }
662  break;
663  }
664  break;
665  }
666  default:
667  {
668  oss << pnt;
669  if( force == eForce_ToRange ) {
670  oss << ".." << pnt;
671  }
672  break;
673  }
674  } // end of switch statement
675  } else {
676  oss << pnt;
677  if( force == eForce_ToRange ) {
678  oss << ".." << pnt;
679  }
680  }
681 
682  return true;
683 }
684 
685 
687 (const CSeq_id& id,
688  CNcbiOstrstream& oss,
690  TType type,
691  bool show_all_accns,
692  bool suppress_accession)
693 {
694  const bool do_html = ( ctx.Config().DoHTML() && type == eType_assembly);
695 
696  if (! show_all_accns) {
697  if (ctx.GetHandle().IsSynonym(id)) {
698  if ( type == eType_assembly ) {
699  oss << ctx.GetAccession() << ':';
700  }
701  return;
702  }
703  }
704 
705  if (suppress_accession) {
706  return;
707  }
708 
709  CConstRef<CSeq_id> idp;
710  try {
711  CSeq_id_Handle handle =
713  if( handle ) {
714  idp = handle.GetSeqId();
715  }
716  } catch (CException&) {
717  idp.Reset();
718  }
719  if (!idp) {
720  idp.Reset(&id);
721  }
722  switch ( idp->Which() ) {
723  default:
724  oss << idp->GetSeqIdString(true) << ':';
725  break;
726  case CSeq_id::e_Gi:
727  if( do_html ) {
728  const string gi_str = idp->GetSeqIdString(true);
729  oss << "<a href=\"" << strLinkBaseEntrezViewer << gi_str << "\">gi|" << gi_str << "</a>:";
730  } else {
731  oss << "gi|" << idp->GetSeqIdString(true) << ':';
732  }
733  break;
734  }
735 }
736 
738 {
739  CConstRef<CSeq_id> seq_id = id.GetSeqIdOrNull();
740  if( ! seq_id ) {
741  return false;
742  }
743 
744  return (seq_id->GetTextseq_Id() != nullptr);
745 }
746 
747 void
749  CSeq_id_Handle from, CSeq_id_Handle to )
750 {
753 }
754 
757 {
758  CFastMutexGuard guard(m_MutexForTheMap);
759  CFlatSeqLoc::TToAccessionMap::const_iterator map_iter =
760  m_TheMap.find(query);
761  if( map_iter == m_TheMap.end() ) {
762  return CSeq_id_Handle();
763  } else {
764  return map_iter->second;
765  }
766 }
767 
#define static
bool IsReverse(ENa_strand s)
Definition: Na_strand.hpp:75
CBioseq_Handle –.
TLength GetLength(void) const
Definition: flat_seqloc.hpp:59
const CInt_fuzz * GetFuzz() const
Definition: flat_seqloc.hpp:62
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)
string m_String
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
CRef –.
Definition: ncbiobj.hpp:618
CScope –.
Definition: scope.hpp:92
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:453
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator begin() const
Definition: set.hpp:135
bool empty() const
Definition: set.hpp:133
const_iterator end() const
Definition: set.hpp:136
static const char si[8][64]
Definition: des.c:146
static bool s_NeedsFlattening(const CSeq_loc &loc)
Definition: flat_seqloc.cpp:91
static bool s_IsVirtualSeqInt(const CSeq_interval &seqint, const CBioseq_Handle &seq)
Definition: flat_seqloc.cpp:73
static bool s_IsVirtualLocation(const CSeq_loc &loc, const CBioseq_Handle &seq)
Definition: flat_seqloc.cpp:82
static CConstRef< CSeq_loc > s_FlattenLoc(const CSeq_loc &loc)
static bool s_IsVirtualId(const CSeq_id_Handle &id, const CBioseq_Handle &seq)
Definition: flat_seqloc.cpp:58
USING_SCOPE(sequence)
CS_CONTEXT * ctx
Definition: t0006.c:12
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
string
Definition: cgiapp.hpp:687
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
Definition: Seq_id.cpp:2145
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.
Definition: Seq_id.cpp:169
void Rewind(void)
Reset the iterator to the initial state.
Definition: Seq_loc.hpp:1104
void SetMix(TMix &v)
Definition: Seq_loc.hpp:987
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
CSeq_id_Handle GetSeq_id_Handle(void) const
Definition: Seq_loc.hpp:1035
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
const CSeq_loc & GetEmbeddingSeq_loc(void) const
Get the nearest seq-loc containing the current range.
Definition: Seq_loc.cpp:2573
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
void SetNull(void)
Override all setters to incorporate cache invalidation.
Definition: Seq_loc.hpp:960
@ eEmpty_Allow
ignore empty locations
Definition: Seq_loc.hpp:458
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.
Definition: scope.cpp:95
vector< CSeq_id_Handle > TSeq_id_Handles
Bulk retrieval methods Common argument typedef - vector of requested ids.
Definition: scope.hpp:518
@ eGetBioseq_Loaded
Search in all loaded TSEs in the scope.
Definition: scope.hpp:127
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.
Definition: ncbiobj.hpp:1439
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
bool IsLim(void) const
Check if variant Lim is selected.
Definition: Int_fuzz_.hpp:636
TPct GetPct(void) const
Get the variant data.
Definition: Int_fuzz_.hpp:615
TLim GetLim(void) const
Get the variant data.
Definition: Int_fuzz_.hpp:642
TMin GetMin(void) const
Get the Min member data.
Definition: Int_fuzz_.hpp:519
E_Choice Which(void) const
Which variant is currently selected.
Definition: Int_fuzz_.hpp:547
TMax GetMax(void) const
Get the Max member data.
Definition: Int_fuzz_.hpp:472
TP_m GetP_m(void) const
Get the variant data.
Definition: Int_fuzz_.hpp:582
const TRange & GetRange(void) const
Get the variant data.
Definition: Int_fuzz_.cpp:159
@ eLim_gt
greater than
Definition: Int_fuzz_.hpp:211
@ eLim_unk
unknown
Definition: Int_fuzz_.hpp:210
@ eLim_lt
less than
Definition: Int_fuzz_.hpp:212
@ eLim_tl
space to left of position
Definition: Int_fuzz_.hpp:214
@ eLim_tr
space to right of position
Definition: Int_fuzz_.hpp:213
@ e_Pct
% plus or minus (x10) 0-1000
Definition: Int_fuzz_.hpp:228
@ e_P_m
plus or minus fixed amount
Definition: Int_fuzz_.hpp:226
bool IsMix(void) const
Check if variant Mix is selected.
Definition: Seq_loc_.hpp:552
const TB & GetB(void) const
Get the B member data.
Definition: Seq_bond_.hpp:243
list< CRef< CSeq_interval > > Tdata
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
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.
Definition: Seq_loc_.cpp:238
TPoint GetPoint(void) const
Get the Point member data.
Definition: Seq_point_.hpp:303
const TWhole & GetWhole(void) const
Get the variant data.
Definition: Seq_loc_.cpp:172
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.
Definition: Seq_point_.hpp:408
list< CRef< CSeq_loc > > Tdata
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
Definition: Seq_point_.hpp:420
bool CanGetA(void) const
Check if it is safe to call GetA method.
Definition: Seq_bond_.hpp:207
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
const TId & GetId(void) const
Get the Id member data.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_id_.hpp:746
const TId & GetId(void) const
Get the Id member data.
Definition: Seq_point_.hpp:390
TStrand GetStrand(void) const
Get the Strand member data.
Definition: Seq_point_.hpp:350
const Tdata & Get(void) const
Get the member data.
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:260
const Tdata & Get(void) const
Get the member data.
const TEquiv & GetEquiv(void) const
Get the variant data.
Definition: Seq_loc_.cpp:304
list< CRef< CSeq_loc > > Tdata
vector< TSeqPos > TPoints
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
Definition: Seq_loc_.hpp:534
const TA & GetA(void) const
Get the A member data.
Definition: Seq_bond_.hpp:213
bool CanGetB(void) const
Check if it is safe to call GetB method.
Definition: Seq_bond_.hpp:237
bool CanGetPoint(void) const
Check if it is safe to call GetPoint method.
Definition: Seq_point_.hpp:290
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.
Definition: Seq_point_.hpp:331
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.
Definition: Seq_loc_.hpp:528
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:194
bool IsNull(void) const
Check if variant Null is selected.
Definition: Seq_loc_.hpp:504
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
const TMix & GetMix(void) const
Get the variant data.
Definition: Seq_loc_.cpp:282
bool IsPnt(void) const
Check if variant Pnt is selected.
Definition: Seq_loc_.hpp:540
const TPacked_int & GetPacked_int(void) const
Get the variant data.
Definition: Seq_loc_.cpp:216
const TBond & GetBond(void) const
Get the variant data.
Definition: Seq_loc_.cpp:326
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
@ e_Gi
GenInfo Integrated Database.
Definition: Seq_id_.hpp:106
@ e_Null
not placed
Definition: Seq_loc_.hpp:98
@ e_Equiv
equivalent sets of locations
Definition: Seq_loc_.hpp:106
@ e_Empty
to NULL one Seq-id in a collection
Definition: Seq_loc_.hpp:99
@ e_Feat
indirect, through a Seq-feat
Definition: Seq_loc_.hpp:108
@ e_Int
from to
Definition: Seq_loc_.hpp:101
@ e_Whole
whole sequence
Definition: Seq_loc_.hpp:100
@ eRepr_virtual
no seq data
Definition: Seq_inst_.hpp:93
int len
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
const CharType(& source)[N]
Definition: pointer.h:1149
Int4 delta(size_t dimension_, const Int4 *score_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
const char * strLinkBaseEntrezViewer
Definition: objutil.cpp:1641
static const char * prefix[]
Definition: pcregrep.c:405
Generic utility macros and templates for exploring NCBI objects.
static string query
Definition: type.c:6
#define _ASSERT
#define const
Definition: zconf.h:232
Modified on Mon Jul 15 05:33:00 2024 by modify_doxy.py rev. 669887