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

Go to the SVN repository for this file.

1 /* $Id: data_manager.cpp 93192 2021-03-15 17:50:30Z hurwitz $
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: Paul Thiessen
27 *
28 * File Description:
29 * class to manage different root ASN data types
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 #include <serial/iterator.hpp>
37 
49 #include <objects/cdd/Cdd_id.hpp>
54 
56 
57 #include "asn_reader.hpp"
58 #include "data_manager.hpp"
59 #include "structure_set.hpp"
60 #include "sequence_set.hpp"
61 #include "alignment_set.hpp"
62 #include "cn3d_tools.hpp"
63 
65 
68 
69 
70 BEGIN_SCOPE(Cn3D)
71 
73 {
74  mimeData.Reset(mime);
75  Load();
76 }
77 
78 ASNDataManager::ASNDataManager(ncbi::objects::CCdd *cdd)
79 {
80  cddData.Reset(cdd);
81  Load();
82 }
83 
85 {
86 }
87 
89 {
90  // initialization
94  biostrucModelType = eModel_type_ncbi_all_atom; // default, for CDD's
98  cddUpdates = NULL;
99  dataChanged = 0;
100 
101  // remove consensus sequence, then do a check over the whole tree to make sure any reference to it is gone
102  if (GetInternalCDDData()) {
105  if (i->IsLocal() && i->GetLocal().IsStr() && i->GetLocal().GetStr() == "consensus") {
106  WARNINGMSG("ASNDataManager::Load() - consensus still referenced in the data: " << i.GetContext());
107  break;
108  }
109  }
110  } else if (mimeData.NotEmpty()) {
111  for (CTypeConstIterator < CSeq_id > i(ConstBegin(mimeData.GetObject())); i; ++i) {
112  if (i->IsLocal() && i->GetLocal().IsStr() && i->GetLocal().GetStr() == "consensus") {
113  WARNINGMSG("ASNDataManager::Load() - a consensus is present in the data: " << i.GetContext());
114  break;
115  }
116  }
117  }
118 
119  // mime
120  if (mimeData.NotEmpty()) {
121  if (mimeData->IsEntrez()) {
122  if (mimeData->GetEntrez().GetData().IsStructure())
123  masterBiostruc = &(mimeData->SetEntrez().SetData().SetStructure());
124  }
125 
126  else if (mimeData->IsAlignstruc()) {
127  seqEntryList = &(mimeData->SetAlignstruc().SetSequences());
128  masterBiostruc = &(mimeData->SetAlignstruc().SetMaster());
129  biostrucList = &(mimeData->SetAlignstruc().SetSlaves());
130  structureAlignments = &(mimeData->SetAlignstruc().SetAlignments());
131  sequenceAlignments = &(mimeData->SetAlignstruc().SetSeqalign());
132  }
133 
134  else if (mimeData->IsAlignseq()) {
135  seqEntryList = &(mimeData->SetAlignseq().SetSequences());
136  sequenceAlignments = &(mimeData->SetAlignseq().SetSeqalign());
137  }
138 
139  else if (mimeData->IsStrucseq()) {
140  seqEntryList = &(mimeData->SetStrucseq().SetSequences());
141  masterBiostruc = &(mimeData->SetStrucseq().SetStructure());
142  }
143 
144  else if (mimeData->IsStrucseqs()) {
145  seqEntryList = &(mimeData->SetStrucseqs().SetSequences());
146  masterBiostruc = &(mimeData->SetStrucseqs().SetStructure());
147  sequenceAlignments = &(mimeData->SetStrucseqs().SetSeqalign());
148  }
149 
150  else if (mimeData->IsGeneral()) {
151  if (mimeData->GetGeneral().IsSetStructures())
152  biostrucList = &(mimeData->SetGeneral().SetStructures());
153 
154  if (mimeData->GetGeneral().IsSetStructure_type())
155  // assume structure-type values match MMDB's Model-type
156  biostrucModelType = (EModel_type) mimeData->GetGeneral().GetStructure_type();
157 
158  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle()) {
159  if (mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetSequences())
160  seqEntryList = &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetSequences());
161  if (mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetStrucaligns())
163  &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetStrucaligns());
164  if (mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetSeqaligns())
166  &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetSeqaligns());
167  if (mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetImports()) {
168  bundleImports = &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetImports());
169  // make "fake" Update-aligns from imports (to pass to alignment manager)
170  SeqAnnotList::iterator i,
171  ie = mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetImports().end();
172  for (i=mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetImports().begin();
173  i!= ie; ++i) {
175  update->SetSeqannot(**i);
176  update->SetType(CUpdate_align::eType_other);
177  bundleImportsFaked.push_back(update);
178  }
179  }
180  }
181 
182  else { // cdd
183  if (mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetSequences()) {
184  if (mimeData->GetGeneral().GetSeq_align_data().GetCdd().GetSequences().IsSeq()) {
185  // convert Seq-entry type from seq to set
186  CRef < CSeq_entry > seqEntry(
187  &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetSequences()));
188  mimeData->SetGeneral().SetSeq_align_data().SetCdd().ResetSequences();
189  mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetSequences().
190  SetSet().SetSeq_set().push_back(seqEntry);
191  }
192  seqEntryList =
193  &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetSequences().SetSet().SetSeq_set());
194  }
195  if (mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetFeatures())
196  structureAlignments = &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetFeatures());
197  if (mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetSeqannot())
198  sequenceAlignments = &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetSeqannot());
199  if (mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetPending())
200  cddUpdates = &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetPending());
201  }
202  }
203 
204  else
205  ERRORMSG("Unrecognized mime type!");
206  }
207 
208  // CDD
209  else {
210  if (cddData->IsSetSequences()) {
211  if (cddData->GetSequences().IsSeq()) {
212  // convert Seq-entry type from seq to set
213  CRef < CSeq_entry > seqEntry(&(cddData->SetSequences()));
214  cddData->ResetSequences();
215  cddData->SetSequences().SetSet().SetSeq_set().push_back(seqEntry);
216  }
217  seqEntryList = &(cddData->SetSequences().SetSet().SetSeq_set());
218  }
219  if (cddData->IsSetFeatures())
220  structureAlignments = &(cddData->SetFeatures());
221  if (cddData->IsSetSeqannot())
222  sequenceAlignments = &(cddData->SetSeqannot());
223  if (cddData->IsSetPending())
224  cddUpdates = &(cddData->SetPending());
225  }
226 
227  // sequence list is interpreted differently for single structure
228  isSingleStructure = (mimeData.NotEmpty() &&
229  (mimeData->IsStrucseq() ||
230  (mimeData->IsGeneral() &&
232  biostrucList && biostrucList->size() == 1)));
233  TRACEMSG("is single structure: " << (isSingleStructure ? "yes" : "no"));
234 
235  // pre-screen sequence alignments to make sure they're all a type we can deal with
236  if (sequenceAlignments) {
237  list < CRef < CSeq_align > > validAlignments;
238  SeqAnnotList::const_iterator n, ne = sequenceAlignments->end();
239  for (n=sequenceAlignments->begin(); n!=ne; ++n) {
240 
241  if (!n->GetObject().GetData().IsAlign()) {
242  ERRORMSG("Warning - confused by seqannot data format");
243  continue;
244  }
245  if (n != sequenceAlignments->begin()) TRACEMSG("multiple Seq-annots");
246 
247  CSeq_annot::C_Data::TAlign::const_iterator
248  a, ae = n->GetObject().GetData().GetAlign().end();
249  for (a=n->GetObject().GetData().GetAlign().begin(); a!=ae; ++a) {
250 
251  // verify this is a type of alignment we can deal with
252  if (!(a->GetObject().GetType() != CSeq_align::eType_partial ||
253  a->GetObject().GetType() != CSeq_align::eType_diags) ||
254  !a->GetObject().IsSetDim() || a->GetObject().GetDim() != 2 ||
255  (!a->GetObject().GetSegs().IsDendiag() && !a->GetObject().GetSegs().IsDenseg())) {
256  ERRORMSG("Warning - confused by alignment type");
257  continue;
258  }
259  validAlignments.push_back(*a);
260  }
261  }
262 
263  sequenceAlignments->clear();
264  if (validAlignments.size() == 0) {
265  ERRORMSG("Warning - no valid Seq-aligns present");
267  } else {
269  // copy list of valid alignments only
270  sequenceAlignments->front()->SetData().SetAlign() = validAlignments;
271  }
272  }
273 }
274 
276 {
277  CCdd *cdd = GetInternalCDDData();
278  if (!cdd)
279  return;
280 
281  int result = cd_utils::PurgeConsensusSequences((cd_utils::CCdCore *) cdd, true);
282  TRACEMSG("PurgeConsensusSequences() removed " << result << " sequence(s)");
283 // string err;
284 // WriteASNToFile("Cdd.txt", *cdd, false, &err);
285 }
286 
288 {
289  // if we have CDD data already, this is really easy
290  if (IsCDDInMime()) {
291  cddData.Reset(GetInternalCDDData());
292  }
293  else if (IsCDD()){
294  return true; // nothing to do
295  }
296 
297  // otherwise, splice together from mime data
298  else {
299  CRef < CCdd > cdd(new CCdd());
300  cdd->SetName(cddName);
301 
302  // make up a local id
303  static int localID = 1;
304  CRef < CCdd_id > id(new CCdd_id());
305  cdd->SetId().Set().push_back(id);
306  CNcbiOstrstream oss;
307  oss << "loc_" << localID++;
308  id->SetGid().SetAccession((string) CNcbiOstrstreamToString(oss));
309 
310  // fill in data
311  if (!seqEntryList) {
312  ERRORMSG("can't find sequences to put into new Cdd");
313  return false;
314  }
315  cdd->SetSequences().SetSet().SetSeq_set() = *seqEntryList;
316  if (!sequenceAlignments) {
317  ERRORMSG("can't find sequence alignments to put into new Cdd");
318  return false;
319  }
320  cdd->SetSeqannot() = *sequenceAlignments;
322  cdd->SetFeatures(*structureAlignments);
323  if (cddUpdates)
324  cdd->SetPending() = *cddUpdates;
325  if (bundleImportsFaked.size() > 0)
326  cdd->SetPending().splice(cdd->SetPending().end(), bundleImportsFaked);
327 
328  cddData.Reset(cdd.GetPointer());
329  }
330 
331  mimeData.Reset();
332  Load();
333  return true;
334 }
335 
337 {
338  // if necessary, convert mime data into general type that has a place for alignments
339  if (!sequenceAlignments && mimeData.NotEmpty() && !mimeData->IsGeneral())
341 
342  if (!sequenceAlignments && mimeData.NotEmpty() && mimeData->IsGeneral() &&
343  mimeData->GetGeneral().GetSeq_align_data().IsBundle())
345  &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetSeqaligns());
346  return sequenceAlignments;
347 }
348 
350 {
351  if (mimeData.NotEmpty()) {
352  if (mimeData->IsAlignstruc() && mimeData->GetAlignstruc().IsSetStyle_dictionary())
353  return &(mimeData->GetAlignstruc().GetStyle_dictionary());
354  else if (mimeData->IsAlignseq() && mimeData->GetAlignseq().IsSetStyle_dictionary())
355  return &(mimeData->GetAlignseq().GetStyle_dictionary());
356  else if (mimeData->IsStrucseq() && mimeData->GetStrucseq().IsSetStyle_dictionary())
357  return &(mimeData->GetStrucseq().GetStyle_dictionary());
358  else if (mimeData->IsStrucseqs() && mimeData->GetStrucseqs().IsSetStyle_dictionary())
359  return &(mimeData->GetStrucseqs().GetStyle_dictionary());
360  else if (mimeData->IsGeneral()) {
361  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle() &&
362  mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetStyle_dictionary())
363  return &(mimeData->GetGeneral().GetSeq_align_data().GetBundle().GetStyle_dictionary());
364  else if (mimeData->GetGeneral().GetSeq_align_data().IsCdd() &&
365  mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetStyle_dictionary())
366  return &(mimeData->GetGeneral().GetSeq_align_data().GetCdd().GetStyle_dictionary());
367  }
368  } else if (cddData->IsSetStyle_dictionary())
369  return &(cddData->GetStyle_dictionary());
370 
371  return NULL;
372 }
373 
374 void ASNDataManager::SetStyleDictionary(ncbi::objects::CCn3d_style_dictionary& styles)
375 {
376  if (mimeData.NotEmpty()) {
377  if (mimeData->IsAlignstruc()) mimeData->SetAlignstruc().SetStyle_dictionary(styles);
378  else if (mimeData->IsAlignseq()) mimeData->SetAlignseq().SetStyle_dictionary(styles);
379  else if (mimeData->IsStrucseq()) mimeData->SetStrucseq().SetStyle_dictionary(styles);
380  else if (mimeData->IsStrucseqs()) mimeData->SetStrucseqs().SetStyle_dictionary(styles);
381  else if (mimeData->IsGeneral()) {
382  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle())
383  mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetStyle_dictionary(styles);
384  else
385  mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetStyle_dictionary(styles);
386  }
387  } else
388  cddData->SetStyle_dictionary(styles);
389 }
390 
392 {
393  if (mimeData.NotEmpty()) {
394  if (mimeData->IsAlignstruc()) mimeData->SetAlignstruc().ResetStyle_dictionary();
395  else if (mimeData->IsAlignseq()) mimeData->SetAlignseq().ResetStyle_dictionary();
396  else if (mimeData->IsStrucseq()) mimeData->SetStrucseq().ResetStyle_dictionary();
397  else if (mimeData->IsStrucseqs()) mimeData->SetStrucseqs().ResetStyle_dictionary();
398  else if (mimeData->IsGeneral()) {
399  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle())
400  mimeData->SetGeneral().SetSeq_align_data().SetBundle().ResetStyle_dictionary();
401  else
402  mimeData->SetGeneral().SetSeq_align_data().SetCdd().ResetStyle_dictionary();
403  }
404  } else
405  cddData->ResetStyle_dictionary();
406 }
407 
409 {
410  if (mimeData.NotEmpty()) {
411  if (mimeData->IsAlignstruc() && mimeData->GetAlignstruc().IsSetUser_annotations())
412  return &(mimeData->GetAlignstruc().GetUser_annotations());
413  else if (mimeData->IsAlignseq() && mimeData->GetAlignseq().IsSetUser_annotations())
414  return &(mimeData->GetAlignseq().GetUser_annotations());
415  else if (mimeData->IsStrucseq() && mimeData->GetStrucseq().IsSetUser_annotations())
416  return &(mimeData->GetStrucseq().GetUser_annotations());
417  else if (mimeData->IsStrucseqs() && mimeData->GetStrucseqs().IsSetUser_annotations())
418  return &(mimeData->GetStrucseqs().GetUser_annotations());
419  else if (mimeData->IsGeneral()) {
420  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle() &&
421  mimeData->GetGeneral().GetSeq_align_data().GetBundle().IsSetUser_annotations())
422  return &(mimeData->GetGeneral().GetSeq_align_data().GetBundle().GetUser_annotations());
423  else if (mimeData->GetGeneral().GetSeq_align_data().IsCdd() &&
424  mimeData->GetGeneral().GetSeq_align_data().GetCdd().IsSetUser_annotations())
425  return &(mimeData->GetGeneral().GetSeq_align_data().GetCdd().GetUser_annotations());
426  }
427  } else if (cddData->IsSetUser_annotations())
428  return &(cddData->GetUser_annotations());
429 
430  return NULL;
431 }
432 
433 void ASNDataManager::SetUserAnnotations(ncbi::objects::CCn3d_user_annotations& annots)
434 {
435  if (mimeData.NotEmpty()) {
436  if (mimeData->IsAlignstruc()) mimeData->SetAlignstruc().SetUser_annotations(annots);
437  else if (mimeData->IsAlignseq()) mimeData->SetAlignseq().SetUser_annotations(annots);
438  else if (mimeData->IsStrucseq()) mimeData->SetStrucseq().SetUser_annotations(annots);
439  else if (mimeData->IsStrucseqs()) mimeData->SetStrucseqs().SetUser_annotations(annots);
440  else if (mimeData->IsGeneral()) {
441  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle())
442  mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetUser_annotations(annots);
443  else
444  mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetUser_annotations(annots);
445  }
446  } else
447  cddData->SetUser_annotations(annots);
448 }
449 
451 {
452  if (mimeData.NotEmpty()) {
453  if (mimeData->IsAlignstruc()) mimeData->SetAlignstruc().ResetUser_annotations();
454  else if (mimeData->IsAlignseq()) mimeData->SetAlignseq().ResetUser_annotations();
455  else if (mimeData->IsStrucseq()) mimeData->SetStrucseq().ResetUser_annotations();
456  else if (mimeData->IsStrucseqs()) mimeData->SetStrucseqs().ResetUser_annotations();
457  else if (mimeData->IsGeneral()) {
458  if (mimeData->GetGeneral().GetSeq_align_data().IsBundle())
459  mimeData->SetGeneral().SetSeq_align_data().SetBundle().ResetUser_annotations();
460  else
461  mimeData->SetGeneral().SetSeq_align_data().SetCdd().ResetUser_annotations();
462  }
463  } else
464  cddData->ResetUser_annotations();
465 }
466 
467 void ASNDataManager::SetStructureAlignments(ncbi::objects::CBiostruc_annot_set *strucAligns)
468 {
469  if (mimeData.NotEmpty() && mimeData->IsGeneral() && mimeData->GetGeneral().GetSeq_align_data().IsBundle()) {
470  if (strucAligns)
471  mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetStrucaligns(*strucAligns);
472  else
473  mimeData->SetGeneral().SetSeq_align_data().SetBundle().ResetStrucaligns();
474  } else if (GetInternalCDDData()) {
475  if (strucAligns)
476  GetInternalCDDData()->SetFeatures(*strucAligns);
477  else
478  GetInternalCDDData()->ResetFeatures();
479  } else
480  ERRORMSG("ASNDataManager::SetStructureAlignments() - can't add to this data type");
481  structureAlignments = strucAligns;
482 }
483 
484 bool ASNDataManager::AddBiostrucToASN(ncbi::objects::CBiostruc *biostruc)
485 {
486  // if can't store add'l Biostrucs currently, try to convert to general mime if possible
487  if (!biostrucList && mimeData.NotEmpty() && !mimeData->IsGeneral())
489 
490  // add structure to list if there is one
491  if (biostrucList) {
492  biostrucList->push_back(CRef<CBiostruc>(biostruc));
493  return true;
494  }
495 
496  // if this is a CDD, we never store Biostrucs; but return true to pretend success
497  if (IsCDD()) return true;
498 
499  return false;
500 }
501 
503 {
504  if (mimeData.Empty() || mimeData->IsGeneral()) {
505  ERRORMSG("ASNDataManager::ConvertMimeToGeneral() - can't convert to general mime type");
506  return false;
507  }
508 
509  CNcbi_mime_asn1 *newMime = new CNcbi_mime_asn1();
510 
511  // copy structures
512  if (biostrucList)
513  newMime->SetGeneral().SetStructures() = *biostrucList; // copy list
514  if (masterBiostruc) {
515  newMime->SetGeneral().SetStructures().push_front(CRef<CBiostruc>(masterBiostruc));
517  }
518  biostrucList = (newMime->GetGeneral().GetStructures().size() > 0) ?
519  &(newMime->SetGeneral().SetStructures()) : NULL;
520 
521  // copy alignment data into bundle
523  newMime->SetGeneral().SetSeq_align_data().SetBundle(*bundle);
524  if (seqEntryList) {
525  bundle->SetSequences() = *seqEntryList;
526  seqEntryList = &(bundle->SetSequences());
527  }
530  if (sequenceAlignments) {
531  bundle->SetSeqaligns() = *sequenceAlignments;
532  sequenceAlignments = &(bundle->SetSeqaligns());
533  }
534 
535  // install new root mime structure
536  mimeData.Reset(newMime);
538  return true;
539 }
540 
542 {
543  // if necessary, convert mime data into general type that has a place for imports
544  if (mimeData.NotEmpty() && !mimeData->IsGeneral() && newUpdates.size() > 0)
546 
547  // store new updates in asn data
548  if (mimeData.NotEmpty() && mimeData->IsGeneral()) {
549  if (mimeData->GetGeneral().GetSeq_align_data().IsCdd()) {
550  cddUpdates = &(mimeData->SetGeneral().SetSeq_align_data().SetCdd().SetPending());
551  *cddUpdates = newUpdates;
552  } else {
553  bundleImportsFaked = newUpdates;
554  // convert to plain imports to store in mime data (some data loss...)
555  bundleImports = &(mimeData->SetGeneral().SetSeq_align_data().SetBundle().SetImports());
556  bundleImports->clear();
557  UpdateAlignList::iterator u, ue = newUpdates.end();
558  for (u=newUpdates.begin(); u!=ue; ++u)
559  if ((*u)->IsSetSeqannot())
560  bundleImports->push_back(CRef < CSeq_annot > (&((*u)->SetSeqannot())));
561  }
562  } else if (cddData.NotEmpty()) {
563  cddUpdates = &(cddData->SetPending());
564  *cddUpdates = newUpdates;
565  } else if (newUpdates.size() > 0)
566  ERRORMSG("ASNDataManager::ReplaceUpdates() - can't put updates in this data type");
567 
569 }
570 
572  const SequenceList& updateSequences)
573 {
574  if (!alignmentSet) return; // don't do this for single structures
575 
576  if (!seqEntryList) {
577  ERRORMSG("ASNDataManager::RemoveUnusedSequences() - can't find sequence list");
578  return;
579  }
580 
581  // update the asn sequences, keeping only those used in the multiple alignment and updates
582  seqEntryList->clear();
584  int nStructuredDependents = 0;
585 
586 // macro to add the sequence to the list if not already present
587 #define CONDITIONAL_ADD_SEQENTRY(seq) do { \
588  if (usedSeqs.find((seq)->identifier) == usedSeqs.end()) { \
589  seqEntryList->resize(seqEntryList->size() + 1); \
590  seqEntryList->back().Reset(new CSeq_entry); \
591  seqEntryList->back().GetObject().SetSeq((const_cast<Sequence*>(seq))->bioseqASN.GetObject()); \
592  usedSeqs[(seq)->identifier] = true; \
593  } } while (0)
594 
595  // always add master first
596  CONDITIONAL_ADD_SEQENTRY(alignmentSet->master);
597  // add from alignmentSet dependents
598  AlignmentSet::AlignmentList::const_iterator a, ae = alignmentSet->alignments.end();
599  for (a=alignmentSet->alignments.begin(); a!=ae; ++a) {
600  CONDITIONAL_ADD_SEQENTRY((*a)->dependent);
601  if ((*a)->dependent->molecule) ++nStructuredDependents;
602  }
603 
604  // add from updates
605  SequenceList::const_iterator s, se = updateSequences.end();
606  for (s=updateSequences.begin(); s!=se; ++s)
608 
610 
611  // warn user if # structured dependents != # structure alignments
612 // if (structureAlignments && nStructuredDependents !=
613 // structureAlignments->GetFeatures().front().GetObject().GetFeatures().size())
614 // ERRORMSG("Warning: Structure alignment list does not contain one alignment per "
615 // "structured sequence!\nYou should recompute structure alignments before saving "
616 // "in order to sync the lists.");
617 }
618 
619 bool ASNDataManager::WriteDataToFile(const char *filename, bool isBinary,
620  string *err, ncbi::EFixNonPrint fixNonPrint) const
621 {
622  if (mimeData.NotEmpty())
623  return WriteASNToFile(filename, mimeData.GetObject(), isBinary, err, fixNonPrint);
624  else
625  return WriteASNToFile(filename, cddData.GetObject(), isBinary, err, fixNonPrint);
626 }
627 
628 ncbi::objects::CCdd * ASNDataManager::GetInternalCDDData(void)
629 {
630  if (cddData.NotEmpty()) return cddData.GetPointer();
631  else if (mimeData.NotEmpty() && mimeData->IsGeneral() &&
632  mimeData->GetGeneral().GetSeq_align_data().IsCdd())
633  return &(mimeData->SetGeneral().SetSeq_align_data().SetCdd());
634  else
635  return NULL;
636 }
637 
638 const ncbi::objects::CCdd * ASNDataManager::GetInternalCDDData(void) const
639 {
640  if (cddData.NotEmpty()) return cddData.GetPointer();
641  else if (mimeData.NotEmpty() && mimeData->IsGeneral() &&
642  mimeData->GetGeneral().GetSeq_align_data().IsCdd())
643  return &(mimeData->GetGeneral().GetSeq_align_data().GetCdd());
644  else
645  return NULL;
646 }
647 
648 bool ASNDataManager::IsCDD(void) const
649 {
650  return (GetInternalCDDData() != NULL);
651 }
652 
654 {
655  return (GetInternalCDDData() != NULL && mimeData.NotEmpty());
656 }
657 
658 const string& ASNDataManager::GetCDDName(void) const
659 {
660  static const string empty = "";
661  const CCdd *cdd = GetInternalCDDData();
662  if (cdd)
663  return cdd->GetName();
664  else
665  return empty;
666 }
667 
668 bool ASNDataManager::SetCDDName(const string& name)
669 {
670  CCdd *cdd = GetInternalCDDData();
671  if (!cdd || name.size() == 0) return false;
672  cdd->SetName(name);
674  return true;
675 }
676 
677 const string& ASNDataManager::GetCDDDescription(void) const
678 {
679  static const string empty = "";
680  const CCdd *cdd = GetInternalCDDData();
681  if (!cdd) return empty;
682 
683  // find first 'comment' in Cdd-descr-set, assume this is the "long description"
684  if (!cdd->IsSetDescription() || cdd->GetDescription().Get().size() == 0) return empty;
685  CCdd_descr_set::Tdata::const_iterator d, de = cdd->GetDescription().Get().end();
686  for (d=cdd->GetDescription().Get().begin(); d!=de; ++d)
687  if ((*d)->IsComment())
688  return (*d)->GetComment();
689 
690  return empty;
691 }
692 
693 bool ASNDataManager::SetCDDDescription(const string& descr)
694 {
695  CCdd *cdd = GetInternalCDDData();
696  if (!cdd) return false;
697 
698  if (cdd->IsSetDescription() && cdd->GetDescription().Get().size() > 0) {
699  // find first 'comment' in Cdd-descr-set, assume this is the "long description"
700  CCdd_descr_set::Tdata::iterator d, de = cdd->SetDescription().Set().end();
701  for (d=cdd->SetDescription().Set().begin(); d!=de; ++d) {
702  if ((*d)->IsComment()) {
703  if ((*d)->GetComment() != descr) {
704  (*d)->SetComment(descr);
706  }
707  return true;
708  }
709  }
710  }
711 
712  // add new comment if not yet present
713  CRef < CCdd_descr > comment(new CCdd_descr);
714  comment->SetComment(descr);
715  cdd->SetDescription().Set().push_front(comment);
717  return true;
718 }
719 
721 {
722  const CCdd *cdd = GetInternalCDDData();
723  if (!lines || !cdd) return false;
724  lines->clear();
725 
726  if (!cdd->IsSetDescription() || cdd->GetDescription().Get().size() == 0)
727  return true;
728 
729  // find scrapbook item
730  CCdd_descr_set::Tdata::const_iterator d, de = cdd->GetDescription().Get().end();
731  for (d=cdd->GetDescription().Get().begin(); d!=de; ++d) {
732  if ((*d)->IsScrapbook()) {
733 
734  // fill out lines from scrapbook string list
735  lines->resize((*d)->GetScrapbook().size());
736  CCdd_descr::TScrapbook::const_iterator l, le = (*d)->GetScrapbook().end();
737  int i = 0;
738  for (l=(*d)->GetScrapbook().begin(); l!=le; ++l)
739  (*lines)[i++] = *l;
740  return true;
741  }
742  }
743  return true;
744 }
745 
747 {
748  CCdd *cdd = GetInternalCDDData();
749  if (!cdd) return false;
750 
751  CCdd_descr::TScrapbook *scrapbook = NULL;
752 
753  // find an existing scrapbook item
754  if (cdd->IsSetDescription()) {
755  CCdd_descr_set::Tdata::iterator d, de = cdd->SetDescription().Set().end();
756  for (d=cdd->SetDescription().Set().begin(); d!=de; ++d) {
757  if ((*d)->IsScrapbook()) {
758  if (lines.size() == 0) {
759  cdd->SetDescription().Set().erase(d); // if empty, remove scrapbook item
761  TRACEMSG("removed scrapbook");
762  } else
763  scrapbook = &((*d)->SetScrapbook());
764  break;
765  }
766  }
767  }
768  if (lines.size() == 0) return true;
769 
770  // create a scrapbook item if doesn't exist already
771  if (!scrapbook) {
772  CRef < CCdd_descr > descr(new CCdd_descr());
773  scrapbook = &(descr->SetScrapbook());
774  cdd->SetDescription().Set().push_back(descr);
775  }
776 
777  // fill out scrapbook lines
778  scrapbook->clear();
779  for (unsigned int i=0; i<lines.size(); ++i)
780  scrapbook->push_back(lines[i]);
782 
783  return true;
784 }
785 
786 ncbi::objects::CCdd_descr_set * ASNDataManager::GetCDDDescrSet(void)
787 {
788  CCdd *cdd = GetInternalCDDData();
789  if (cdd) {
790  // make a new descr set if not present
791  if (!cdd->IsSetDescription()) {
793  cdd->SetDescription(*ref);
794  }
795  return &(cdd->SetDescription());
796  } else
797  return NULL;
798 }
799 
800 ncbi::objects::CAlign_annot_set * ASNDataManager::GetCDDAnnotSet(void)
801 {
802  CCdd *cdd = GetInternalCDDData();
803  if (cdd) {
804  // make a new annot set if not present
805  if (!cdd->IsSetAlignannot()) {
807  cdd->SetAlignannot(*ref);
808  }
809  return &(cdd->SetAlignannot());
810  } else
811  return NULL;
812 }
813 
814 const ncbi::objects::CSeq_id * ASNDataManager::GetCDDMaster3d(void) const
815 {
816  const CCdd *cdd = GetInternalCDDData();
817  if (cdd && cdd->IsSetMaster3d() && cdd->GetMaster3d().size() > 0)
818  return cdd->GetMaster3d().front().GetPointer(); // just return the first one...
819  else
820  return NULL;
821 }
822 
823 void ASNDataManager::AddReject(ncbi::objects::CReject_id *reject)
824 {
825  CCdd *cdd = GetInternalCDDData();
826  if (!cdd) return;
827 
828  cdd->SetRejects().push_back(CRef < CReject_id > (reject));
830 }
831 
833 {
834  const CCdd *cdd = GetInternalCDDData();
835  if (!cdd || !cdd->IsSetRejects())
836  return NULL;
837  return &(cdd->GetRejects());
838 }
839 
840 // the following three Check... functions are taken from CDTree2
841 
842 bool CheckOneDenDiag(CRef<CDense_diag>& DenDiag, string& Str) {
843 //---------------------------------------------------------------------------
844 // check integrity of DenDiag.
845 //---------------------------------------------------------------------------
846  int Start1, Start2, Len, Dim;
847  char buf[1024];
848  bool RetVal = true;
849 
850  // check that Dim of this dense-diag is exactly 2
851  Dim = DenDiag->GetDim();
852  if (Dim != 2) {
853  sprintf(buf, "Dense-diag Dim = %d. It should always be exactly 2.\n", Dim);
854  RetVal = false;
855  }
856 
857  // check that Len of this dense-diag is at least 1
858  Len = DenDiag->GetLen();
859  if (Len < 0) {
860  sprintf(buf, "Dense-diag Len = %d. It should always be non-negative.\n", Len);
861  RetVal = false;
862  }
863 
864  // check that Start of first row is sensible.
865  Start1 = DenDiag->GetStarts().front();
866  if (Start1 < 0) {
867  sprintf(buf, "Dense-diag has 1st row Start %d. It should always be non-negative.\n", Start1);
868  RetVal = false;
869  }
870 
871  // check that Start of second row is sensible.
872  Start2 = DenDiag->GetStarts().back();
873  if (Start2 < 0) {
874  sprintf(buf, "Dense-diag has 2nd row start %d. It should always be non-negative.\n", Start2);
875  RetVal = false;
876  }
877 
878  if (!RetVal) {
879  Str += buf;
880  }
881  return(RetVal);
882 }
883 
884 bool CheckTwoDenDiags(CRef<CDense_diag>& DenDiag1, CRef<CDense_diag>& DenDiag2, string& Str) {
885 //---------------------------------------------------------------------------
886 // check that DenDiag2 follows DenDiag1.
887 //---------------------------------------------------------------------------
888  int Start11, Start12, Start21, Start22, Len;
889  char buf[1024];
890  bool RetVal = true;
891 
892  // get starts for first den-diag, and get its len
893  Start11 = DenDiag1->GetStarts().front();
894  Start12 = DenDiag1->GetStarts().back();
895  Len = DenDiag1->GetLen();
896 
897  // get starts for second den-diag
898  Start21 = DenDiag2->GetStarts().front();
899  Start22 = DenDiag2->GetStarts().back();
900 
901  // make sure starts for second den-diag follow starts for first
902  if (Start21 < (Start11 + Len)) {
903  sprintf(buf, "Dense-diag has 1st row Start %d, Len %d. Next Dense-diag has Start %d.\n", Start11, Len, Start21);
904  RetVal = false;
905  }
906 
907  if (Start22 < (Start12 + Len)) {
908  sprintf(buf, "Dense-diag has 2nd row Start %d, Len %d. Next Dense-diag has Start %d.\n", Start12, Len, Start22);
909  RetVal = false;
910  }
911 
912  if (!RetVal) {
913  Str += buf;
914  }
915  return(RetVal);
916 }
917 
918 bool CheckOneAlignment(const CRef<CSeq_align>& SeqAlign, string& Str) {
919 //---------------------------------------------------------------------------
920 // check integrity of one aligment
921 //---------------------------------------------------------------------------
922  list< CRef< CDense_diag > > DenDiags;
923  list< CRef< CDense_diag > >::iterator dd_iter;
924  CRef< CDense_diag > DenDiag1, DenDiag2;
925  bool RetVal = true;
926 
927  // if alignment has no dense-diags go to next alignment
928  if (!SeqAlign->GetSegs().IsDendiag()) return(RetVal);
929 
930  // get den-diags of alignment
931  DenDiags = SeqAlign->GetSegs().GetDendiag();
932 
933  // get first den-diag
934  dd_iter = DenDiags.begin();
935  DenDiag1 = *dd_iter;
936 
937  // check integrity of first den-diag
938  if (!CheckOneDenDiag(DenDiag1, Str)) RetVal = false;
939 
940  // handle case when there's just one den-diag in the alignment
941  if (dd_iter == DenDiags.end()) return(RetVal);
942  dd_iter++;
943 
944  // loop through the den-diags. make sure we're ascending.
945  for (; dd_iter != DenDiags.end(); dd_iter++) {
946  // get next den-diag
947  DenDiag2 = *dd_iter;
948  // check integrity of this den-diag
949  if (!CheckOneDenDiag(DenDiag2, Str)) RetVal = false;
950  // check that this den-diag is later in the sequence than preceeding den-diag
951  if (!CheckTwoDenDiags(DenDiag1, DenDiag2, Str)) RetVal = false;
952  DenDiag1 = DenDiag2;
953  }
954  return(RetVal);
955 }
956 
958 {
959 #ifndef _DEBUG
960  return true;
961 
962 #else
963 // ... for development only...
964  bool okay = true;
965  string messages;
966  char buf[1024];
967 
968  // check regular alignments
969  const SeqAnnotList *seqAnnots = GetSequenceAlignments();
970  if (seqAnnots) {
971  SeqAnnotList::const_iterator a, ae = seqAnnots->end();
972  for (a=seqAnnots->begin(); a!=ae; ++a) {
973  if ((*a)->GetData().IsAlign()) {
974  CSeq_annot::C_Data::TAlign::const_iterator s, se = (*a)->GetData().GetAlign().end();
975  int n = 1;
976  for (s=(*a)->GetData().GetAlign().begin(); s!=se; ++s, ++n) {
977  if (!CheckOneAlignment(*s, messages)) {
978  okay = false;
979  sprintf(buf, "Normal Alignment #%i\n\n", n);
980  messages += buf;
981  }
982  }
983  }
984  }
985  }
986 
987  // check update alignments
988  const UpdateAlignList *updates = GetUpdates();
989  if (updates) {
990  UpdateAlignList::const_iterator u, ue = updates->end();
991  for (u=updates->begin(); u!=ue; ++u) {
992  if ((*u)->IsSetSeqannot() && (*u)->GetSeqannot().GetData().IsAlign()) {
993  CSeq_annot::C_Data::TAlign::const_iterator s, se = (*u)->GetSeqannot().GetData().GetAlign().end();
994  int n = 1;
995  for (s=(*u)->GetSeqannot().GetData().GetAlign().begin(); s!=se; ++s, ++n) {
996  if (!CheckOneAlignment(*s, messages)) {
997  okay = false;
998  sprintf(buf, "Pending Alignment #%i\n\n", n);
999  messages += buf;
1000  }
1001  }
1002  }
1003  }
1004  }
1005 
1006  if (okay)
1007  TRACEMSG("MonitorAlignments() succeeded");
1008  else {
1009  ERRORMSG("MonitorAlignments() found errors, see log for details; please copy&paste and send a complete report to cdt-swg");
1010  WARNINGMSG("MonitorAlignments() found errors:\n\n" << messages);
1011  }
1012  return okay;
1013 #endif
1014 }
1015 
1016 CNcbi_mime_asn1 * CreateMimeFromBiostruc(const string& filename, EModel_type model)
1017 {
1018  // read Biostruc
1019  CRef < CBiostruc > biostruc(new CBiostruc());
1020  string err;
1021  SetDiagPostLevel(eDiag_Fatal); // ignore all but Fatal errors while reading data
1022  bool okay = (ReadASNFromFile(filename.c_str(), biostruc.GetPointer(), true, &err) ||
1023  ReadASNFromFile(filename.c_str(), biostruc.GetPointer(), false, &err));
1025  if (!okay) {
1026  ERRORMSG("This file is not a valid Biostruc");
1027  TRACEMSG("err: " << err);
1028  return NULL;
1029  }
1030 
1031  return CreateMimeFromBiostruc(biostruc, model);
1032 }
1033 
1035 {
1036  // remove all but desired model coordinates
1037  list < CRef < CBiostruc_model > > desiredModels;
1038  CBiostruc::TModel::const_iterator m, me = biostruc->GetModel().end();
1039  for (m=biostruc->GetModel().begin(); m!=me; ++m) {
1040  if ((*m)->GetType() == model)
1041  desiredModels.push_back(*m);
1042  }
1043  if (desiredModels.size() == 0) {
1044  ERRORMSG("Ack! There's no appropriate model in this Biostruc");
1045  return NULL;
1046  }
1047  biostruc->ResetModel();
1048  biostruc->SetModel() = desiredModels;
1049 
1050  // package Biostruc inside a mime object
1052  CRef < CBiostruc_seq > strucseq(new CBiostruc_seq());
1053  mime->SetStrucseq(*strucseq);
1054  strucseq->SetStructure(*biostruc);
1055 
1056  // get list of gi's to import
1057  vector < TGi > gis;
1058  CBiostruc_graph::TMolecule_graphs::const_iterator g,
1059  ge = biostruc->GetChemical_graph().GetMolecule_graphs().end();
1060  for (g=biostruc->GetChemical_graph().GetMolecule_graphs().begin(); g!=ge; ++g) {
1061  if ((*g)->IsSetSeq_id() && (*g)->GetSeq_id().IsGi())
1062  gis.push_back((*g)->GetSeq_id().GetGi());
1063  }
1064 
1065  // fetch sequences and store in mime
1066  if (gis.size() > 0) {
1067  CRef < CSeq_entry > seqs(new CSeq_entry());
1068  strucseq->SetSequences().push_back(seqs);
1069  CRef < CBioseq_set > seqset(new CBioseq_set());
1070  seqs->SetSet(*seqset);
1071  for (unsigned int i=0; i<gis.size(); ++i) {
1073  if (bioseq.NotEmpty()) {
1074  CRef < CSeq_entry > seqentry(new CSeq_entry());
1075  seqentry->SetSeq(*bioseq);
1076  seqset->SetSeq_set().push_back(seqentry);
1077  } else {
1078  ERRORMSG("Failed to retrieve all Bioseqs");
1079  return NULL;
1080  }
1081  }
1082  } else
1083  WARNINGMSG("Can't find any sequence gi identifiers in this Biostruc");
1084 
1085  return mime.Release();
1086 }
1087 
1088 END_SCOPE(Cn3D)
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.
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.
ncbi::objects::CBiostruc_annot_set * structureAlignments
bool GetCDDNotes(TextLines *lines) const
void SetUserAnnotations(ncbi::objects::CCn3d_user_annotations &annots)
bool SetCDDDescription(const std::string &descr)
void ReplaceUpdates(UpdateAlignList &newUpdates)
SeqAnnotList * sequenceAlignments
ncbi::objects::EModel_type biostrucModelType
void SetStyleDictionary(ncbi::objects::CCn3d_style_dictionary &styles)
void Load(void)
bool SetCDDNotes(const TextLines &lines)
std::list< ncbi::CRef< ncbi::objects::CUpdate_align > > UpdateAlignList
const ncbi::objects::CCn3d_user_annotations * GetUserAnnotations(void) const
const UpdateAlignList * GetUpdates(void) const
bool ConvertMimeDataToCDD(const std::string &cddName)
ncbi::objects::CAlign_annot_set * GetCDDAnnotSet(void)
std::list< const Sequence * > SequenceList
bool WriteDataToFile(const char *filename, bool isBinary, std::string *err, ncbi::EFixNonPrint fixNonPrint=ncbi::eFNP_Default) const
ncbi::CRef< ncbi::objects::CNcbi_mime_asn1 > mimeData
bool ConvertMimeToGeneral(void)
void SetStructureAlignments(ncbi::objects::CBiostruc_annot_set *structureAlignments)
SeqEntryList * seqEntryList
bool AddBiostrucToASN(ncbi::objects::CBiostruc *biostruc)
SeqAnnotList * GetSequenceAlignments(void) const
ncbi::CRef< ncbi::objects::CCdd > cddData
const ncbi::objects::CSeq_id * GetCDDMaster3d(void) const
const ncbi::objects::CCn3d_style_dictionary * GetStyleDictionary(void) const
void RemoveUserAnnotations(void)
bool IsCDDInMime(void) const
bool SetCDDName(const std::string &name)
SeqAnnotList * bundleImports
BiostrucList * biostrucList
void SetDataChanged(unsigned int what) const
unsigned int dataChanged
const std::string & GetCDDName(void) const
ASNDataManager(ncbi::objects::CNcbi_mime_asn1 *mime)
ncbi::objects::CCdd * GetInternalCDDData(void)
const std::string & GetCDDDescription(void) const
UpdateAlignList bundleImportsFaked
ncbi::objects::CBiostruc * masterBiostruc
std::vector< std::string > TextLines
void AddReject(ncbi::objects::CReject_id *reject)
void RemoveStyleDictionary(void)
bool MonitorAlignments(void) const
ncbi::objects::CCdd_descr_set * GetCDDDescrSet(void)
const StructureSet::RejectList * GetRejects(void) const
std::list< ncbi::CRef< ncbi::objects::CSeq_annot > > SeqAnnotList
bool IsCDD(void) const
UpdateAlignList * cddUpdates
void RemoveConsensusFromCDD(void)
void RemoveUnusedSequences(const AlignmentSet *alignmentSet, const SequenceList &updateSequences)
SeqAnnotList * GetOrCreateSequenceAlignments(void)
AlignmentList alignments
const Sequence * master
CAlign_annot_set –.
CBiostruc_seq –.
CBundle_seqs_aligns –.
CCdd_descr_set –.
CCdd_descr –.
Definition: Cdd_descr.hpp:66
CCdd_id –.
Definition: Cdd_id.hpp:66
Definition: Cdd.hpp:51
CCn3d_style_dictionary –.
CCn3d_user_annotations –.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
CRef –.
Definition: ncbiobj.hpp:618
Definition: Seq_entry.hpp:56
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
CUpdate_align –.
static const unsigned int eSequenceData
static const unsigned int eCDDData
static const unsigned int eOtherData
static const unsigned int eUpdateData
std::list< ncbi::CRef< ncbi::objects::CReject_id > > RejectList
Definition: map.hpp:338
CRef< CBioseq > FetchSequenceViaHTTP(const string &id)
Definition: cn3d_tools.cpp:463
#define TRACEMSG(stream)
Definition: cn3d_tools.hpp:83
#define WARNINGMSG(stream)
Definition: cn3d_tools.hpp:85
#define ERRORMSG(stream)
Definition: cn3d_tools.hpp:86
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define Len
int PurgeConsensusSequences(CCdCore *pCD, bool resetFields=true)
Definition: cuCD.cpp:878
static bool ReadASNFromFile(const char *filename, ASNClass *ASNobject, bool isBinary, std::string *err)
static bool WriteASNToFile(const char *filename, const ASNClass &ASNobject, bool isBinary, std::string *err, ncbi::EFixNonPrint fixNonPrint=ncbi::eFNP_Default)
USING_SCOPE(objects)
bool CheckOneDenDiag(CRef< CDense_diag > &DenDiag, string &Str)
CNcbi_mime_asn1 * CreateMimeFromBiostruc(const string &filename, EModel_type model)
#define CONDITIONAL_ADD_SEQENTRY(seq)
bool CheckTwoDenDiags(CRef< CDense_diag > &DenDiag1, CRef< CDense_diag > &DenDiag2, string &Str)
bool CheckOneAlignment(const CRef< CSeq_align > &SeqAlign, string &Str)
USING_NCBI_SCOPE
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
Definition: ncbidiag.cpp:6129
@ eDiag_Info
Informational message.
Definition: ncbidiag.hpp:651
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
Definition: ncbidiag.hpp:655
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
Definition: serialdef.hpp:173
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
Definition: iterator.hpp:1012
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
Definition: ncbiobj.hpp:846
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
const TMolecule_graphs & GetMolecule_graphs(void) const
Get the Molecule_graphs member data.
EModel_type
Access to EModel_type's attributes (values, names) as defined in spec.
Definition: Model_type_.hpp:63
@ eModel_type_ncbi_all_atom
Definition: Model_type_.hpp:66
const TModel & GetModel(void) const
Get the Model member data.
Definition: Biostruc_.hpp:431
void ResetModel(void)
Reset Model data member.
Definition: Biostruc_.cpp:87
TModel & SetModel(void)
Assign a value to Model data member.
Definition: Biostruc_.hpp:437
const TChemical_graph & GetChemical_graph(void) const
Get the Chemical_graph member data.
Definition: Biostruc_.hpp:376
const Tdata & Get(void) const
Get the member data.
bool IsSetRejects(void) const
SeqIds of rejected CD- members, ignore in update Check if a value has been assigned to Rejects data m...
Definition: Cdd_.hpp:1491
const TMaster3d & GetMaster3d(void) const
Get the Master3d member data.
Definition: Cdd_.hpp:1528
bool IsSetDescription(void) const
status, references, etc.
Definition: Cdd_.hpp:1189
bool IsSetAlignannot(void) const
alignment annotation Check if a value has been assigned to Alignannot data member.
Definition: Cdd_.hpp:1541
const TRejects & GetRejects(void) const
Get the Rejects member data.
Definition: Cdd_.hpp:1503
void SetDescription(TDescription &value)
Assign a value to Description data member.
Definition: Cdd_.cpp:94
list< string > TScrapbook
Definition: Cdd_descr_.hpp:228
bool IsSetMaster3d(void) const
record if CD has a 3D representative Check if a value has been assigned to Master3d data member.
Definition: Cdd_.hpp:1516
TRejects & SetRejects(void)
Assign a value to Rejects data member.
Definition: Cdd_.hpp:1509
const TDescription & GetDescription(void) const
Get the Description member data.
Definition: Cdd_.hpp:1201
void SetName(const TName &value)
Assign a value to Name data member.
Definition: Cdd_.hpp:1133
void SetAlignannot(TAlignannot &value)
Assign a value to Alignannot data member.
Definition: Cdd_.cpp:322
const TName & GetName(void) const
Get the Name member data.
Definition: Cdd_.hpp:1124
void SetStrucaligns(TStrucaligns &value)
Assign a value to Strucaligns data member.
TSeqaligns & SetSeqaligns(void)
Assign a value to Seqaligns data member.
const TStructures & GetStructures(void) const
Get the Structures member data.
void SetSeq_align_data(TSeq_align_data &value)
Assign a value to Seq_align_data data member.
TGeneral & SetGeneral(void)
Select the variant.
const TGeneral & GetGeneral(void) const
Get the variant data.
TStructures & SetStructures(void)
Assign a value to Structures data member.
TSequences & SetSequences(void)
Assign a value to Sequences data member.
@ eType_partial
mapping pieces together
Definition: Seq_align_.hpp:103
@ eType_diags
unbroken, but not ordered, diagonals
Definition: Seq_align_.hpp:102
TSet & SetSet(void)
Select the variant.
Definition: Seq_entry_.cpp:130
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
char * buf
int i
yy_size_t n
constexpr bool empty(list< Ts... >) noexcept
Magic spell ;-) needed for some weird compilers... very empiric.
unsigned int a
Definition: ncbi_localip.c:102
bool le(T x_, T y_, T round_)
Definition: njn_approx.hpp:84
bool ge(T x_, T y_, T round_)
Definition: njn_approx.hpp:80
bool ne(T x_, T y_, T round_)
Definition: njn_approx.hpp:82
Neutral sequence alignment (for representing an HSP in BLAST)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
else result
Definition: token2.c:20
Modified on Wed Jun 19 17:00:44 2024 by modify_doxy.py rev. 669887