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

Go to the SVN repository for this file.

1 /* $Id: gff3flybase_writer.cpp 93574 2021-04-30 16:19:19Z 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  * Authors:
27  *
28  * File Description: Write gff file
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 #include <objects/seq/Bioseq.hpp>
37 #include <objects/seq/Seqdesc.hpp>
38 #include <objmgr/util/sequence.hpp>
49 
51 #include <objmgr/scope.hpp>
53 #include <objmgr/seqdesc_ci.hpp>
54 
57 
60 
61 #define INSERTION(sf, tf) ( ((sf) & CAlnMap::fSeq) && !((tf) & CAlnMap::fSeq) )
62 #define DELETION(sf, tf) ( !((sf) & CAlnMap::fSeq) && ((tf) & CAlnMap::fSeq) )
63 #define MATCH(sf, tf) ( ((sf) & CAlnMap::fSeq) && ((tf) & CAlnMap::fSeq) )
64 
65 
66 // ----------------------------------------------------------------------------
68  const string& seqId,
69  const CScore& score) const
70 // ----------------------------------------------------------------------------
71 {
72  static const vector<string> supportedScores{
73  "Gap", "ambiguous_orientation", "consensus_splices",
74  "pct_coverage", "pct_identity_gap", "pct_identity_ungap",
75  "rank", "score"
76  };
77  static const vector<string> coreScores{
78  "ID", "Target", "Gap"
79  };
80 
81  if (!score.IsSetId() || !score.GetId().IsStr()) {
82  return false;
83  }
84  string key = score.GetId().GetStr();
85  if (seqId == mCurrentIdForAttributes &&
86  std::find(coreScores.begin(), coreScores.end(), key) == coreScores.end()) {
87  return false;
88  }
89  if (std::find(supportedScores.begin(), supportedScores.end(), key)
90  == supportedScores.end()) {
91  return false;
92  }
93  return true;
94 }
95 
96 // ----------------------------------------------------------------------------
98  CBioseq_Handle bsh,
99  CGffAlignRecord& record)
100 // ----------------------------------------------------------------------------
101 {
102  const auto& seqId = record.StrSeqId();
103  const auto& taxIdIt = mTaxidMap.find(seqId);
104  if (taxIdIt != mTaxidMap.end()) {
105  record.SetAttribute("taxid", taxIdIt->second);
106  return true;
107  }
108  if (!bsh) {
109  return false;
110  }
111 
112  string taxonIdStr;
113  for (CSeqdesc_CI sdit(bsh, CSeqdesc::e_Source); sdit; ++sdit) {
114  const CBioSource& src = sdit->GetSource();
115  if (!src.IsSetOrg() || !src.GetOrg().IsSetDb()) {
116  continue;
117  }
118  const auto& tags = src.GetOrg().GetDb();
119  for (auto cit = tags.begin();
120  taxonIdStr.empty() && cit != tags.end(); ++cit) {
121  const auto& tag = **cit;
122  if (!tag.IsSetDb() || tag.GetDb() != "taxon") {
123  continue;
124  }
125  const auto& objid = tag.GetTag();
126  switch (objid.Which()) {
127  default:
128  break;
129  case CObject_id::e_Str:
130  if (!objid.GetStr().empty()) {
131  taxonIdStr = objid.GetStr();
132  }
133  break;
134  case CObject_id::e_Id:
135  taxonIdStr = NStr::IntToString(objid.GetId());
136  break;
137  }
138  }
139  }
140  if (!taxonIdStr.empty()) {
141  record.SetAttribute("taxid", taxonIdStr);
142  mTaxidMap[seqId] = taxonIdStr;
143  return true;
144  }
145  return false;
146 }
147 
148 // ----------------------------------------------------------------------------
150  CBioseq_Handle bsh,
151  CGffAlignRecord& record)
152 // ----------------------------------------------------------------------------
153 {
154  const auto& seqId = record.StrSeqId();
155  const auto& deflineIt = mDeflineMap.find(seqId);
156  if (deflineIt != mDeflineMap.end()) {
157  record.SetAttribute("def", deflineIt->second);
158  return true;
159  }
160  if (!bsh) {
161  return false;
162  }
163  auto defline = sequence::CDeflineGenerator().GenerateDefline(bsh);
164  record.SetAttribute("def", defline);
165  mDeflineMap[seqId] = defline;
166  return false;
167 }
168 
169 // ----------------------------------------------------------------------------
171 // ----------------------------------------------------------------------------
172 {
173  if (!m_bHeaderWritten) {
174  m_Os << "##gff-version 3" << '\n';
175  m_Os << "#!gff-spec-version 1.20" << '\n';
176  m_Os << "##!gff-variant flybase" << '\n';
177  m_Os << "# This variant of GFF3 interprets ambiguities in the" << '\n';
178  m_Os << "# GFF3 specifications in accordance with the views of Flybase." << '\n';
179  m_Os << "# This impacts the feature tag set, and meaning of the phase." << '\n';
180  m_Os << "#!processor NCBI annotwriter" << '\n';
181  m_bHeaderWritten = true;
182  }
183  return true;
184 }
185 
186 // ----------------------------------------------------------------------------
188  const CSeq_align& align,
189  const string& aid)
190 // ----------------------------------------------------------------------------
191 {
192  if (!CGff3Writer::xWriteAlignDisc(align, aid)) {
193  return false;
194  }
195  m_Os << "###" << '\n';
196  return true;
197 }
198 
199 // ----------------------------------------------------------------------------
201  CGffAlignRecord& record,
202  const CSpliced_seg& spliced,
203  const CSpliced_exon& exon)
204 // ----------------------------------------------------------------------------
205 {
206  bool isProteinProd = xSplicedSegHasProteinProd(spliced);
207 
208  const unsigned int tgtWidth = isProteinProd ? 3 : 1;
209 
210  const unsigned int seqStart = exon.GetProduct_start().AsSeqPos()/tgtWidth;
211  const unsigned int seqStop = exon.GetProduct_end().AsSeqPos()/tgtWidth;
212 
213 
214  ENa_strand seqStrand = eNa_strand_plus;
215  if (spliced.CanGetProduct_strand() &&
217  seqStrand = eNa_strand_minus;
218  }
219  record.SetLocation(seqStart, seqStop, seqStrand);
220 
221  // This code may never be called
222  if (seqStrand == eNa_strand_minus) {
223  if (exon.GetProduct_end().IsProtpos() &&
224  exon.GetProduct_end().GetProtpos().IsSetFrame()) {
225  const TSeqPos frame = exon.GetProduct_end().GetProtpos().GetFrame();
226  record.SetPhase(3-frame);
227  }
228  return true;
229  }
230 
231  if (exon.GetProduct_start().IsProtpos() &&
233  const TSeqPos frame = exon.GetProduct_start().GetProtpos().GetFrame();
234  record.SetPhase(frame-1);
235  }
236 
237  return true;
238 }
239 
240 
241 // ----------------------------------------------------------------------------
243  CGffAlignRecord& record,
244  const CSpliced_seg& spliced,
245  const CSpliced_exon& exon)
246 // ----------------------------------------------------------------------------
247 {
248  string genomicLabel;
249  const CSeq_id& genomicId = spliced.GetGenomic_id();
251  genomicId, *m_pScope, sequence::eGetId_Best);
252  if (bestH) {
253  bestH.GetSeqId()->GetLabel(&genomicLabel, CSeq_id::eContent);
254  }
255  else {
256  genomicId.GetLabel(&genomicLabel, CSeq_id::eContent);
257  }
258 
259  string seqStart = NStr::IntToString(exon.GetGenomic_start()+1);
260  string seqStop = NStr::IntToString(exon.GetGenomic_end()+1);
261  string seqStrand = "+";
262  if (spliced.IsSetGenomic_strand() &&
264  seqStrand = "-";
265  }
266 
267  string target = genomicLabel;
268  target += " " + seqStart;
269  target += " " + seqStop;
270  target += " " + seqStrand;
271  record.SetAttribute("Target", target);
272  return true;
273 }
274 
275 // ----------------------------------------------------------------------------
277  CGffAlignRecord& record,
278  const CSpliced_seg& spliced,
279  const CSpliced_exon& exon)
280 // ----------------------------------------------------------------------------
281 {
282  string seqId;
283  const CSeq_id& genomicId = spliced.GetProduct_id();
285  genomicId, *m_pScope, sequence::eGetId_Best);
286  bestH.GetSeqId()->GetLabel(&seqId, CSeq_id::eContent);
287  record.SetSeqId(seqId);
288  return true;
289 }
290 
291 // ----------------------------------------------------------------------------
293  CGffAlignRecord& record,
294  const CSpliced_seg& spliced,
295  const CSpliced_exon& exon)
296 // ----------------------------------------------------------------------------
297 {
298  if (exon.IsSetScores()) {
299  typedef list<CRef<CScore> > SCORES;
300 
301  const SCORES& scores = exon.GetScores().Get();
302  for (SCORES::const_iterator cit = scores.begin(); cit != scores.end();
303  ++cit) {
304  const CScore& score = **cit;
305  if (!score.IsSetId() || !score.GetId().IsStr()) {
306  continue;
307  }
308  const string& key = score.GetId().GetStr();
309  if (key == "score" || xIsNeededScore(record.StrSeqId(), score)) {
310  record.SetScore(score);
311  }
312  }
313  }
314  return true;
315 }
316 
317 // ----------------------------------------------------------------------------
319  CGffAlignRecord& record,
320  const CSeq_align& align)
321 // ----------------------------------------------------------------------------
322 {
324  CBioseq_Handle bsh = m_pScope->GetBioseqHandle(seqh);
325  if (mCurrentIdForAttributes != record.StrSeqId()) {
326  xAssignTaxid(bsh, record);
327  xAssignDefline(bsh, record);
328  }
329 
330  typedef vector<CRef<CScore> > SCORES;
331  if (align.IsSetScore()) {
332  const SCORES& scores = align.GetScore();
333  for (SCORES::const_iterator cit = scores.begin(); cit != scores.end();
334  ++cit) {
335  const CScore& score = **cit;
336  if (!xIsNeededScore(record.StrSeqId(), score)) {
337  continue;
338  }
339  record.SetScore(**cit);
340  }
341  }
343  return true;
344 }
345 
346 // ----------------------------------------------------------------------------
348  CGffAlignRecord& record,
349  const CAlnMap& alnMap,
350  unsigned int srcRow)
351 // ----------------------------------------------------------------------------
352 {
353  //const CSeq_id& targetId = alnMap.GetSeqId(srcRow);
354  const CSeq_id& targetId = alnMap.GetSeqId(0);
355  CBioseq_Handle targetH = m_pScope->GetBioseqHandle(targetId);
356  CSeq_id_Handle targetIdH = targetH.GetSeq_id_Handle();
357  try {
359  targetH, sequence::eGetId_ForceAcc);
360  if (best) {
361  targetIdH = best;
362  }
363  }
364  catch(std::exception&) {};
365  CConstRef<CSeq_id> pTargetId = targetIdH.GetSeqId();
366  string seqId;
367  pTargetId->GetLabel( &seqId, CSeq_id::eContent );
368  record.SetSeqId(seqId);
369  return true;
370 }
371 
372 // ----------------------------------------------------------------------------
374  CGffAlignRecord& record,
375  const CAlnMap& alnMap,
376  unsigned int srcRow)
377 // ----------------------------------------------------------------------------
378 {
379  const CSeq_id& sourceId = alnMap.GetSeqId(srcRow);
380  CBioseq_Handle sourceH = m_pScope->GetBioseqHandle(sourceId);
381  CSeq_id_Handle sourceIdH = sourceH.GetSeq_id_Handle();
382  try {
384  sourceH, sequence::eGetId_ForceAcc);
385  if (best) {
386  sourceIdH = best;
387  }
388  }
389  catch(std::exception&) {};
390  CConstRef<CSeq_id> pSourceId = sourceIdH.GetSeqId();
391 
392  string target;
393  pSourceId->GetLabel(&target, CSeq_id::eContent);
394 
395  ENa_strand strand =
396  (alnMap.StrandSign(srcRow) == -1) ? eNa_strand_minus : eNa_strand_plus;
397  int numSegs = alnMap.GetNumSegs();
398 
399  int start2 = -1;
400  int start_seg = 0;
401  while (start2 < 0 && start_seg < numSegs) { // Skip over -1 start coords
402  start2 = alnMap.GetStart(srcRow, start_seg++);
403  }
404 
405  int stop2 = -1;
406  int stop_seg = numSegs-1;
407  while (stop2 < 0 && stop_seg >= 0) { // Skip over -1 stop coords
408  stop2 = alnMap.GetStart(srcRow, stop_seg--);
409  }
410 
411  if (strand == eNa_strand_minus) {
412  swap(start2, stop2);
413  stop2 += alnMap.GetLen(start_seg-1)-1;
414  }
415  else {
416  stop2 += alnMap.GetLen(stop_seg+1)-1;
417  }
418 
419 
420  CSeq_id::EAccessionInfo sourceInfo = pSourceId->IdentifyAccession();
421  const int tgtWidth = (sourceInfo & CSeq_id::fAcc_prot) ? 3 : 1;
422 
423  target += " " + NStr::IntToString(start2/tgtWidth + 1);
424  target += " " + NStr::IntToString(stop2/tgtWidth + 1);
425  target += " " + string(strand == eNa_strand_plus ? "+" : "-");
426  record.SetAttribute("Target", target);
427  return true;
428 }
429 
430 // ----------------------------------------------------------------------------
432  CGffAlignRecord& record,
433  const CAlnMap& alnMap,
434  unsigned int)
435 // ----------------------------------------------------------------------------
436 {
437  unsigned int seqStart = alnMap.GetSeqStart(0);
438  unsigned int seqStop = alnMap.GetSeqStop(0);
439  ENa_strand seqStrand = (alnMap.StrandSign(0) == 1 ?
442  record.SetLocation(seqStart, seqStop, seqStrand);
443  return true;
444 }
445 
446 // ----------------------------------------------------------------------------
448  CGffAlignRecord& record,
449  const CAlnMap& alnMap,
450  unsigned int srcRow)
451 // ----------------------------------------------------------------------------
452 {
453  typedef vector<CRef<CScore> > SCORES;
454  const CDense_seg& denseSeg = alnMap.GetDenseg();
455  if (!denseSeg.IsSetScores()) {
456  return true;
457  }
458  const SCORES& scores = denseSeg.GetScores();
459  for (SCORES::const_iterator cit = scores.begin(); cit != scores.end();
460  ++cit) {
461  const CScore& score = **cit;
462  if (!score.IsSetId() || !score.GetId().IsStr()) {
463  continue;
464  }
465  const string& key = score.GetId().GetStr();
466  if (key == "score" || xIsNeededScore(record.StrSeqId(), score)) {
467  record.SetScore(score);
468  }
469  }
470  return true;
471 }
472 
473 // ----------------------------------------------------------------------------
475  CGffAlignRecord& record,
476  const CSpliced_seg& spliced,
477  const CSpliced_exon& exon)
478 // ----------------------------------------------------------------------------
479 {
480  bool isProteinProd = xSplicedSegHasProteinProd(spliced);
481  const unsigned int tgtWidth = isProteinProd ? 3 : 1;
482 
483  typedef list<CRef<CSpliced_exon_chunk> > CHUNKS;
484 
485  const CHUNKS& chunks = exon.GetParts();
486  for (CHUNKS::const_iterator cit = chunks.begin(); cit != chunks.end(); ++cit) {
487  const CSpliced_exon_chunk& chunk = **cit;
488  switch (chunk.Which()) {
489  default:
490  break;
492  record.AddMatch(chunk.GetMismatch());
493  break;
495  record.AddMatch(chunk.GetDiag()/tgtWidth);
496  break;
498  record.AddMatch(chunk.GetMatch()/tgtWidth);
499  break;
501  {
502  const unsigned int del_length = chunk.GetGenomic_ins()/tgtWidth;
503  if (del_length > 0) {
504  record.AddInsertion(del_length);
505  }
506  if (isProteinProd) {
507  const unsigned int forward_shift = chunk.GetGenomic_ins()%tgtWidth;
508  if (forward_shift > 0) {
509  record.AddForwardShift(forward_shift);
510  }
511  }
512  }
513  break;
515  {
516  const unsigned int insert_length = chunk.GetProduct_ins()/tgtWidth;
517  if (insert_length > 0) {
518  record.AddDeletion(insert_length);
519  }
520  if (isProteinProd) {
521  const unsigned int reverse_shift = chunk.GetProduct_ins()%tgtWidth;
522  if (reverse_shift > 0) {
523  record.AddReverseShift(reverse_shift);
524  }
525  }
526  }
527  break;
528  }
529  }
530  record.FinalizeMatches();
531  return true;
532 }
533 
535 
537 
539 
541  const pair<CConstRef<CSeq_align>, string>& p1,
542  const pair<CConstRef<CSeq_align>, string>& p2)
543  {
544 
545  CConstRef<CSeq_align> align1 = p1.first;
546  CConstRef<CSeq_align> align2 = p2.first;
547 
548  if (!align1 && align2) {
549  return true;
550  }
551 
552  if ((align1 && !align2) ||
553  (!align1 && !align2) ) {
554  return false;
555  }
556 
557  string subject_accession1;
558  try {
559  subject_accession1 = sequence::GetAccessionForId(align1->GetSeq_id(0), m_Scope);
560  } catch (...) {
561  }
562 
563  string subject_accession2;
564  try {
565  subject_accession2 = sequence::GetAccessionForId(align2->GetSeq_id(0), m_Scope);
566  } catch (...) {
567  }
568 
569 
570  auto make_key = [](const pair<CConstRef<CSeq_align>, string>& p, CScope& scope) {
571  const CSeq_align& align = *(p.first);
572  const string alignId = p.second;
573 
574  string subject_accession;
575  try {
576  subject_accession = sequence::GetAccessionForId(align.GetSeq_id(0), scope);
577  } catch (...) {
578  }
579 
580  string target_accession;
581  try {
582  target_accession = sequence::GetAccessionForId(align.GetSeq_id(1), scope);
583  } catch (...) {
584  }
585 
586  return make_tuple(
587  subject_accession,
588  align.GetSeqStart(0),
589  align.GetSeqStop(0),
590  align.GetSeqStrand(0),
591  target_accession,
592  align.GetSeqStart(1),
593  align.GetSeqStop(1),
594  align.GetSeqStrand(1),
595  alignId
596  );
597  };
598 
599  return (make_key(p1, m_Scope) < make_key(p2, m_Scope));
600  }
601 };
602 
603 // ----------------------------------------------------------------------------
604 void CGff3FlybaseWriter::x_SortAlignments(TAlignCache& alignCache,
605  CScope& scope)
606 // ----------------------------------------------------------------------------
607 {
608  alignCache.sort(SFlybaseCompareAlignments(scope));
609 }
610 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
TSignedSeqPos GetStart(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:614
const CSeq_id & GetSeqId(TNumrow row) const
Definition: alnmap.hpp:645
TSeqPos GetLen(TNumseg seg, int offset=0) const
Definition: alnmap.hpp:621
const CDense_seg & GetDenseg(void) const
Definition: alnmap.hpp:475
TSeqPos GetSeqStop(TNumrow row) const
Definition: alnmap.hpp:675
int StrandSign(TNumrow row) const
Definition: alnmap.hpp:593
TNumseg GetNumSegs(void) const
Definition: alnmap.hpp:510
TSeqPos GetSeqStart(TNumrow row) const
Definition: alnmap.hpp:665
CBioseq_Handle –.
virtual bool xAssignAlignmentDensegSeqId(CGffAlignRecord &, const CAlnMap &, unsigned int) override
virtual bool xAssignAlignmentSplicedScores(CGffAlignRecord &, const CSpliced_seg &, const CSpliced_exon &) override
bool xAssignTaxid(CBioseq_Handle, CGffAlignRecord &)
virtual bool xAssignAlignmentDensegLocation(CGffAlignRecord &, const CAlnMap &, unsigned int) override
virtual void x_SortAlignments(TAlignCache &alignCache, CScope &scope) override
virtual bool WriteHeader() override
bool xAssignDefline(CBioseq_Handle, CGffAlignRecord &)
virtual bool xAssignAlignmentSplicedTarget(CGffAlignRecord &, const CSpliced_seg &, const CSpliced_exon &) override
map< string, string > mDeflineMap
map< string, string > mTaxidMap
virtual bool xAssignAlignmentSplicedSeqId(CGffAlignRecord &, const CSpliced_seg &, const CSpliced_exon &) override
virtual bool xAssignAlignmentSplicedLocation(CGffAlignRecord &, const CSpliced_seg &, const CSpliced_exon &) override
virtual bool xAssignAlignmentSplicedGap(CGffAlignRecord &record, const CSpliced_seg &spliced, const CSpliced_exon &exon) override
virtual bool xWriteAlignDisc(const CSeq_align &, const string &="") override
bool xIsNeededScore(const std::string &, const CScore &) const
virtual bool xAssignAlignmentScores(CGffAlignRecord &, const CSeq_align &) override
virtual bool xAssignAlignmentDensegScores(CGffAlignRecord &, const CAlnMap &, unsigned int) override
virtual bool xAssignAlignmentDensegTarget(CGffAlignRecord &, const CAlnMap &, unsigned int) override
virtual bool xWriteAlignDisc(const CSeq_align &, const string &="")
void AddInsertion(unsigned int)
void AddMatch(unsigned int)
void AddReverseShift(unsigned int)
void AddDeletion(unsigned int)
void AddForwardShift(unsigned int)
void SetPhase(unsigned int)
void SetSeqId(const string &)
void SetLocation(unsigned int, unsigned int, ENa_strand=objects::eNa_strand_unknown)
bool SetAttribute(const string &, const string &)
void SetScore(const CScore &)
virtual string StrSeqId() const
TSeqPos AsSeqPos() const
Definition: Product_pos.cpp:56
CProt_pos_Base::TFrame GetFrame() const
Definition: Prot_pos.hpp:82
CScope –.
Definition: scope.hpp:92
Definition: Score.hpp:57
TSeqPos GetSeqStop(TDim row) const
Definition: Seq_align.cpp:273
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
Definition: Seq_align.cpp:317
TSeqPos GetSeqStart(TDim row) const
Definition: Seq_align.cpp:252
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
Definition: Seq_align.cpp:294
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
CSpliced_exon_chunk –.
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
API (CDeflineGenerator) for computing sequences' titles ("definitions").
USING_SCOPE(objects)
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
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
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
Definition: Seq_id.cpp:1634
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
CConstRef< CSeq_id > GetSeqId(void) const
EAccessionInfo
For IdentifyAccession (below)
Definition: Seq_id.hpp:220
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ fAcc_prot
Definition: Seq_id.hpp:252
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
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,...
string GetAccessionForId(const objects::CSeq_id &id, CScope &scope, EAccessionVersion use_version=eWithAccessionVersion, EGetIdType flags=0)
Retrieve the accession string for a Seq-id.
Definition: sequence.cpp:708
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
@ eGetId_ForceAcc
return only an accession based seq-id
Definition: sequence.hpp:100
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
Definition: BioSource_.hpp:497
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:509
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
bool IsSetDb(void) const
ids in taxonomic or culture dbases Check if a value has been assigned to Db data member.
Definition: Org_ref_.hpp:479
const TDb & GetDb(void) const
Get the Db member data.
Definition: Org_ref_.hpp:491
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
Definition: Score_.hpp:432
const TProtpos & GetProtpos(void) const
Get the variant data.
bool IsSetFrame(void) const
position within codon (1-based) 0 = not set (meaning 1) Check if a value has been assigned to Frame d...
Definition: Prot_pos_.hpp:248
bool IsProtpos(void) const
Check if variant Protpos is selected.
const TGenomic_id & GetGenomic_id(void) const
Get the Genomic_id member data.
TMatch GetMatch(void) const
Get the variant data.
const TProduct_id & GetProduct_id(void) const
Get the Product_id member data.
bool IsSetScores(void) const
score for each seg Check if a value has been assigned to Scores data member.
Definition: Dense_seg_.hpp:593
TGenomic_start GetGenomic_start(void) const
Get the Genomic_start member data.
TDiag GetDiag(void) const
Get the variant data.
TMismatch GetMismatch(void) const
Get the variant data.
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
bool CanGetProduct_strand(void) const
Check if it is safe to call GetProduct_strand method.
const TParts & GetParts(void) const
Get the Parts member data.
const TProduct_start & GetProduct_start(void) const
Get the Product_start member data.
const TProduct_end & GetProduct_end(void) const
Get the Product_end member data.
TGenomic_ins GetGenomic_ins(void) const
Get the variant data.
bool IsSetGenomic_strand(void) const
Check if a value has been assigned to Genomic_strand data member.
const TScores & GetScores(void) const
Get the Scores member data.
bool IsSetScore(void) const
for whole alignment Check if a value has been assigned to Score data member.
Definition: Seq_align_.hpp:884
TGenomic_end GetGenomic_end(void) const
Get the Genomic_end member data.
const Tdata & Get(void) const
Get the member data.
Definition: Score_set_.hpp:165
TProduct_strand GetProduct_strand(void) const
Get the Product_strand member data.
const TScore & GetScore(void) const
Get the Score member data.
Definition: Seq_align_.hpp:896
const TScores & GetScores(void) const
Get the Scores member data.
Definition: Dense_seg_.hpp:605
TProduct_ins GetProduct_ins(void) const
Get the variant data.
const TId & GetId(void) const
Get the Id member data.
Definition: Score_.hpp:444
bool IsSetScores(void) const
scores for this exon Check if a value has been assigned to Scores data member.
E_Choice Which(void) const
Which variant is currently selected.
@ e_Product_ins
insertion in product sequence (i.e. gap in the genomic sequence)
@ e_Diag
both sequences are represented, there is sufficient similarity between product and genomic sequences....
@ e_Genomic_ins
insertion in genomic sequence (i.e. gap in the product sequence)
@ e_Match
both sequences represented, product and genomic sequences match
@ e_Mismatch
both sequences represented, product and genomic sequences do not match
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ e_Source
source of materials, includes Org-ref
Definition: Seqdesc_.hpp:133
const struct ncbi::grid::netcache::search::fields::KEY key
const char * tag
The Object manager core.
SFlybaseCompareAlignments(CScope &scope)
bool operator()(const pair< CConstRef< CSeq_align >, string > &p1, const pair< CConstRef< CSeq_align >, string > &p2)
Modified on Wed Apr 17 13:08:59 2024 by modify_doxy.py rev. 669887