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

Go to the SVN repository for this file.

1 /* $Id: unit_test_field_resolver.cpp 46307 2021-03-11 14:21:51Z grichenk $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Andrea Asztalos
27 *
28 * File Description:
29 * Unit tests for resolving fields within the asn tree in order to get, set or
30 * remove the value of the field.
31 */
32 
33 #include <ncbi_pch.hpp>
34 #include <objmgr/scope.hpp>
36 #include <serial/objistr.hpp>
37 #include <serial/serial.hpp>
38 
46 #include <objects/seq/Seq_data.hpp>
53 
54 // This header must be included before all Boost.Test headers if there are any
55 #include <corelib/test_boost.hpp>
58 
61 USING_SCOPE(macro);
62 
64 {
65 }
66 
68 {
69 }
70 
71 template<class T>
72 string MakeAsn(const T& object)
73 {
75  str << MSerial_AsnText << object;
77 }
78 
79 size_t TestFeaturesInRange(const CMacroBioData& data, const SFeatInterval& interval)
80 {
81  CIRef<IMacroBioDataIter> data_iter(data.CreateIterator(CMacroBioData::sm_Gene, kEmptyStr, interval));
82  BOOST_CHECK(data_iter);
83 
84  vector<const CSeq_feat*> features;
85 
86  data_iter->Begin();
87  while (!data_iter->IsEnd()) {
88  CConstRef<CObject> obj = data_iter->GetScopedObject().object;
89  const CSeq_feat* feat = dynamic_cast<const CSeq_feat*>(obj.GetPointer());
90  features.push_back(feat);
91  data_iter->Next();
92  }
93 
94  /*for (auto& it : features) {
95  cout << MSerial_AsnText << *it << endl;
96  }
97  */
98 
99  return features.size();
100 }
101 
102 BOOST_AUTO_TEST_CASE(Test_FeatureIterator)
103 {
104  CRef<CSeq_entry> entry(new CSeq_entry);
105  string fname("genes.asn");
106  try {
107  CNcbiIfstream istr(fname.c_str());
108  unique_ptr<CObjectIStream> os(CObjectIStream::Open(eSerial_AsnText, istr));
109  *os >> *entry;
110  }
111  catch (const CException& e) {
112  LOG_POST(Error << e.ReportAll());
113  return;
114  }
115 
117  scope->AddDefaults();
118 
119  CSeq_entry_Handle tse = scope->AddTopLevelSeqEntry(*entry);
120  BOOST_CHECK(tse);
121 
122  CMacroBioData bio_data(tse);
123 
124  // Full sequence length: [0, 509]
125  TSeqPos start = 0;
126  TSeqPos stop = 509;
127  SFeatInterval feat_int(TSeqRange(start, stop));
128  feat_int.left_closed = true;
129  feat_int.right_closed = true;
130  cout << "[" << start << ", " << stop << "]" << endl;
131  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 31);
132 
133  // [100, 400]
134  start = 100;
135  stop = 400;
136  feat_int.m_Range = TSeqRange(start, stop);
137  feat_int.left_closed = true;
138  feat_int.right_closed = true;
139  cout << "\n\n[" << start << ", " << stop << "]" << endl;
140  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 23);
141 
142  // [0, 100]
143  start = 0;
144  stop = 100;
145  feat_int.m_Range = TSeqRange(start, stop);
146  feat_int.left_closed = true;
147  feat_int.right_closed = true;
148  cout << "\n\n[" << start << ", " << stop << "]" << endl;
149  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 14);
150 
151  // (100, 400]
152  start = 100;
153  stop = 400;
154  feat_int.m_Range = TSeqRange(start, stop);
155  feat_int.left_closed = false;
156  feat_int.right_closed = true;
157  cout << "\n\n(" << start << ", " << stop << "]" << endl;
158  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 13);
159  // the genes with [0, 509] +|- positions are not included
160 
161  // [0, 400]
162  start = 0;
163  stop = 400;
164  feat_int.m_Range = TSeqRange(start, stop);
165  feat_int.left_closed = true;
166  feat_int.right_closed = true;
167  cout << "\n\n[" << start << ", " << stop << "]" << endl;
168  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 27);
169 
170  // [100, 400)
171  start = 100;
172  stop = 400;
173  feat_int.m_Range = TSeqRange(start, stop);
174  feat_int.left_closed = true;
175  feat_int.right_closed = false;
176  cout << "\n\n[" << start << ", " << stop << ")" << endl;
177  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 13);
178  // the genes with [0, 509] +|- positions are not included
179 
180  // (100, 400)
181  start = 100;
182  stop = 400;
183  feat_int.m_Range = TSeqRange(start, stop);
184  feat_int.left_closed = false;
185  feat_int.right_closed = false;
186  cout << "\n\n(" << start << ", " << stop << ")" << endl;
187  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 5);
188 
189  // (100, 100]
190  start = 100;
191  stop = 100;
192  feat_int.m_Range = TSeqRange(start, stop);
193  feat_int.left_closed = false;
194  feat_int.right_closed = true;
195  cout << "\n\n(" << start << ", " << stop << "]" << endl;
196  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 0);
197  // no features are selected as features that start at 100 are not included
198 
199  // [100, 100]
200  start = 100;
201  stop = 100;
202  feat_int.m_Range = TSeqRange(start, stop);
203  feat_int.left_closed = true;
204  feat_int.right_closed = true;
205  cout << "\n\n[" << start << ", " << stop << "]" << endl;
206  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 10);
207  // include all features that start at 100 or end at 100 or they cross the 100 sequence position
208 
209  // [100, 100)
210  start = 100;
211  stop = 100;
212  feat_int.m_Range = TSeqRange(start, stop);
213  feat_int.left_closed = true;
214  feat_int.right_closed = false;
215  cout << "\n\n[" << start << ", " << stop << ")" << endl;
216  BOOST_CHECK(TestFeaturesInRange(bio_data, feat_int) == 0);
217  // no features are selected as features that end at 100 are not included
218 
219 }
220 
221 BOOST_AUTO_TEST_CASE(Test_BioSource_Enum)
222 {
223  CRef<CBioSource> bsrc(new CBioSource());
224  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
225  "BioSource ::= {\n"
226  " org {\n"
227  " }\n"
228  "}\n");
229 
230  CObjectInfo oi(bsrc.GetPointer(), bsrc->GetThisTypeInfo());
232 
233  // Get a valid, non-existing field
234  bool get = GetFieldsByName(&result, oi, "genome");
235  BOOST_CHECK(get);
236  BOOST_CHECK(result.empty());
237 
238  // Set a field of enumerated type
239  bool set = SetFieldsByName(&result, oi, "genome");
240  BOOST_CHECK(set);
241  BOOST_CHECK(result.front().field.GetPrimitiveValueType() == ePrimitiveValueEnum);
242  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
243  "BioSource ::= {\n"
244  " genome unknown,\n"
245  " org {\n"
246  " }\n"
247  "}\n");
248 
250 
251  // Get a field of enumerated type
252  result.clear();
253  get = GetFieldsByName(&result, oi, "genome");
254  BOOST_CHECK(get);
255  BOOST_CHECK(result.front().field.GetPrimitiveValueString() == "genomic");
256  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
257  "BioSource ::= {\n"
258  " genome genomic,\n"
259  " org {\n"
260  " }\n"
261  "}\n");
262 
263  // delete a valid, existing field of enumerated type
264  bool remove = RemoveFieldByName(result.front());
265  BOOST_CHECK(remove);
266  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
267  "BioSource ::= {\n"
268  " genome unknown,\n"
269  " org {\n"
270  " }\n"
271  "}\n");
272 }
273 
274 BOOST_AUTO_TEST_CASE(Test_BioSource_Container)
275 {
276  CRef<CBioSource> bsrc(new CBioSource());
277  string source_str =
278  "BioSource ::= {\n"
279  " genome genomic,\n"
280  " org {\n"
281  " taxname \"Bubo scandiacus\",\n"
282  " db {\n"
283  " {\n"
284  " db \"taxon\",\n"
285  " tag id 371907\n"
286  " }\n"
287  " }\n"
288  " },\n"
289  " pcr-primers {\n"
290  " {\n"
291  " forward {\n"
292  " {\n"
293  " seq \"aggctctctctcaa\",\n"
294  " name \"nbam24\"\n"
295  " }\n"
296  " },\n"
297  " reverse {\n"
298  " {\n"
299  " seq \"aggctctctctcaa\",\n"
300  " name \"nbam24\"\n"
301  " }\n"
302  " }\n"
303  " }\n"
304  " }\n"
305  "}\n";
306 
307 
308 
309  CNcbiIstrstream istr(source_str);
310  istr >> MSerial_AsnText >> *bsrc;
311 
312  CObjectInfo oi(bsrc.GetPointer(), bsrc->GetThisTypeInfo());
314 
315  // Get an element from a container
316  bool get = GetFieldsByName(&result, oi, "pcr-primers..reverse..name");
317  BOOST_CHECK(get);
318  BOOST_CHECK(result.size() == 1);
319  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyPointer);
320 
321 
322  CRef<CPCRPrimer> primer(new CPCRPrimer);
323  primer->SetName().Set("nbam33");
324  primer->SetSeq().Set("aggggaaattt");
325 
326  CRef<CPCRReaction> reaction(new CPCRReaction);
327  reaction->SetForward().Set().push_back(primer);
328  bsrc->SetPcr_primers().Set().push_back(reaction);
329 
330  // get multiple elements from a container
331  result.clear();
332  get = GetFieldsByName(&result, oi, "pcr-primers..forward..name");
333  BOOST_CHECK(get);
334  BOOST_CHECK(result.size() == 2);
335  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyPointer);
336  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
337  "BioSource ::= {\n"
338  " genome genomic,\n"
339  " org {\n"
340  " taxname \"Bubo scandiacus\",\n"
341  " db {\n"
342  " {\n"
343  " db \"taxon\",\n"
344  " tag id 371907\n"
345  " }\n"
346  " }\n"
347  " },\n"
348  " pcr-primers {\n"
349  " {\n"
350  " forward {\n"
351  " {\n"
352  " seq \"aggctctctctcaa\",\n"
353  " name \"nbam24\"\n"
354  " }\n"
355  " },\n"
356  " reverse {\n"
357  " {\n"
358  " seq \"aggctctctctcaa\",\n"
359  " name \"nbam24\"\n"
360  " }\n"
361  " }\n"
362  " },\n"
363  " {\n"
364  " forward {\n"
365  " {\n"
366  " seq \"aggggaaattt\",\n"
367  " name \"nbam33\"\n"
368  " }\n"
369  " }\n"
370  " }\n"
371  " }\n"
372  "}\n");
373 
374 
375  // rearrange containers and get multiple elements from it
376  bsrc->Reset();
377  source_str =
378  "BioSource ::= {\n"
379  " genome genomic,\n"
380  " org {\n"
381  " taxname \"Bubo scandiacus\",\n"
382  " db {\n"
383  " {\n"
384  " db \"taxon\",\n"
385  " tag id 371907\n"
386  " }\n"
387  " }\n"
388  " },\n"
389  " pcr-primers {\n"
390  " {\n"
391  " forward {\n"
392  " {\n"
393  " seq \"aggctctctctcaa\",\n"
394  " name \"nbam24\""
395  " },\n"
396  " {\n"
397  " seq \"aggctctaagatatt\",\n"
398  " name \"nbam33\""
399  " }\n"
400  " },\n"
401  " reverse {\n"
402  " {\n"
403  " seq \"aggctctctctcaa\",\n"
404  " name \"nbam24\""
405  " },\n"
406  " {\n"
407  " seq \"aggctctaagatatt\",\n"
408  " name \"nbam33\""
409  " }\n"
410  " }\n"
411  " }\n"
412  " }\n"
413  "}\n";
414 
415  CNcbiIstrstream istr1(source_str);
416  istr1 >> MSerial_AsnText >> *bsrc;
417  result.clear();
418  get = GetFieldsByName(&result, oi, "pcr-primers..forward..seq");
419  BOOST_CHECK(get);
420  BOOST_CHECK(result.size() == 2);
421  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyPointer);
422 }
423 
424 
425 BOOST_AUTO_TEST_CASE(Test_BioSource_String)
426 {
427  CRef<CBioSource> bsrc(new CBioSource());
428  CRef<COrg_ref> org_ref(new COrg_ref());
429  org_ref->SetTaxId(TAX_ID_CONST(371907));
430  org_ref->SetTaxname("Bubo scandiacus");
431  bsrc->SetOrg(*org_ref);
433 
434  CObjectInfo oi(bsrc.GetPointer(), bsrc->GetThisTypeInfo());
436 
437  // Get an existing string
438  bool get = GetFieldsByName(&result, oi, "org.taxname");
439  BOOST_CHECK(get);
440  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), string("Bubo scandiacus"));
441  //
442 
443  // Try to get a non-valid field
444  result.clear();
445  get = GetFieldsByName(&result, oi, "org.commn");
446  BOOST_CHECK(!get);
447  BOOST_CHECK(result.empty());
448 
449  // Try to get a valid, nonexisting string
450  result.clear();
451  get = GetFieldsByName(&result, oi, "org.common");
452  BOOST_CHECK(get);
453  BOOST_CHECK(result.empty());
454  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
455  "BioSource ::= {\n"
456  " genome genomic,\n"
457  " org {\n"
458  " taxname \"Bubo scandiacus\",\n"
459  " db {\n"
460  " {\n"
461  " db \"taxon\",\n"
462  " tag id 371907\n"
463  " }\n"
464  " }\n"
465  " }\n"
466  "}\n");
467  //
468 
469  // Try to set a non-valid field
470  result.clear();
471  bool set = SetFieldsByName(&result, oi, "org.commn");
472  BOOST_CHECK(!set);
473  BOOST_CHECK(result.empty());
474  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
475  "BioSource ::= {\n"
476  " genome genomic,\n"
477  " org {\n"
478  " taxname \"Bubo scandiacus\",\n"
479  " db {\n"
480  " {\n"
481  " db \"taxon\",\n"
482  " tag id 371907\n"
483  " }\n"
484  " }\n"
485  " }\n"
486  "}\n");
487  //
488 
489  // Set a field of string type
490  result.clear();
491  set = SetFieldsByName(&result, oi, "org.common");
492  BOOST_CHECK(set);
493  BOOST_CHECK(result.front().field.GetPrimitiveValueType() == ePrimitiveValueString);
494  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
495  "BioSource ::= {\n"
496  " genome genomic,\n"
497  " org {\n"
498  " taxname \"Bubo scandiacus\",\n"
499  " common \"\",\n"
500  " db {\n"
501  " {\n"
502  " db \"taxon\",\n"
503  " tag id 371907\n"
504  " }\n"
505  " }\n"
506  " }\n"
507  "}\n");
508  //
509  bsrc->SetOrg().SetCommon("snowy owl");
510 
511  // Set a field that is valid and it exists
512  result.clear();
513  set = SetFieldsByName(&result, oi, "org.common");
514  BOOST_CHECK(set);
515  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), string("snowy owl"));
516  //
517 
518  // Remove the valid, existing field
519  result.clear();
520  get = GetFieldsByName(&result, oi, "org.common");
521  BOOST_CHECK(get);
522  bool remove = RemoveFieldByName(result.front());
523  BOOST_CHECK(remove);
524  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
525  "BioSource ::= {\n"
526  " genome genomic,\n"
527  " org {\n"
528  " taxname \"Bubo scandiacus\",\n"
529  " db {\n"
530  " {\n"
531  " db \"taxon\",\n"
532  " tag id 371907\n"
533  " }\n"
534  " }\n"
535  " }\n"
536  "}\n");
537  //
538 }
539 
540 
541 BOOST_AUTO_TEST_CASE(Test_BioSource_Container1)
542 {
543  CRef<CBioSource> bsrc(new CBioSource);
544  string src_string =
545  "BioSource ::= {\n"
546  " genome unknown,\n"
547  " org {\n"
548  " taxname \"Bubo scandiacus\",\n"
549  " common \"snowy owl\",\n"
550  " mod {\n"
551  " \"modifier_01\",\n"
552  " \"modifier_02\",\n"
553  " \"modifier_03\"\n"
554  " },\n"
555  " db {\n"
556  " {\n"
557  " db \"taxon\",\n"
558  " tag id 371907\n"
559  " }\n"
560  " }\n"
561  " }\n"
562  "}\n";
563 
564  CNcbiIstrstream istr(src_string);
565  istr >> MSerial_AsnText >> *bsrc;
566 
567  CObjectInfo oi(bsrc.GetPointer(), bsrc->GetThisTypeInfo());
569 
570  // Resolve a container of strings
571  result.clear();
572  bool get = GetFieldsByName(&result, oi, "org.mod");
573  BOOST_CHECK(get);
574  BOOST_CHECK(result.size() == 1);
575  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyContainer);
576  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
577  "BioSource ::= {\n"
578  " genome unknown,\n"
579  " org {\n"
580  " taxname \"Bubo scandiacus\",\n"
581  " common \"snowy owl\",\n"
582  " mod {\n"
583  " \"modifier_01\",\n"
584  " \"modifier_02\",\n"
585  " \"modifier_03\"\n"
586  " },\n"
587  " db {\n"
588  " {\n"
589  " db \"taxon\",\n"
590  " tag id 371907\n"
591  " }\n"
592  " }\n"
593  " }\n"
594  "}\n");
595  //
596 
597  // Get a non-existent, valid field with similar name to "org.mod"
598  result.clear();
599  get = GetFieldsByName(&result, oi, "org.orgname.mod");
600  BOOST_CHECK(!get);
601  BOOST_CHECK(result.empty());
602  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
603  "BioSource ::= {\n"
604  " genome unknown,\n"
605  " org {\n"
606  " taxname \"Bubo scandiacus\",\n"
607  " common \"snowy owl\",\n"
608  " mod {\n"
609  " \"modifier_01\",\n"
610  " \"modifier_02\",\n"
611  " \"modifier_03\"\n"
612  " },\n"
613  " db {\n"
614  " {\n"
615  " db \"taxon\",\n"
616  " tag id 371907\n"
617  " }\n"
618  " }\n"
619  " }\n"
620  "}\n");
621  //
622 
623  // Set a field with a similar name to "org.mod"
624  result.clear();
625  bool set = SetFieldsByName(&result, oi, "org.orgname.mod");
626  BOOST_CHECK(set);
627  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyContainer);
628  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
629  "BioSource ::= {\n"
630  " genome unknown,\n"
631  " org {\n"
632  " taxname \"Bubo scandiacus\",\n"
633  " common \"snowy owl\",\n"
634  " mod {\n"
635  " \"modifier_01\",\n"
636  " \"modifier_02\",\n"
637  " \"modifier_03\"\n"
638  " },\n"
639  " db {\n"
640  " {\n"
641  " db \"taxon\",\n"
642  " tag id 371907\n"
643  " }\n"
644  " },\n"
645  " orgname {\n"
646  " mod {\n"
647  " }\n"
648  " }\n"
649  " }\n"
650  "}\n");
651 
652  // Set a class member of type int
653  result.clear();
654  set = SetFieldsByName(&result, oi, "org.orgname.mgcode");
655  BOOST_CHECK(set);
656  BOOST_CHECK(result.front().field.GetPrimitiveValueType() == ePrimitiveValueInteger);
657  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
658  "BioSource ::= {\n"
659  " genome unknown,\n"
660  " org {\n"
661  " taxname \"Bubo scandiacus\",\n"
662  " common \"snowy owl\",\n"
663  " mod {\n"
664  " \"modifier_01\",\n"
665  " \"modifier_02\",\n"
666  " \"modifier_03\"\n"
667  " },\n"
668  " db {\n"
669  " {\n"
670  " db \"taxon\",\n"
671  " tag id 371907\n"
672  " }\n"
673  " },\n"
674  " orgname {\n"
675  " mod {\n"
676  " },\n"
677  " mgcode 0\n"
678  " }\n"
679  " }\n"
680  "}\n");
681 
682 
683  bsrc->SetOrg().SetOrgname().SetMgcode(5);
684  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
685  "BioSource ::= {\n"
686  " genome unknown,\n"
687  " org {\n"
688  " taxname \"Bubo scandiacus\",\n"
689  " common \"snowy owl\",\n"
690  " mod {\n"
691  " \"modifier_01\",\n"
692  " \"modifier_02\",\n"
693  " \"modifier_03\"\n"
694  " },\n"
695  " db {\n"
696  " {\n"
697  " db \"taxon\",\n"
698  " tag id 371907\n"
699  " }\n"
700  " },\n"
701  " orgname {\n"
702  " mod {\n"
703  " },\n"
704  " mgcode 5\n"
705  " }\n"
706  " }\n"
707  "}\n");
708 
709 
710  CRef<COrgMod> orgmod1(new COrgMod(COrgMod::eSubtype_ecotype, "eco_type"));
711  CRef<COrgMod> orgmod2(new COrgMod(COrgMod::eSubtype_other, "note about the owl"));
712  bsrc->SetOrg().SetOrgname().SetMod().push_back(orgmod1);
713  bsrc->SetOrg().SetOrgname().SetMod().push_back(orgmod2);
714  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
715  "BioSource ::= {\n"
716  " genome unknown,\n"
717  " org {\n"
718  " taxname \"Bubo scandiacus\",\n"
719  " common \"snowy owl\",\n"
720  " mod {\n"
721  " \"modifier_01\",\n"
722  " \"modifier_02\",\n"
723  " \"modifier_03\"\n"
724  " },\n"
725  " db {\n"
726  " {\n"
727  " db \"taxon\",\n"
728  " tag id 371907\n"
729  " }\n"
730  " },\n"
731  " orgname {\n"
732  " mod {\n"
733  " {\n"
734  " subtype ecotype,\n"
735  " subname \"eco_type\"\n"
736  " },\n"
737  " {\n"
738  " subtype other,\n"
739  " subname \"note about the owl\"\n"
740  " }\n"
741  " },\n"
742  " mgcode 5\n"
743  " }\n"
744  " }\n"
745  "}\n");
746  //
747 
748 
749  // Remove an element from the container:
750  result.clear();
751  get = GetFieldsByName(&result, oi, "org.orgname.mod");
752  BOOST_CHECK(get);
753  CObjectInfo cont_oi = result.front().field;
754 
755  CObjectInfo orgmod_oi1(orgmod1.GetPointer(), orgmod1->GetThisTypeInfo());
756  CMQueryNodeValue::SResolvedField res_field1(cont_oi, orgmod_oi1);
757 
758  bool remove = RemoveFieldByName(res_field1);
759  BOOST_CHECK(remove);
760  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
761  "BioSource ::= {\n"
762  " genome unknown,\n"
763  " org {\n"
764  " taxname \"Bubo scandiacus\",\n"
765  " common \"snowy owl\",\n"
766  " mod {\n"
767  " \"modifier_01\",\n"
768  " \"modifier_02\",\n"
769  " \"modifier_03\"\n"
770  " },\n"
771  " db {\n"
772  " {\n"
773  " db \"taxon\",\n"
774  " tag id 371907\n"
775  " }\n"
776  " },\n"
777  " orgname {\n"
778  " mod {\n"
779  " {\n"
780  " subtype other,\n"
781  " subname \"note about the owl\"\n"
782  " }\n"
783  " },\n"
784  " mgcode 5\n"
785  " }\n"
786  " }\n"
787  "}\n");
788  //
789 
790  // Remove the last element from the container
791  CObjectInfo orgmod_oi2(orgmod2.GetPointer(), orgmod2->GetThisTypeInfo());
792  CMQueryNodeValue::SResolvedField res_field2(cont_oi, orgmod_oi2);
793  remove = RemoveFieldByName(res_field2);
794  BOOST_CHECK(remove);
795  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
796  "BioSource ::= {\n"
797  " genome unknown,\n"
798  " org {\n"
799  " taxname \"Bubo scandiacus\",\n"
800  " common \"snowy owl\",\n"
801  " mod {\n"
802  " \"modifier_01\",\n"
803  " \"modifier_02\",\n"
804  " \"modifier_03\"\n"
805  " },\n"
806  " db {\n"
807  " {\n"
808  " db \"taxon\",\n"
809  " tag id 371907\n"
810  " }\n"
811  " },\n"
812  " orgname {\n"
813  " mod {\n"
814  " },\n"
815  " mgcode 5\n"
816  " }\n"
817  " }\n"
818  "}\n");
819  //
820 
821  // If the Orgname would have had only one orgmod,
822  // deleting that orgmod should have deleted the Orgname object
823  bsrc->SetOrg().SetOrgname().SetMod().push_back(orgmod2);
824 
825  // Remove an int type
826  result.clear();
827  get = GetFieldsByName(&result, oi, "org.orgname.mgcode");
828  BOOST_CHECK(get);
829 
830  remove = RemoveFieldByName(result.front());
831  BOOST_CHECK(remove);
832  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
833  "BioSource ::= {\n"
834  " genome unknown,\n"
835  " org {\n"
836  " taxname \"Bubo scandiacus\",\n"
837  " common \"snowy owl\",\n"
838  " mod {\n"
839  " \"modifier_01\",\n"
840  " \"modifier_02\",\n"
841  " \"modifier_03\"\n"
842  " },\n"
843  " db {\n"
844  " {\n"
845  " db \"taxon\",\n"
846  " tag id 371907\n"
847  " }\n"
848  " },\n"
849  " orgname {\n"
850  " mod {\n"
851  " {\n"
852  " subtype other,\n"
853  " subname \"note about the owl\"\n"
854  " }\n"
855  " }\n"
856  " }\n"
857  " }\n"
858  "}\n");
859  //
860 
861  // Remove the last element from the container:
862  // It WILL NOT delete the empty orgname member!
863  remove = RemoveFieldByName(res_field2);
864  BOOST_CHECK(remove);
865  BOOST_CHECK_EQUAL(MakeAsn(*bsrc),
866  "BioSource ::= {\n"
867  " genome unknown,\n"
868  " org {\n"
869  " taxname \"Bubo scandiacus\",\n"
870  " common \"snowy owl\",\n"
871  " mod {\n"
872  " \"modifier_01\",\n"
873  " \"modifier_02\",\n"
874  " \"modifier_03\"\n"
875  " },\n"
876  " db {\n"
877  " {\n"
878  " db \"taxon\",\n"
879  " tag id 371907\n"
880  " }\n"
881  " },\n"
882  " orgname {\n"
883  " mod {\n"
884  " }\n"
885  " }\n"
886  " }\n"
887  "}\n");
888  //
889 }
890 
891 BOOST_AUTO_TEST_CASE(Test_Lineage_Time)
892 {
893  // measure the time to resolve org.orgname.lineage
894  CRef<CBioSource> bsrc(new CBioSource);
895  string source_str =
896  "BioSource ::= {\n"
897  " genome genomic,\n"
898  " org {\n"
899  " taxname \"Bubo scandiacus\",\n"
900  " common \"snowy owl\",\n"
901  " mod {\n"
902  " \"modifier_01\",\n"
903  " \"modifier_02\",\n"
904  " \"modifier_03\"\n"
905  " },\n"
906  " db {\n"
907  " {\n"
908  " db \"taxon\",\n"
909  " tag id 371907\n"
910  " }\n"
911  " },\n"
912  " orgname {\n"
913  " mod {\n"
914  " {\n"
915  " subtype ecotype,\n"
916  " subname \"eco_type\"\n"
917  " },\n"
918  " {\n"
919  " subtype strain,\n"
920  " subname \"test_strain\"\n"
921  " },\n"
922  " {\n"
923  " subtype serovar,\n"
924  " subname \"test_serovar\"\n"
925  " },\n"
926  " {\n"
927  " subtype group,\n"
928  " subname \"II\"\n"
929  " },\n"
930  " {\n"
931  " subtype other,\n"
932  " subname \"note about the owl\"\n"
933  " }\n"
934  " },\n"
935  " mgcode 5\n"
936  " }\n"
937  " }\n"
938  "}\n";
939 
940  CNcbiIstrstream istr(source_str);
941  istr >> MSerial_AsnText >> *bsrc;
942 
943  CObjectInfo oi(bsrc.GetPointer(), bsrc->GetThisTypeInfo());
945 
946  CStopWatch timer;
947 
948  result.clear();
949  timer.Start();
950  bool get = GetFieldsByName(&result, oi, "org.orgname.lineage");
951  timer.Stop();
952  //LOG_POST("Elapsed time: " << timer.AsSmartString(CTimeSpan::eSSP_Microsecond));
953  BOOST_CHECK(get);
954  BOOST_CHECK(result.empty());
955 }
956 
957 BOOST_AUTO_TEST_CASE(Test_Bioseq_Choice)
958 {
959  CRef<CBioseq> bseq(new CBioseq);
960  CRef<CSeq_id> seq_id(new CSeq_id);
961  seq_id->SetLocal().SetStr("Seq_01");
962  bseq->SetId().push_back(seq_id);
963 
964  bseq->SetInst().SetMol(CSeq_inst::eMol_dna);
965  bseq->SetInst().SetRepr(CSeq_inst::eRepr_raw);
966  bseq->SetInst().SetSeq_data().SetIupacna().Set("AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA");
967  bseq->SetInst().SetLength(40);
968 
969  CObjectInfo oi(bseq.GetPointer(), bseq->GetThisTypeInfo());
971 
972  // Get a non-existent, valid choice variant
973  bool get = GetFieldsByName(&result, oi, "descr..molinfo");
974  BOOST_CHECK(!get); // the choice variant is not set
975  BOOST_CHECK(result.empty());
976  BOOST_CHECK_EQUAL(MakeAsn(*bseq),
977  "Bioseq ::= {\n"
978  " id {\n"
979  " local str \"Seq_01\"\n"
980  " },\n"
981  " inst {\n"
982  " repr raw,\n"
983  " mol dna,\n"
984  " length 40,\n"
985  " seq-data iupacna \"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA\"\n"
986  " }\n"
987  "}\n");
988  //
989 
990  CRef<CSeqdesc> desc_molinfo(new CSeqdesc);
993 
994  CRef<CSeqdesc> desc_title(new CSeqdesc);
995  desc_title->SetTitle("The title of this sequence");
996 
997  CRef<CSeqdesc> desc_user(new CSeqdesc);
998  desc_user->SetUser().SetType().SetStr("Structured Comment");
999  desc_user->SetUser().AddField("StructuredCommentPrefix", string("##Assembly-Data-START##"));
1000  desc_user->SetUser().AddField("Sequencing Technology", string("Sanger dideoxy sequencing"));
1001  desc_user->SetUser().AddField("StructuredCommentSuffix", string("##Assembly-Data-END##"));
1002 
1003  bseq->SetDescr().Set().push_back(desc_molinfo);
1004  bseq->SetDescr().Set().push_back(desc_title);
1005  bseq->SetDescr().Set().push_back(desc_user);
1006 
1007  // Get a non-existent, non-valid choice variant
1008 
1009  // Get the first descriptor:
1010  result.clear();
1011  get = GetFieldsByName(&result, oi, "descr..molinfo.biomol");
1012  BOOST_CHECK(get);
1013  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), "genomic");
1014  BOOST_CHECK_EQUAL(MakeAsn(*bseq),
1015  "Bioseq ::= {\n"
1016  " id {\n"
1017  " local str \"Seq_01\"\n"
1018  " },\n"
1019  " descr {\n"
1020  " molinfo {\n"
1021  " biomol genomic,\n"
1022  " completeness complete\n"
1023  " },\n"
1024  " title \"The title of this sequence\",\n"
1025  " user {\n"
1026  " type str \"Structured Comment\",\n"
1027  " data {\n"
1028  " {\n"
1029  " label str \"StructuredCommentPrefix\",\n"
1030  " data str \"##Assembly-Data-START##\"\n"
1031  " },\n"
1032  " {\n"
1033  " label str \"Sequencing Technology\",\n"
1034  " data str \"Sanger dideoxy sequencing\"\n"
1035  " },\n"
1036  " {\n"
1037  " label str \"StructuredCommentSuffix\",\n"
1038  " data str \"##Assembly-Data-END##\"\n"
1039  " }\n"
1040  " }\n"
1041  " }\n"
1042  " },\n"
1043  " inst {\n"
1044  " repr raw,\n"
1045  " mol dna,\n"
1046  " length 40,\n"
1047  " seq-data iupacna \"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA\"\n"
1048  " }\n"
1049  "}\n");
1050  //
1051 
1052  // Get the second descriptor:
1053  result.clear();
1054  get = GetFieldsByName(&result, oi, "descr..title");
1055  BOOST_CHECK(get);
1056  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), string("The title of this sequence"));
1057  //
1058 
1059  // Get the third descriptor:
1060  result.clear();
1061  get = GetFieldsByName(&result, oi, "descr..user.data");
1062  BOOST_CHECK(get);
1063  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyContainer);
1064 
1065 
1066  // Get an int
1067  result.clear();
1068  get = GetFieldsByName(&result, oi, "inst.length");
1069  BOOST_CHECK(get);
1070  BOOST_CHECK(result.front().field.GetPrimitiveValueType() == ePrimitiveValueInteger);
1071  //
1072 
1073 
1074  // Try to remove a non-optional, valid field
1075  result.clear();
1076  get = GetFieldsByName(&result, oi, "inst.repr");
1077  BOOST_CHECK(get);
1078  BOOST_CHECK(result.front().field.GetPrimitiveValueString() == "raw");
1079 
1080  bool remove = RemoveFieldByName(result.front());
1081  BOOST_CHECK(!remove);
1082  BOOST_CHECK_EQUAL(MakeAsn(bseq->GetInst()),
1083  "Seq-inst ::= {\n"
1084  " repr raw,\n"
1085  " mol dna,\n"
1086  " length 40,\n"
1087  " seq-data iupacna \"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA\"\n"
1088  "}\n");
1089 }
1090 
1091 BOOST_AUTO_TEST_CASE(Test_Bioseq_SameDescriptor)
1092 {
1093  CRef<CBioseq> bseq(new CBioseq);
1094  CRef<CSeq_id> seq_id(new CSeq_id);
1095  seq_id->SetLocal().SetStr("Seq_01");
1096  bseq->SetId().push_back(seq_id);
1097 
1098  bseq->SetInst().SetMol(CSeq_inst::eMol_dna);
1099  bseq->SetInst().SetRepr(CSeq_inst::eRepr_raw);
1100  bseq->SetInst().SetSeq_data().SetIupacna().Set("AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA");
1101  bseq->SetInst().SetLength(40);
1102 
1103  CObjectInfo oi(bseq.GetPointer(), bseq->GetThisTypeInfo());
1105  bool set = SetFieldsByName(&result, oi, "descr..molinfo.biomol");
1106  BOOST_CHECK(set);
1107  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), "unknown");
1108  BOOST_CHECK_EQUAL(MakeAsn(*bseq),
1109  "Bioseq ::= {\n"
1110  " id {\n"
1111  " local str \"Seq_01\"\n"
1112  " },\n"
1113  " descr {\n"
1114  " molinfo {\n"
1115  " biomol unknown\n"
1116  " }\n"
1117  " },\n"
1118  " inst {\n"
1119  " repr raw,\n"
1120  " mol dna,\n"
1121  " length 40,\n"
1122  " seq-data iupacna \"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA\"\n"
1123  " }\n"
1124  "}\n");
1125 
1126  CRef<CSeqdesc> desc_title(new CSeqdesc);
1127  desc_title->SetTitle("The title of this sequence");
1128  bseq->SetDescr().Set().push_back(desc_title);
1129 
1130  // set another molinfo field
1131  result.clear();
1132  set = SetFieldsByName(&result, oi, "descr..molinfo.completeness");
1133  BOOST_CHECK(set);
1134  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), "unknown");
1135  BOOST_CHECK_EQUAL(MakeAsn(*bseq),
1136  "Bioseq ::= {\n"
1137  " id {\n"
1138  " local str \"Seq_01\"\n"
1139  " },\n"
1140  " descr {\n"
1141  " molinfo {\n"
1142  " biomol unknown,\n"
1143  " completeness unknown\n"
1144  " },\n"
1145  " title \"The title of this sequence\"\n"
1146  " },\n"
1147  " inst {\n"
1148  " repr raw,\n"
1149  " mol dna,\n"
1150  " length 40,\n"
1151  " seq-data iupacna \"AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA\"\n"
1152  " }\n"
1153  "}\n");
1154 
1155 }
1156 
1157 BOOST_AUTO_TEST_CASE(Test_SetGeneFeature)
1158 {
1159  CRef<CSeq_feat> feat(new CSeq_feat);
1160  CRef<CSeq_id> seq_id(new CSeq_id);
1161  seq_id->SetLocal().SetStr("Seq_01");
1162  CRef<CSeq_interval> interval(new CSeq_interval(*seq_id, 10, 15));
1163  feat->SetLocation().SetInt(*interval);
1164 
1165  CObjectInfo oi(feat, feat->GetThisTypeInfo());
1167  bool set = SetFieldsByName(&result, oi, "data.gene.locus");
1168  BOOST_CHECK(set);
1169  BOOST_CHECK_EQUAL(MakeAsn(*feat),
1170  "Seq-feat ::= {\n"
1171  " data gene {\n"
1172  " locus \"\"\n"
1173  " },\n"
1174  " location int {\n"
1175  " from 10,\n"
1176  " to 15,\n"
1177  " id local str \"Seq_01\"\n"
1178  " }\n"
1179  "}\n");
1180 
1181  result.clear();
1182  set = SetFieldsByName(&result, oi, "qual.qual");
1183  BOOST_CHECK(set);
1184  result.clear();
1185  set = SetFieldsByName(&result, oi, "qual.val");
1186  BOOST_CHECK(set);
1187  BOOST_CHECK_EQUAL(MakeAsn(*feat),
1188  "Seq-feat ::= {\n"
1189  " data gene {\n"
1190  " locus \"\"\n"
1191  " },\n"
1192  " location int {\n"
1193  " from 10,\n"
1194  " to 15,\n"
1195  " id local str \"Seq_01\"\n"
1196  " },\n"
1197  " qual {\n"
1198  " {\n"
1199  " qual \"\",\n"
1200  " val \"\"\n"
1201  " }\n"
1202  " }\n"
1203  "}\n");
1204 }
1205 
1206 BOOST_AUTO_TEST_CASE(Test_SetProteinName)
1207 {
1208  CRef<CSeq_feat> feat(new CSeq_feat);
1209  CRef<CSeq_id> seq_id(new CSeq_id);
1210  seq_id->SetLocal().SetStr("Seq_01");
1211  CRef<CSeq_interval> interval(new CSeq_interval(*seq_id, 10, 15));
1212  feat->SetLocation().SetInt(*interval);
1213  feat->SetData().SetProt();
1214 
1215  CObjectInfo oi(feat, feat->GetThisTypeInfo());
1217  bool set = SetFieldsByName(&result, oi, "data.prot.name");
1218  BOOST_CHECK(set);
1219  BOOST_CHECK(result.front().field.GetTypeFamily() == eTypeFamilyContainer);
1220  CObjectInfo new_oi(result.front().field.AddNewElement());
1221  new_oi.SetPrimitiveValueString("new protein name");
1222  BOOST_CHECK_EQUAL(feat->GetData().GetProt().GetName().front(), "new protein name");
1223 }
1224 
1225 BOOST_AUTO_TEST_CASE(Test_Bioseq_MultipleSameDescriptor)
1226 {
1227  CRef<CBioseq> bseq(new CBioseq);
1228  CRef<CSeq_id> seq_id(new CSeq_id);
1229  seq_id->SetLocal().SetStr("Seq_01");
1230  bseq->SetId().push_back(seq_id);
1231 
1232  bseq->SetInst().SetMol(CSeq_inst::eMol_dna);
1233  bseq->SetInst().SetRepr(CSeq_inst::eRepr_raw);
1234  bseq->SetInst().SetSeq_data().SetIupacna().Set("AATTGGCCAAAATTGGCCAAAATTGGCCAAAATTGGCCAA");
1235  bseq->SetInst().SetLength(40);
1236 
1237  CRef<CSeqdesc> desc_molinfo1(new CSeqdesc);
1240 
1241  CRef<CSeqdesc> desc_molinfo2(new CSeqdesc);
1242  desc_molinfo2->SetMolinfo().SetBiomol(CMolInfo::eBiomol_mRNA);
1243 
1244  bseq->SetDescr().Set().push_back(desc_molinfo1);
1245  bseq->SetDescr().Set().push_back(desc_molinfo2);
1246 
1248  CObjectInfo oi(bseq.GetPointer(), bseq->GetThisTypeInfo());
1249  bool get = GetFieldsByName(&result, oi, "descr..molinfo.biomol");
1250  BOOST_CHECK(get);
1251  BOOST_CHECK_EQUAL(result.front().field.GetPrimitiveValueString(), "genomic");
1252 }
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.
The following asn-selectors are defined to be used in the FOR EACH statement:
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
CObjectInfo –.
Definition: objectinfo.hpp:597
@OrgMod.hpp User-defined methods of the data storage class.
Definition: OrgMod.hpp:54
TTaxId SetTaxId(TTaxId tax_id)
Definition: Org_ref.cpp:93
CPCRPrimer –.
Definition: PCRPrimer.hpp:66
CPCRReaction –.
Definition: PCRReaction.hpp:66
CScope –.
Definition: scope.hpp:92
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CStopWatch –.
Definition: ncbitime.hpp:1937
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
Definition: set.hpp:45
#define T(s)
Definition: common.h:230
static void DLIST_NAME() remove(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:90
static const char * str(char *buf, int n)
Definition: stats.c:84
char data[12]
Definition: iconv.c:80
#define TAX_ID_CONST(id)
Definition: ncbimisc.hpp:1112
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#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
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
Definition: ncbiexpt.cpp:370
bool RemoveFieldByName(CMQueryNodeValue::SResolvedField &res_field)
Remove the object information instance corresponding to field, using information about its parent nod...
list< SResolvedField > TObs
Definition: macro_exec.hpp:92
bool GetFieldsByName(CMQueryNodeValue::TObs *results, const CObjectInfo &oi_i, const string &field_name)
Resolve existing dot qualified ASN.1 name (field_name) starting from the object information instance ...
bool SetFieldsByName(CMQueryNodeValue::TObs *results, CObjectInfo &oi_i, const string &field_name)
Resolve not necessarily existing dot qualified ASN.1 name (field_name) starting from the object infor...
static const char * sm_Gene
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
@ ePrimitiveValueString
string|char*|const char*
Definition: serialdef.hpp:153
@ ePrimitiveValueInteger
(signed|unsigned) (char|short|int|long)
Definition: serialdef.hpp:151
@ ePrimitiveValueEnum
enum
Definition: serialdef.hpp:154
@ eTypeFamilyContainer
Definition: serialdef.hpp:142
@ eTypeFamilyPointer
Definition: serialdef.hpp:143
@ eSerial_AsnText
ASN.1 text.
Definition: serialdef.hpp:73
void SetPrimitiveValueString(const string &value)
Definition: objectinfo.cpp:282
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
Definition: objistr.cpp:195
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
Definition: scope.cpp:522
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
Definition: scope.cpp:504
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
Definition: range.hpp:419
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
#define kEmptyStr
Definition: ncbistr.hpp:123
void Stop(void)
Suspend the timer.
Definition: ncbitime.hpp:2792
void Start(void)
Start the timer.
Definition: ncbitime.hpp:2764
virtual void Reset(void)
Reset the whole object.
Definition: BioSource_.cpp:136
void SetSeq(const TSeq &value)
Assign a value to Seq data member.
Definition: PCRPrimer_.hpp:220
void SetGenome(TGenome value)
Assign a value to Genome data member.
Definition: BioSource_.hpp:428
void SetForward(TForward &value)
Assign a value to Forward data member.
void SetPcr_primers(TPcr_primers &value)
Assign a value to Pcr_primers data member.
Definition: BioSource_.cpp:124
void SetName(const TName &value)
Assign a value to Name data member.
Definition: PCRPrimer_.hpp:255
void SetOrg(TOrg &value)
Assign a value to Org data member.
Definition: BioSource_.cpp:108
TStr & SetStr(void)
Select the variant.
Definition: Object_id_.hpp:304
void SetType(TType &value)
Assign a value to Type data member.
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
Definition: Org_ref_.hpp:381
@ eSubtype_other
ASN5: old-name (254) will be added to next spec.
Definition: OrgMod_.hpp:125
@ eSubtype_ecotype
Definition: OrgMod_.hpp:110
const TName & GetName(void) const
Get the Name member data.
Definition: Prot_ref_.hpp:378
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TProt & GetProt(void) const
Get the variant data.
TLocal & SetLocal(void)
Select the variant.
Definition: Seq_id_.cpp:199
void SetCompleteness(TCompleteness value)
Assign a value to Completeness data member.
Definition: MolInfo_.hpp:600
TId & SetId(void)
Assign a value to Id data member.
Definition: Bioseq_.hpp:296
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
TTitle & SetTitle(void)
Select the variant.
Definition: Seqdesc_.hpp:1039
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
void SetBiomol(TBiomol value)
Assign a value to Biomol data member.
Definition: MolInfo_.hpp:453
void SetDescr(TDescr &value)
Assign a value to Descr data member.
Definition: Bioseq_.cpp:65
TUser & SetUser(void)
Select the variant.
Definition: Seqdesc_.cpp:390
TMolinfo & SetMolinfo(void)
Select the variant.
Definition: Seqdesc_.cpp:594
@ eRepr_raw
continuous sequence
Definition: Seq_inst_.hpp:94
@ eCompleteness_complete
complete biological entity
Definition: MolInfo_.hpp:156
Functions that resolve field names described in asn format.
The Object manager core.
Utility stuff for more convenient using of Boost.Test library.
else result
Definition: token2.c:20
USING_SCOPE(objects)
string MakeAsn(const T &object)
size_t TestFeaturesInRange(const CMacroBioData &data, const SFeatInterval &interval)
BOOST_AUTO_TEST_CASE(Test_FeatureIterator)
Modified on Mon May 13 04:38:24 2024 by modify_doxy.py rev. 669887