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

Go to the SVN repository for this file.

1 /* $Id: update_seq_input.cpp 46305 2021-03-10 15:32:24Z asztalos $
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: Andrea Asztalos
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 #include <serial/objistr.hpp>
32 #include <objmgr/scope.hpp>
33 #include <objmgr/seq_vector.hpp>
34 #include <objmgr/bioseq_ci.hpp>
35 #include <objmgr/feat_ci.hpp>
36 #include <objmgr/bioseq_handle.hpp>
42 
45 
56 
57 #include <wx/dataobj.h>
58 #include <wx/clipbrd.h>
59 #include <wx/filedlg.h>
60 
61 
64 
66  : m_Align(0), m_Scope(0)
67 {
68 }
69 
71  : m_OldSeq(old_bsh), m_UpdSeq(upd_bsh), m_Align(0)
72 {
73  m_Scope.Reset(&old_bsh.GetScope());
74  if (&(m_UpdSeq.GetScope()) != m_Scope.GetNCPointer()) {
75  NCBI_THROW(CSeqUpdateException, eInternal, "Both sequences should be in the same scope");
76  }
77 }
78 
80 {
81  // the update sequence should be removed from the scope
82  if (m_UpdSeq) {
83  m_UpdSeq.GetTopLevelEntry().GetEditHandle().Remove();
84  }
85 }
86 
88 {
90 }
91 
93 {
95  return CRef<CSeq_annot>();
96  }
97 
98  CRef<CDense_seg> dense_seg(new CDense_seg);
99  dense_seg->SetDim(2);
100  dense_seg->SetNumseg(1);
101 
102  CRef<CSeq_id> query_id(new CSeq_id);
103  query_id->Assign(*query.GetSeqId());
104  CRef<CSeq_id> subject_id(new CSeq_id);
105  subject_id->Assign(*subject.GetSeqId());
106  dense_seg->SetIds().push_back(query_id);
107  dense_seg->SetIds().push_back(subject_id);
108 
109  dense_seg->SetStarts().push_back(0);
110  dense_seg->SetStarts().push_back(0);
111  dense_seg->SetLens().push_back(subject.GetBioseqLength() - 1);
112 
113  CRef<CSeq_align> align(new CSeq_align);
115  align->SetDim(2);
116  align->SetSegs().SetDenseg(*dense_seg);
117 
118  CRef<CSeq_annot> annot(new CSeq_annot);
119  annot->SetData().SetAlign().push_back(align);
120  CRef<CAnnotdesc> desc(new CAnnotdesc);
121  desc->SetName("Alignment generated between two identical sequences");
122  annot->SetDesc().Set().push_back(desc);
123 
124  return annot;
125 }
126 
128 {
130  if (!workbench) {
131  return false;
132  }
133 
135  if (sel_srv) {
136  sel_srv->GetActiveObjects(objects);
137  }
138  if (objects.empty()) {
139  GetViewObjects(workbench, objects);
140  }
141 
142  if (objects.empty() || objects.size() == 1 || FocusedOnAll(objects, tse)) {
143  NCBI_THROW(CSeqUpdateException, eInternal, "No bioseq selected.");
144  }
145 
146  const CObject* ptr = objects[0].object.GetPointer();
147  const CSeq_loc* loc = dynamic_cast<const CSeq_loc*>(ptr);
148  const CBioseq* bioseq = dynamic_cast<const CBioseq*>(ptr);
149  if (loc) {
150  m_OldSeq = objects[0].scope->GetBioseqHandle(*loc);
151  } else if (bioseq) {
152  m_OldSeq = objects[0].scope->GetBioseqHandle(*bioseq);
153  }
154 
155  if (m_OldSeq) {
156  m_Scope.Reset(&m_OldSeq.GetScope());
157  return true;
158  }
159 
160  return false;
161 }
162 
164 {
165  m_OldSeq = bsh;
166  m_Scope.Reset(&m_OldSeq.GetScope());
167  return true;
168 }
169 
171 {
172  m_UpdSeq = bsh;
173  // colliding IDs have been resolved by now
174  if (&(m_UpdSeq.GetScope()) != m_Scope.GetNCPointer()) {
175  NCBI_THROW(CSeqUpdateException, eInternal, "Both sequences should be in the same scope");
176  }
177  return true;
178 }
179 
181 {
182  m_UpdSeq.Reset();
183  if (m_Align) {
184  m_Align.Reset();
185  }
186 }
187 
189 {
190  _ASSERT(m_OldSeq);
191  _ASSERT(m_UpdSeq);
192  bool accept_atleast_one = false;
193  if (m_OldSeq.GetBioseqLength() < m_UpdSeq.GetBioseqLength()) {
194  accept_atleast_one = true;
195  }
196  auto align_vector = sequpd::RunBlast2Seq(m_OldSeq, m_UpdSeq, accept_atleast_one);
197  if (align_vector.size() > 1) {
198  LOG_POST(Info << "More than one alignment was found");
199  }
200 
201  if (align_vector.empty()) {
202  LOG_POST(Info << "Could not form alignment between old and update sequence");
203  m_Align.Reset();
205  }
206  else {
207  // choose the 'better' alignment
208  size_t best_align = 0;
209  for (size_t i = 0; i < align_vector.size(); ++i) {
210  for (size_t j = i + 1; j < align_vector.size(); ++j) {
211  best_align = sequpd::CompareAlignments(*align_vector[i], *align_vector[j]) ? i : j;
212  }
213  }
214  _ASSERT(best_align < align_vector.size());
215  m_Align.Reset(align_vector[best_align]);
216  }
217 }
218 
220 {
221  bool set_seqs = (m_OldSeq && m_UpdSeq);
222  bool no_mismatch = (m_OldSeq.IsNa() && m_UpdSeq.IsNa()) || (m_OldSeq.IsAa() && m_UpdSeq.IsAa());
223  return (set_seqs && no_mismatch);
224 }
225 
227 {
228  if (!m_UpdSeq)
229  return false;
230 
231  return CFeat_CI(m_UpdSeq);
232 }
233 
235 {
236  if (!m_OldSeq)
237  return false;
238 
239  return CFeat_CI(m_OldSeq);
240 }
241 
243 {
244  if (!m_OldSeq)
245  return false;
246 
247  CBioseq_set_Handle bssh = m_OldSeq.GetParentBioseq_set();
248  if (!bssh)
249  return false;
250 
251  bool has_feat = false;
252  for (CBioseq_CI bseq_it(bssh, CSeq_inst::eMol_aa); bseq_it && !has_feat; ++bseq_it) {
253  for (CFeat_CI feat_it(*bseq_it); feat_it && !has_feat; ++feat_it) {
254  auto feat = feat_it->GetOriginalSeq_feat();
255  if (feat->IsSetData() && feat->GetData().IsProt() && !feat->GetData().GetProt().IsSetProcessed())
256  continue;
257  else
258  has_feat = true;
259  }
260  }
261 
262  return has_feat;
263 }
264 
266 {
267  if (m_UpdSeq) {
268  NCBI_THROW(CSeqUpdateException, eInternal, "The update sequence has already been submitted");
269  }
270 
274 
275 
276  wxFileDialog openDlg(NULL, wxT("Open a file"), wxEmptyString, wxEmptyString, ext, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
277  if (openDlg.ShowModal() != wxID_OK)
278  return false;
279 
280  wxString path = openDlg.GetPath();
281  CNcbiIfstream fstream(path.fn_str(), ios_base::binary);
282  return x_ReadFromStream(fstream, msg_listener);
283 }
284 
286 {
287  CFormatGuess guesser(istr);
291 
293 
295  return x_ReadUpdateSeq_ASN(istr);
296  }
297  else if (format == CFormatGuess::eFasta ||
299  // With high probability, it is a Fasta file without defline
300  try {
301  return x_ReadUpdateSeq_Fasta(istr, msg_listener);
302  }
303  catch (const CSeqUpdateException& e) {
306  "Failed to recognize the format of update sequence. Please try ASN.1 or Fasta.\n" + e.GetMsg());
307  }
308  }
309  }
310  return false;
311 }
312 
314 {
315  if (m_UpdSeq) {
316  NCBI_THROW(CSeqUpdateException, eInternal, "The update sequence has already been submitted");
317  }
318 
319  string file_str = CSimpleClipboard::Instance().Get<string>();
320  CNcbiIstrstream istr(file_str);
321 
322  return x_ReadFromStream(istr, msg_listener);
323 }
324 
325 static const char* kNASeqCouldNotRead = "Failed to read update sequence";
326 
328 {
329 
330  CObjectInfo oi;
331  try {
332  unique_ptr<CObjectIStream> objIstrm(CObjectIStream::Open(eSerial_AsnText, istr, eNoOwnership));
333  oi = objIstrm->ReadObject();
334  }
335  catch (const CException& e) {
336  LOG_POST(Error << e.GetMsg());
338  }
339 
340  if (oi.GetName() == "Bioseq") {
342  if (bseq) {
345  m_UpdSeq = m_Scope->AddBioseq(*bseq);
346  }
347  }
348  else {
349  CRef<CSeq_entry> seq_entry;
350  if (oi.GetName() == "Seq-entry") {
352  seq_entry = Ref(entry);
353  }
354  else if (oi.GetName() == "Seq-submit") {
356  if (seq_submit) {
357  seq_entry = edit::SeqEntryFromSeqSubmit(*seq_submit);
358  }
359  }
360 
361  if (seq_entry) {
362  s_ConvertDeltaToRawEntry(*seq_entry);
363  x_AddNewEntryToScope(seq_entry);
364  }
365  }
366 
367  if (!m_UpdSeq) {
369  }
370 
371  return true;
372 }
373 
375 {
381 
382  CFastaReader fasta_reader(istr, flags);
383  CRef<CSeq_entry> new_entry;
384  try {
385  new_entry = fasta_reader.ReadSet(kMax_Int, msg_listener);
386  }
387  catch (const CException&) {
389  }
390 
391 
392  x_AddNewEntryToScope(new_entry);
393 
394  if (!m_UpdSeq) {
395  if (msg_listener && msg_listener->Count() > 0) {
396  // display only the first error to the user
397  const ILineError& line_err = msg_listener->GetError(0);
398  NCBI_THROW(CSeqUpdateException, eReading, line_err.ErrorMessage());
399  }
400  else {
402  }
403  }
404 
405  return true;
406 }
407 
409 {
410  if (!entry) {
411  return;
412  }
413 
414  entry->Parentize();
415  x_FixCollidingIDs_Entry(*entry);
416  CSeq_entry_Handle seh = m_Scope->AddTopLevelSeqEntry(*entry);
417  CBioseq_CI b_iter(seh, CSeq_inst::eMol_na);
418  if (b_iter) {
419  m_UpdSeq = *b_iter;
420  }
421 }
422 
424 {
425  unsigned int count = 0;
426  if (m_UpdSeq) {
427  for (CBioseq_CI b_iter(m_UpdSeq.GetTopLevelEntry(), CSeq_inst::eMol_na); b_iter; ++b_iter)
428  ++count;
429  }
430  return count;
431 }
432 
434 {
435  if (!lit.IsSetSeq_data()) {
436  return true;
437  }
438 
439  const CSeq_data& data = lit.GetSeq_data();
440  if (!data.IsGap()){
441  return true;
442  }
443 
444  const CSeq_gap& gap = data.GetGap();
445  if (gap.IsSetType() && gap.GetType() == CSeq_gap::eType_unknown) {
446  return !(gap.IsSetLinkage());
447  }
448 
449  return false;
450 }
451 
453 {
454  if (!bseq.IsSetInst())
455  return false;
456 
457  const CBioseq::TInst& inst = bseq.GetInst();
458  if (!inst.IsSetRepr()
459  || inst.GetRepr() != CSeq_inst::eRepr_delta
460  || !inst.IsSetExt()
461  || !inst.GetExt().IsDelta()) {
462  return false;
463  }
464 
465  for (auto&& it : inst.GetExt().GetDelta().Get()) {
466  if (!it->IsLiteral()) {
467  return false;
468  }
469  const CSeq_literal& lit = it->GetLiteral();
470  bool ok = lit.GetLength() > 0 && s_IsGoodLiteral(lit);
471  if (!ok) return false;
472  }
473 
474  return true;
475 }
476 
478 {
479  if (!bseq.IsSetInst())
480  return false;
481 
482  const CBioseq::TInst& inst = bseq.GetInst();
483  if (!inst.IsSetRepr()
484  || inst.GetRepr() != CSeq_inst::eRepr_delta
485  || !inst.IsSetExt()
486  || !inst.GetExt().IsDelta()) {
487  return false;
488  }
489 
490  for (auto&& it : inst.GetExt().GetDelta().Get()) {
491  if (!it->IsLoc()) {
492  return false;
493  }
494  }
495  return true;
496 }
497 
499 {
500  if (entry.IsSet() && entry.GetSet().IsSetSeq_set()) {
503  }
504  }
505  else if (entry.IsSeq() && entry.GetSeq().IsNa()) {
506  CBioseq& bseq = entry.SetSeq();
508  }
509 }
510 
512 {
513  _ASSERT(bseq.IsNa());
514  if (!s_IsDeltaWithNoGaps(bseq)) {
515  return;
516  }
517 
518  CSeqVector seq_vec(bseq);
520  string seqdata;
521  seq_vec.GetSeqData(0, bseq.GetLength(), seqdata);
522 
523  bseq.SetInst().ResetExt();
524  bseq.SetInst().SetRepr(objects::CSeq_inst::eRepr_raw);
525  bseq.SetInst().SetSeq_data().SetIupacna().Set(seqdata);
526  CSeqportUtil::Pack(&bseq.SetInst().SetSeq_data());
527  bseq.SetInst().SetLength(TSeqPos(seqdata.length()));
528 
529 }
530 
532 {
533  if (entry.IsSet() && entry.GetSet().IsSetSeq_set()) {
535  s_FixCollidingIDs_Entry(**set, seq_ids);
536  }
537  }
538  else if (entry.IsSeq() && entry.GetSeq().IsNa()) {
539  CBioseq& bseq = entry.SetSeq();
540  sequpd::FixCollidingIDs_Bioseq(bseq, seq_ids);
541  }
542 }
543 
544 static void s_CollectCollidingIDs_Entry(CSeq_entry& entry, CBioseq::TId& seq_ids, CScope &scope)
545 {
546  if (entry.IsSet() && entry.GetSet().IsSetSeq_set()) {
548  s_CollectCollidingIDs_Entry(**set, seq_ids, scope);
549  }
550  }
551  else if (entry.IsSeq() && entry.GetSeq().IsNa()) {
552  CBioseq& bseq = entry.SetSeq();
553  ITERATE(CBioseq::TId, upd_id, bseq.GetId())
554  {
555  CBioseq_Handle bsh = scope.GetBioseqHandle(**upd_id);
556  if (bsh)
557  seq_ids.push_back(*upd_id);
558  }
559  }
560 }
561 
563 {
564  CBioseq::TId old_ids;
565  s_CollectCollidingIDs_Entry(entry, old_ids, m_OldSeq.GetScope());
566  s_FixCollidingIDs_Entry(entry, old_ids);
567  entry.ReassignConflictingIds(); // for fixing possible duplicates among protein ids
568 }
569 
571 {
572  CBioseq::TId old_ids;
573  CScope &scope = m_OldSeq.GetScope();
574  ITERATE(CBioseq::TId, upd_id, bseq.GetId())
575  {
576  CBioseq_Handle bsh = scope.GetBioseqHandle(**upd_id);
577  if (bsh)
578  old_ids.push_back(*upd_id);
579  }
580 
581  sequpd::FixCollidingIDs_Bioseq(bseq, old_ids);
582 }
583 
585 {
586  if (m_UpdSeq) {
587  NCBI_THROW(CSeqUpdateException, eInternal, "The update sequence has already been submitted");
588  }
589 
590  CLoadSeqFromEntrez_dlg seq_dlg(NULL);
591  if (seq_dlg.ShowModal() == wxID_OK) {
592  string acc_id = seq_dlg.GetData();
593  if (!NStr::IsBlank(acc_id)) {
594  return x_ReadAccession(acc_id);
595  }
596  }
597  return false;
598 }
599 
600 
601 bool CUpdateSeq_Input::x_ReadAccession(const string& acc_id)
602 {
603  CSeq_id id;
604  try {
605  id.Set(acc_id);
606  }
607  catch (const CSeqIdException&) {
608  string msg = "'" + acc_id + "' is not a valid accession";
609  NcbiMessageBox(msg);
610  return false;
611  }
612 
613  // retrieve the sequence
614  m_UpdSeq = m_Scope->GetBioseqHandle(id);
615  if(!m_UpdSeq) {
616  string msg = "Failed to load sequence for accession '" + acc_id + "'";
617  NcbiMessageBox(msg);
618  return false;
619  }
620 
621 
622  CSeq_id::E_Choice feat_id_type = CSeq_id::e_not_set;
623  CFeat_CI feat_it(m_UpdSeq);
624  if (feat_it) {
625  feat_id_type = feat_it->GetLocationId().Which();
626  }
627 
628  if (id.Which() != feat_id_type && feat_id_type != CSeq_id::e_not_set) {
629  CConstRef<CBioseq> bseq = m_UpdSeq.GetCompleteBioseq();
630  ITERATE (CBioseq::TId, id_iter, bseq->GetId()) {
631  if ((*id_iter)->Which() == feat_id_type){
632  m_UpdSeq = m_Scope->GetBioseqHandle(**id_iter);
633  }
634  }
635  }
636  if (m_UpdSeq.IsNa() && s_IsDeltaWithNoGaps(*m_UpdSeq.GetCompleteBioseq()))
637  {
638  CSeqVector seq_vec = m_UpdSeq.GetSeqVector(CBioseq_Handle::eCoding_Iupac);
639  string seqdata;
640  seq_vec.GetSeqData(0, m_UpdSeq.GetBioseqLength(), seqdata);
641  CRef<CSeq_inst> new_inst(new CSeq_inst);
642  new_inst->Assign(m_UpdSeq.GetInst());
643  new_inst->ResetExt();
644  new_inst->SetRepr(objects::CSeq_inst::eRepr_raw);
645  new_inst->SetSeq_data().SetIupacna().Set(seqdata);
646  CSeqportUtil::Pack(&(new_inst->SetSeq_data()));
647  new_inst->SetLength(TSeqPos(seqdata.length()));
648  CBioseq_EditHandle bseh = m_UpdSeq.GetEditHandle();
649  bseh.SetInst(*new_inst);
650  }
651  return true;
652 }
653 
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
CAnnotdesc –.
Definition: Annotdesc.hpp:66
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_EditHandle –.
CBioseq_Handle –.
CBioseq_set_Handle –.
TSeqPos GetLength(void) const
Definition: Bioseq.cpp:360
bool IsNa(void) const
Definition: Bioseq.cpp:345
Base class for reading FASTA sequences.
Definition: fasta.hpp:80
CFeat_CI –.
Definition: feat_ci.hpp:64
static wxString GetDialogFilter(EFileType fileType)
CFormatHints & AddPreferredFormat(TFormat fmt)
Mark the format as preferred.
CFormatHints & DisableAllNonpreferred(void)
Disable all formats not marked as preferred.
Class implements different ad-hoc unreliable file format identifications.
CFormatHints & GetFormatHints(void)
Get format hints.
EFormat
The formats are checked in the same order as declared here.
@ eFasta
FASTA format sequence record, CFastaReader.
@ eUnknown
unknown format
@ eTextASN
Text ASN.1.
EFormat GuessFormat(EMode)
CObjectInfo –.
Definition: objectinfo.hpp:597
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
CSeqIdException –.
Definition: Seq_id.hpp:1001
Sequence update exception class.
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
void ReassignConflictingIds(void)
Definition: Seq_entry.cpp:548
void Parentize(void)
Definition: Seq_entry.cpp:71
static TSeqPos Pack(CSeq_data *in_seq, TSeqPos uLength=ncbi::numeric_limits< TSeqPos >::max())
static CSimpleClipboard & Instance()
bool IsReadyForUpdate(void) const
bool x_ReadUpdateSeq_ASN(CNcbiIstream &istr)
bool SetOldBioseqAndScope(IWorkbench *workbench, const objects::CSeq_entry_Handle &tse)
bool SetUpdateBioseq(const objects::CBioseq_Handle &bsh)
unsigned int CountBioseqs()
void CalculateAlignmentForUnitTest(void)
Calculates the alignment between the old and the update sequence, sets m_Align member.
objects::CBioseq_Handle m_UpdSeq
bool OldSeqHasProteinFeats() const
static void s_FixCollidingIDs_Entry(objects::CSeq_entry &entry, const objects::CBioseq::TId &seq_ids)
When the old and the update sequences have the same ID, the ID of the update sequence is modified.
static void s_ConvertDeltaToRawEntry(objects::CSeq_entry &entry)
Converts delta literals to raw sequence, applies only to NA sequences.
bool x_ReadAccession(const string &acc_id)
bool ReadSingleAccession(void)
Reads single update sequence identified by an accession.
bool ReadSingleUpdateSequence(objects::ILineErrorListener *msg_listener)
Reads (ASN.1 or FASTA) single update sequence from a file.
bool x_ReadUpdateSeq_Fasta(CNcbiIstream &istr, objects::ILineErrorListener *msg_listener)
bool UpdateSeqHasFeatures(void) const
static bool s_IsDeltaWithFarPointers(const objects::CBioseq &bseq)
void x_FixCollidingIDs_Entry(objects::CSeq_entry &entry)
CRef< objects::CScope > m_Scope
objects::CBioseq_Handle m_OldSeq
void x_AddNewEntryToScope(CRef< objects::CSeq_entry > entry)
Function fixes colliding IDs, add the update entry to the scope and sets m_UpdSeq member.
bool HaveIdenticalResidues(void) const
static CRef< objects::CSeq_annot > s_Align2IdenticalSeq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query)
static void s_ConvertDeltaToRawBioseq(objects::CBioseq &bseq)
void x_FixCollidingIDs_Bioseq(objects::CBioseq &bioseq)
bool ReadUpdateSequenceFromClipboard(objects::ILineErrorListener *msg_listener)
Reads single update sequence from the clipboard. It supports FASTA and text ASN formats.
CConstRef< objects::CSeq_align > m_Align
bool OldSeqHasFeatures(void) const
static bool s_IsGoodLiteral(const objects::CSeq_literal &lit)
static bool s_IsDeltaWithNoGaps(const objects::CBioseq &bseq)
bool x_ReadFromStream(CNcbiIstream &istr, objects::ILineErrorListener *msg_listener)
virtual size_t Count() const =0
virtual const ILineError & GetError(size_t) const =0
0-based error retrieval.
virtual const string & ErrorMessage() const
Definition: line_error.cpp:140
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
static bool CompareAlignments(const objects::CSeq_align &align_first, const objects::CSeq_align &align_sec)
Returns true if the first alignment is 'better' than the second one Compares the Blast scores and in ...
Definition: sequpd.cpp:613
static vector< CConstRef< objects::CSeq_align > > RunBlast2Seq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query, bool accept_atleast_one, ICanceled *canceled=nullptr)
Definition: sequpd.cpp:351
static bool HaveIdenticalResidues(const objects::CBioseq_Handle &bsh1, const objects::CBioseq_Handle &bsh2)
Definition: sequpd.cpp:92
static void FixCollidingIDs_Bioseq(objects::CBioseq &bseq, const objects::CBioseq::TId &seq_ids)
Definition: sequpd.cpp:139
Definition: set.hpp:45
static uch flags
Operators to edit gaps in sequences.
char data[12]
Definition: iconv.c:80
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
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
@ eNoOwnership
No ownership is assumed.
Definition: ncbi_types.h:135
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
TErrCode GetErrCode(void) const
Get error code.
Definition: ncbiexpt.cpp:453
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
Definition: message_box.cpp:48
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static const TObjectType * SafeCast(TTypeInfo type)
Definition: serialutil.hpp:76
@ eSerial_AsnText
ASN.1 text.
Definition: serialdef.hpp:73
CRef< CSeq_entry > ReadSet(int max_seqs=kMax_Int, ILineErrorListener *pMessageListener=nullptr)
Read multiple sequences (by default, as many as are available.)
Definition: fasta.cpp:442
long TFlags
binary OR of EFlags
Definition: fasta.hpp:117
@ fDLOptional
Don't require a leading defline.
Definition: fasta.hpp:96
@ fHyphensIgnoreAndWarn
When a hyphen is encountered in seq data, ignore it but warn.
Definition: fasta.hpp:112
@ fNoSplit
Don't split out ambiguous sequence regions.
Definition: fasta.hpp:99
@ fAssumeNuc
Assume nucs unless accns indicate otherwise.
Definition: fasta.hpp:87
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
CSeq_id & Set(const CTempString &the_id, TParseFlags flags=fParse_AnyRaw)
Reassign based on flat specifications; arguments interpreted as with constructors.
Definition: Seq_id.cpp:2457
CSeq_id::E_Choice Which(void) const
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
Definition: objistr.cpp:195
const string & GetName(void) const
Get type name.
Definition: objectinfo.hpp:106
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
void SetInst(TInst &v) const
CScope & GetScope(void) const
Get scope this handle belongs to.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
CSeq_id_Handle GetLocationId(void) const
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
void SetCoding(TCoding coding)
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:1401
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1174
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define kMax_Int
Definition: ncbi_limits.h:184
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
TLens & SetLens(void)
Assign a value to Lens data member.
Definition: Dense_seg_.hpp:561
void SetSegs(TSegs &value)
Assign a value to Segs data member.
Definition: Seq_align_.cpp:310
void SetDim(TDim value)
Assign a value to Dim data member.
Definition: Seq_align_.hpp:865
void SetDim(TDim value)
Assign a value to Dim data member.
Definition: Dense_seg_.hpp:427
void SetType(TType value)
Assign a value to Type data member.
Definition: Seq_align_.hpp:818
TStarts & SetStarts(void)
Assign a value to Starts data member.
Definition: Dense_seg_.hpp:536
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
Definition: Dense_seg_.hpp:474
TIds & SetIds(void)
Assign a value to Ids data member.
Definition: Dense_seg_.hpp:511
@ eType_partial
mapping pieces together
Definition: Seq_align_.hpp:103
E_Choice
Choice variants.
Definition: Seq_id_.hpp:93
@ e_not_set
No variant selected.
Definition: Seq_id_.hpp:94
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
TSet & SetSet(void)
Select the variant.
Definition: Seq_entry_.cpp:130
const TSet & GetSet(void) const
Get the variant data.
Definition: Seq_entry_.cpp:124
bool IsSeq(void) const
Check if variant Seq is selected.
Definition: Seq_entry_.hpp:257
bool IsSetSeq_set(void) const
Check if a value has been assigned to Seq_set data member.
bool IsSet(void) const
Check if variant Set is selected.
Definition: Seq_entry_.hpp:263
list< CRef< CSeq_entry > > TSeq_set
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
bool IsSetLinkage(void) const
Check if a value has been assigned to Linkage data member.
Definition: Seq_gap_.hpp:310
TRepr GetRepr(void) const
Get the Repr member data.
Definition: Seq_inst_.hpp:565
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_annot_.cpp:244
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
void SetDesc(TDesc &value)
Assign a value to Desc data member.
Definition: Seq_annot_.cpp:223
bool IsSetRepr(void) const
Check if a value has been assigned to Repr data member.
Definition: Seq_inst_.hpp:546
TType GetType(void) const
Get the Type member data.
Definition: Seq_gap_.hpp:282
const TId & GetId(void) const
Get the Id member data.
Definition: Bioseq_.hpp:290
TName & SetName(void)
Select the variant.
Definition: Annotdesc_.hpp:508
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
Definition: Seq_inst_.hpp:826
bool IsSetInst(void) const
the sequence data Check if a value has been assigned to Inst data member.
Definition: Bioseq_.hpp:324
TLength GetLength(void) const
Get the Length member data.
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
bool IsDelta(void) const
Check if variant Delta is selected.
Definition: Seq_ext_.hpp:336
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
Definition: Seq_gap_.hpp:263
const TExt & GetExt(void) const
Get the Ext member data.
Definition: Seq_inst_.hpp:838
const TDelta & GetDelta(void) const
Get the variant data.
Definition: Seq_ext_.cpp:180
void SetRepr(TRepr value)
Assign a value to Repr data member.
Definition: Seq_inst_.hpp:574
const Tdata & Get(void) const
Get the member data.
Definition: Delta_ext_.hpp:164
bool IsSetSeq_data(void) const
may have the data Check if a value has been assigned to Seq_data data member.
void SetLength(TLength value)
Assign a value to Length data member.
Definition: Seq_inst_.hpp:668
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
Definition: Seq_inst_.cpp:130
void ResetExt(void)
Reset Ext data member.
Definition: Seq_inst_.cpp:142
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
@ eRepr_delta
sequence made by changes (delta) to others
Definition: Seq_inst_.hpp:100
@ e_Iupacna
IUPAC 1 letter nuc acid code.
Definition: Seq_data_.hpp:104
@ eMol_na
just a nucleic acid
Definition: Seq_inst_.hpp:113
int i
void GetViewObjects(IWorkbench *workbench, TConstScopedObjects &objects)
bool FocusedOnAll(TConstScopedObjects &objects, const objects::CSeq_entry_Handle &tse)
#define wxT(x)
Definition: muParser.cpp:41
static Format format
Definition: njn_ioutil.cpp:53
CRef< CSeq_entry > SeqEntryFromSeqSubmit(const CSeq_submit &submit)
Create a Seq-entry from a Seq-submit.
Utility macros and typedefs for exploring NCBI objects from seq.asn.
static string subject
static string query
#define _ASSERT
USING_SCOPE(objects)
static const char * kNASeqCouldNotRead
static void s_CollectCollidingIDs_Entry(CSeq_entry &entry, CBioseq::TId &seq_ids, CScope &scope)
Modified on Wed Jun 19 17:07:00 2024 by modify_doxy.py rev. 669887