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

Go to the SVN repository for this file.

1 /* $Id: seqfeatdata_unit_test.cpp 99326 2023-03-09 19:16:38Z foleyjp $
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: Michael Kornbluh, NCBI
27  *
28  * File Description:
29  * Unit test for CSeqFeatData and some closely related code
30  *
31  * ===========================================================================
32  */
33 
34 #include <ncbi_pch.hpp>
35 
53 #include <objects/pub/Pub.hpp>
65 #include <objects/biblio/Affil.hpp>
66 #include <corelib/ncbimisc.hpp>
67 #include <corelib/ncbiapp.hpp>
68 #include <corelib/test_boost.hpp>
69 
70 #include <boost/test/parameterized_test.hpp>
71 #include <util/util_exception.hpp>
72 #include <util/util_misc.hpp>
73 #include <util/random_gen.hpp>
74 
75 #include <common/test_assert.h> /* This header must go last */
76 
79 
80 static void SetSubSource (objects::CBioSource& src, objects::CSubSource::TSubtype subtype, string val)
81 {
82  if (NStr::IsBlank(val)) {
83  if (src.IsSetSubtype()) {
84  objects::CBioSource::TSubtype::iterator it = src.SetSubtype().begin();
85  while (it != src.SetSubtype().end()) {
86  if ((*it)->IsSetSubtype() && (*it)->GetSubtype() == subtype) {
87  it = src.SetSubtype().erase(it);
88  } else {
89  ++it;
90  }
91  }
92  }
93  } else {
94  CRef<objects::CSubSource> sub(new objects::CSubSource(subtype, val));
95  if (NStr::EqualNocase(val, "true")) {
96  sub->SetName("");
97  }
98  src.SetSubtype().push_back(sub);
99  }
100 }
101 
102 namespace {
103  bool s_TestSubtype(CSeqFeatData::ESubtype eSubtype) {
104  string sNameOfSubtype =
106  if( sNameOfSubtype.empty() ) {
107  return false;
108  }
109  // make sure it goes in the other direction, too
110  const CSeqFeatData::ESubtype eReverseSubtype =
111  CSeqFeatData::SubtypeNameToValue(sNameOfSubtype);
112  BOOST_CHECK( eReverseSubtype != CSeqFeatData::eSubtype_bad );
113  BOOST_CHECK_EQUAL(eSubtype, eReverseSubtype);
114  return true;
115  }
116 }
117 
118 BOOST_AUTO_TEST_CASE(s_TestSubtypeMaps)
119 {
120  typedef set<CSeqFeatData::ESubtype> TSubtypeSet;
121  // this set holds the subtypes where we expect it to fail
122  // when we try to convert to string
123  TSubtypeSet subtypesExpectedToFail;
124 
125 #ifdef ESUBTYPE_SHOULD_FAIL
126 # error ESUBTYPE_SHOULD_FAIL already defined
127 #endif
128 
129 #define ESUBTYPE_SHOULD_FAIL(name) \
130  subtypesExpectedToFail.insert(CSeqFeatData::eSubtype_##name);
131 
132  // this list seems kind of long. Maybe some of these
133  // should be added to the lookup maps so they
134  // do become valid.
136  ESUBTYPE_SHOULD_FAIL(EC_number);
137  ESUBTYPE_SHOULD_FAIL(Imp_CDS);
138  ESUBTYPE_SHOULD_FAIL(allele);
140  ESUBTYPE_SHOULD_FAIL(misc_RNA);
141  ESUBTYPE_SHOULD_FAIL(mutation);
143  ESUBTYPE_SHOULD_FAIL(precursor_RNA);
146 
147 #undef ESUBTYPE_SHOULD_FAIL
148 
149  ITERATE_0_IDX(iSubtypeAsInteger, CSeqFeatData::eSubtype_max)
150  {
151  CSeqFeatData::ESubtype eSubtype =
152  static_cast<CSeqFeatData::ESubtype>(iSubtypeAsInteger);
153 
154  // subtypesExpectedToFail tells us which ones are
155  // expected to fail. Others are expected to succeed
156  if( subtypesExpectedToFail.find(eSubtype) ==
157  subtypesExpectedToFail.end() )
158  {
159  NCBITEST_CHECK(s_TestSubtype(eSubtype));
160  } else {
161  NCBITEST_CHECK( ! s_TestSubtype(eSubtype) );
162  }
163  }
164 
165  // a couple values we haven't covered that should
166  // also be tested.
167  NCBITEST_CHECK( ! s_TestSubtype(CSeqFeatData::eSubtype_max) );
168  NCBITEST_CHECK( ! s_TestSubtype(CSeqFeatData::eSubtype_any) );
169 
171 }
172 
173 
174 BOOST_AUTO_TEST_CASE(Test_CapitalizationFix)
175 {
176 
177  BOOST_CHECK_EQUAL(COrgMod::FixHostCapitalization("SQUASH"), "squash");
178  BOOST_CHECK_EQUAL(COrgMod::FixHostCapitalization("SOUR cherry"), "sour cherry");
179  CRef<COrgMod> m(new COrgMod());
181  m->SetSubname("Turkey");
182  m->FixCapitalization();
183  BOOST_CHECK_EQUAL(m->GetSubname(), "turkey");
184 
185  CRef<CSubSource> s(new CSubSource());
187  s->SetName("Dioecious");
188  s->FixCapitalization();
189  BOOST_CHECK_EQUAL(s->GetName(), "dioecious");
190 
191 
192 }
193 
194 BOOST_AUTO_TEST_CASE(Test_OrgMod_FixHost)
195 {
196  BOOST_CHECK_EQUAL(COrgMod::FixHost("No"),"missing");
197  BOOST_CHECK_EQUAL(COrgMod::FixHost("no"),"missing");
198  BOOST_CHECK_EQUAL(COrgMod::FixHost("NO"),"missing");
199  BOOST_CHECK_EQUAL(COrgMod::FixHost("None"),"missing");
200  BOOST_CHECK_EQUAL(COrgMod::FixHost("none"),"missing");
201  BOOST_CHECK_EQUAL(COrgMod::FixHost("nonE"),"missing");
202  BOOST_CHECK_EQUAL(COrgMod::FixHost("misc"),"missing");
203  BOOST_CHECK_EQUAL(COrgMod::FixHost("obscured"),"obscured");
204  BOOST_CHECK_EQUAL(COrgMod::FixHost("homo sapiens"), "Homo sapiens");
205  BOOST_CHECK_EQUAL(COrgMod::FixHost("HUMAN"), "Homo sapiens");
206  BOOST_CHECK_EQUAL(COrgMod::FixHost("Not Determined"), "unknown");
207 }
208 
209 
210 BOOST_AUTO_TEST_CASE(Test_FixLatLonFormat)
211 {
212  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees 51 degrees 56' 51 ''", true), "51.9475 N 114 E");
213  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 51", true), "51 N 114.23 E");
214  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees, 51 degrees 56' 51 ''", true), "51.9475 N 114 E");
215  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees 14' 42'' 51 degrees 56' 51 ''", true), "51.9475 N 114.2450 E");
216  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees 14' 51 degrees 56' 51 ''", true), "51.9475 N 114.23 E");
217  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees 14' 42'', 51 degrees 56' 51 ''", true), "51.9475 N 114.2450 E");
218  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 degrees 14', 51 degrees 56' 51 ''", true), "51.9475 N 114.23 E");
219  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 42'' 51 56' 51''", true), "51.9475 N 114.2450 E");
220  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 42'' 51 56'", true), "51.93 N 114.2450 E");
221  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 42'' 51", true), "51 N 114.2450 E");
222  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 51", true), "51 N 114 E");
223  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 51 56'", true), "51.93 N 114.23 E");
224  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 14' 42'' 51 56'", true), "51.93 N 114.2450 E");
225  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("114 42'' 51 56'", true), "51.93 N 114.0117 E");
226 
227  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("+60.500280-145.866244", true), "60.500280 N 145.866244 W");
228  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-60.500280+145.866244", true), "60.500280 S 145.866244 E");
229  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-60.500280-145.866244", true), "60.500280 S 145.866244 W");
230  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("+60.500280+145.866244", true), "60.500280 N 145.866244 E");
231  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("\"36.222459,139.636522\"", true), "36.222459 N 139.636522 E");
232  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("35 57' 18'' N 79 43' 34\" W", true), "35.9550 N 79.7261 W");
233  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("35 57' 18'' N 79 43' 34' W", true), "35.9550 N 79.7261 W");
234  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("37:22N 005:59W", true), "37.37 N 5.98 W");
235  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("60.42.726'N, 05.05.595E", true), "");
236  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("15.48 N -90.23 W", true), "15.48 N 90.23 W");
237  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("25 . 46 N 108 . 59 W", false), "25.46 N 108.59 W");
238  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("30.1.49N31.11.44E", false), "30.0303 N 31.1956 E");
239  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("27 degrees 22'50'' N 88 degrees 13'16'' E", false), "27.3806 N 88.2211 E");
240  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("27 degrees 22 50 N 88 degrees 13 16 E", false), "27.3806 N 88.2211 E");
241  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("27 degrees 22'50 N 88 degrees 13'16 E", false), "27.3806 N 88.2211 E");
242  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("34 deg 00.465 N 77 deg 41.514 E", false), "34.00775 N 77.69190 E");
243 
244  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-50.4498 N - 59 74.8912 E", true), "");
245  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("50.4498 N 59 74.8912 E", true), "");
246  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("9.93N\xC2\xB0 and 78.12\xC2\xB0\x45", true), "9.93 N 78.12 E");
247  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N03'00'12.1 E101'39'33'1", true), "");
248  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("43.098333, -89.405278", true), "43.098333 N 89.405278 W");
249  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("43.098333, -91.00231", true), "43.098333 N 91.00231 W");
250  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("14.60085 and 144.77629", true), "14.60085 N 144.77629 E");
251  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("53.43.20 N 7.43.20 E", true), "53.7222 N 7.7222 E");
252  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("53.43.20.30 N 7.43.20.6 E", true), "");
253  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("91.00 N 5.00 E", true), "");
254  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("83.00 N 181.00 E", true), "");
255  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("91.00 S 5.00 E", true), "");
256  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("83.00 S 181.00 W", true), "");
257 
258  string degree = "\xB0";
259  string to_fix = "9.93" + degree + "N and 78.12" + degree + "E";
260  string fixed = CSubSource::FixLatLonFormat(to_fix, true);
261  BOOST_CHECK_EQUAL(fixed, "9.93 N 78.12 E");
262 
263  to_fix = "Lattitude: 25.790544; longitude: -80.214930";
264  fixed = CSubSource::FixLatLonFormat(to_fix, true);
265  BOOST_CHECK_EQUAL(fixed, "25.790544 N 80.214930 W");
266 
267  to_fix = "34.1030555556 , -118.357777778 34 degrees 6' 11'' North , 118 degrees 21' 28'' West";
268  fixed = CSubSource::FixLatLonFormat(to_fix, true);
269  BOOST_CHECK_EQUAL(fixed, "");
270 
271  to_fix = "0031.02 N 00.01E";
272  fixed = CSubSource::FixLatLonFormat(to_fix, true);
273  BOOST_CHECK_EQUAL(fixed, "31.02 N 0.01 E");
274 
275  to_fix = "000.00 N 0.12 E";
276  fixed = CSubSource::FixLatLonFormat(to_fix, true);
277  BOOST_CHECK_EQUAL(fixed, "0.00 N 0.12 E");
278 
279  to_fix = "0.0023 N 0 E";
280  fixed = CSubSource::FixLatLonFormat(to_fix, true);
281  BOOST_CHECK_EQUAL(fixed, "0.0023 N 0 E");
282 
283  to_fix = "78.32 -0092.25";
284  fixed = CSubSource::FixLatLonFormat(to_fix, true);
285  BOOST_CHECK_EQUAL(fixed, "78.32 N 92.25 W");
286 
287  to_fix = "-0008.34 0.85";
288  fixed = CSubSource::FixLatLonFormat(to_fix, true);
289  BOOST_CHECK_EQUAL(fixed, "8.34 S 0.85 E");
290 
291  to_fix = "0.067682S_76.39885W";
292  fixed = CSubSource::FixLatLonFormat(to_fix, true);
293  BOOST_CHECK_EQUAL(fixed, "0.067682 S 76.39885 W");
294 
295  to_fix = "34degrees 20' 13'' N,47degrees 03' 24''E";
296  fixed = CSubSource::FixLatLonFormat(to_fix, true);
297  BOOST_CHECK_EQUAL(fixed, "34.3369 N 47.0567 E");
298 
299  to_fix = "34degrees 20' 13' N,47deg 03' 24' E";
300  fixed = CSubSource::FixLatLonFormat(to_fix, true);
301  BOOST_CHECK_EQUAL(fixed, "34.3369 N 47.0567 E");
302 
303  to_fix = "8 degrees 28 'N & 77 degrees 41 'E";
304  fixed = CSubSource::FixLatLonFormat(to_fix, true);
305  BOOST_CHECK_EQUAL(fixed, "8.47 N 77.68 E");
306 
307  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 08 36.0S 63 49 00.0W", true), "0.14333 S 63.81667 W");
308  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 08 36.1S 63 49 00.1W", true), "0.14336 S 63.81669 W");
309  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 12 45.5N 50 58 21.7W", true), "0.21264 N 50.97269 W");
310  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 17 28.4N 50 54 07.2W", true), "0.29122 N 50.90200 W");
311  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 4 60.0S 63 07 60.0W", true), "");
312  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 46 56.6S 60 03 37.7W", true), "0.78239 S 60.06047 W");
313  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 50 08.0N 51 12 31.4W", true), "0.83556 N 51.20872 W");
314  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 53 38.85N 52 0 40.37W", true), "0.894125 N 52.011214 W");
315  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("1 00 07.2S 57 07 35.6W", true), "1.00200 S 57.12656 W");
316  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("1 30 59.1N 50 55 01.7W", true), "1.51642 N 50.91714 W");
317  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("1 46 56.6S 60 03 37.7W", true), "1.78239 S 60.06047 W");
318  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("10 0 30.21S 67 50 46.22W", true), "10.008392 S 67.846172 W");
319  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("10 14 14.05S 67 48 42.93W", true), "10.237236 S 67.811925 W");
320  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("2 46 56.6S 60 03 37.7W", true), "2.78239 S 60.06047 W");
321  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("3 53 07.9S 59 04 41.7W", true), "3.88553 S 59.07825 W");
322  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("7 39 52.3S 65 04 11.1W", true), "7.66453 S 65.06975 W");
323  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("8 43 5.46S 63 51 24.49W", true), "8.718183 S 63.856803 W");
324  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("9 30 3.81S 68 53 46.38W", true), "9.501058 S 68.896217 W");
325  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("23.3600 degree N, 92.0000 degree E", true), "23.3600 N 92.0000 E");
326 
327  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("42:43:13N 01:0015W", true), "42.7203 N 1.25 W");
328  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("42:24:37.9 N 85:22:11.7 W", true), "42.41053 N 85.36992 W");
329  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("41deg30'' S 145deg37' E", true), "41.0083 S 145.62 E");
330  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("38 11 44.66 North 0 35 01.93 West", true), "38.195739 N 0.583869 W");
331  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("37deg27N 121deg52'W", true), "37.45 N 121.87 W");
332  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("01deg31'25''N 66''33'31''W", true), "");
333  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("07deg33'30''N 69deg20'W", true), "7.5583 N 69.33 W");
334  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("10.8439,-85.6138", true), "10.8439 N 85.6138 W");
335  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("11.03,-85.527", true), "11.03 N 85.527 W");
336  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("35deg48'50'' N; 82deg5658'' W", true), "");
337  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("45deg34.18''N, 122deg12.00 'W", true), "45.009494 N 122.2000 W");
338  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("37deg27N, 121deg52'W", true), "37.45 N 121.87 W");
339  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("02 deg 28' 29# S, 56 deg 6' 31# W", true), "2.4747 S 56.1086 W");
340  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("86 deg. 30'S, 147 deg. W", true), "86.50 S 147 W");
341  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("E148deg44.8',N19deg24.1", true), "19.402 N 148.747 E");
342  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-0.000 N 2.415 W", true), "0.000 N 2.415 W");
343  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 22.122 E 106.733", true), "22.122 N 106.733 E");
344  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("45#42'N 13#42'E", true), "45.70 N 13.70 E");
345 
346  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("lat 48 deg 32'N, long 58 deg 33'W", true), "48.53 N 58.55 W");
347  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 42deg 23.31'; W 111deg 35.12'", true), "42.3885 N 111.5853 W");
348  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("37.9 N lat, 85.8 W long", true), "37.9 N 85.8 W");
349  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("37.918 degrees N latitude, 119.258 degrees W longitude", true), "37.918 N 119.258 W");
350  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("02 37'S, 38 09'E", true), "2.62 S 38.15 E");
351  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("53 deg 23'N 167 deg 50W", true), "53.38 N 167.83 W");
352  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("E148deg44.8',N19deg24.1'", true), "19.402 N 148.747 E");
353  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 22 14; W 60 29 28", true), "22.23 N 60.4911 W");
354 
355  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("35 degrees 29'N; 120 degrees 49-51'W", true), "");
356  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("44 deg N 71 deg 30'W", true), "44 N 71.50 W");
357  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("64 deg 41-43'N 165 deg 45'W", true), "");
358  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 38deg 25.93'; Wdeg 123 04.88'", true), "38.4322 N 123.0813 W");
359 
360  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("51 56' 51'' -114 14' 42''", true), "51.9475 N 114.2450 W");
361  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-51 56' 51'' 114 14' 42''", true), "51.9475 S 114.2450 E");
362  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("51 -56' 51'' 114 14' 42''", true), "");
363  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0 56' 51'' -114 14' 42''", true), "0.9475 N 114.2450 W");
364  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("-0 56' 51'' -114 14' 42''", true), "0.9475 S 114.2450 W");
365 
366  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("0.000 S 2.417 W", true), "0.000 N 2.417 W");
367  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 16 degree 46 min 57 sec; E 99 degree 01 min 08 sec", true), "16.7825 N 99.0189 E");
368  BOOST_CHECK_EQUAL(CSubSource::FixLatLonFormat("N 16 degree 30 min 16 sec, E 99 degree 09 min 40 sec", true), "16.5044 N 99.1611 E");
369 
370 }
371 
372 
374 {
375  CRef<CAuth_list> auth_list(new CAuth_list());
376 
377  auth_list->SetAffil().SetStd().SetAffil("Murdoch University");
378  auth_list->SetAffil().SetStd().SetDiv("School of Veterinary and Life Sciences");
379  auth_list->SetAffil().SetStd().SetCity("Murdoch");
380  auth_list->SetAffil().SetStd().SetSub("Western Australia");
381  auth_list->SetAffil().SetStd().SetCountry("Australia");
382  auth_list->SetAffil().SetStd().SetStreet("90 South Street");
383  auth_list->SetAffil().SetStd().SetPostal_code("6150");
384  CRef<CAuthor> auth1(new CAuthor());
385  auth1->SetName().SetName().SetLast("Yang");
386  auth1->SetName().SetName().SetFirst("Rongchang");
387  auth1->SetName().SetName().SetInitials("R.");
388  auth_list->SetNames().SetStd().push_back(auth1);
389  CRef<CAuthor> auth2(new CAuthor());
390  auth2->SetName().SetName().SetLast("Ryan");
391  auth2->SetName().SetName().SetFirst("Una");
392  auth2->SetName().SetName().SetInitials("U.");
393  auth_list->SetNames().SetStd().push_back(auth2);
394 
395  return auth_list;
396 }
397 
399 {
400  if (auth_list.SetNames().SetStd().size() == 0) {
401  CRef<CAuthor> auth(new CAuthor());
402  auth->SetName().SetName().SetLast("Last");
403  auth_list.SetNames().SetStd().push_back(auth);
404  }
405  auth_list.SetNames().SetStd().back()->SetName().SetName().SetFirst("Uan");
406 }
407 
408 
410 {
411  if (auth_list.SetNames().SetStd().size() == 0) {
412  CRef<CAuthor> auth(new CAuthor());
413  auth->SetName().SetName().SetLast("Last");
414  auth_list.SetNames().SetStd().push_back(auth);
415  }
416  auth_list.SetNames().SetStd().back()->SetName().SetName().SetLast("Nyar");
417 }
418 
419 
421 {
422  CRef<CAuth_list> rval(NULL);
423  switch (pub.Which()) {
424  case CPub::e_Article:
425  rval.Reset(&(pub.SetArticle().SetAuthors()));
426  break;
427  case CPub::e_Gen:
428  rval.Reset(&(pub.SetGen().SetAuthors()));
429  break;
430  case CPub::e_Sub:
431  rval.Reset(&(pub.SetSub().SetAuthors()));
432  break;
433  case CPub::e_Book:
434  rval.Reset(&(pub.SetBook().SetAuthors()));
435  break;
436  case CPub::e_Proc:
437  rval.Reset(&(pub.SetProc().SetBook().SetAuthors()));
438  break;
439  case CPub::e_Man:
440  rval.Reset(&(pub.SetMan().SetCit().SetAuthors()));
441  break;
442  default:
443  rval = null;
444  break;
445  }
446  return rval;
447 }
448 
449 
451 {
452  bool rval = false;
453  CRef<CAuth_list> auth_list = s_SetAuthList(pub);
454  if (auth_list) {
455  s_ChangeAuthorFirstName(*auth_list);
456  rval = true;
457  }
458  return rval;
459 }
460 
461 
463 {
464  bool rval = true;
465  CRef<CAuth_list> auth_list = s_SetAuthList(pub);
466  if (auth_list) {
467  s_ChangeAuthorLastName(*auth_list);
468  rval = true;
469  }
470  return rval;
471 }
472 
473 
475 {
476  CRef<CImprint> imp(new CImprint());
477  imp->SetDate().SetStr("?");
479  return imp;
480 }
481 
482 
484 {
485  CRef<CImprint> imp(NULL);
486  switch (pub.Which()) {
487  case CPub::e_Article:
488  if (pub.GetArticle().IsSetFrom()) {
489  if (pub.GetArticle().GetFrom().IsJournal()) {
490  imp.Reset(&(pub.SetArticle().SetFrom().SetJournal().SetImp()));
491  } else if (pub.GetArticle().GetFrom().IsBook()) {
492  imp.Reset(&(pub.SetArticle().SetFrom().SetBook().SetImp()));
493  }
494  }
495  break;
496  case CPub::e_Sub:
497  imp.Reset(&(pub.SetSub().SetImp()));
498  break;
499  case CPub::e_Book:
500  imp.Reset(&(pub.SetBook().SetImp()));
501  break;
502  case CPub::e_Journal:
503  imp.Reset(&(pub.SetJournal().SetImp()));
504  break;
505  case CPub::e_Proc:
506  imp.Reset(&(pub.SetProc().SetBook().SetImp()));
507  break;
508  case CPub::e_Man:
509  imp.Reset(&(pub.SetMan().SetCit().SetImp()));
510  break;
511  default:
512  break;
513  }
514 
515  return imp;
516 }
517 
518 
519 void s_AddNameTitle(CTitle& title)
520 {
522  t->SetName("a random title");
523  title.Set().push_back(t);
524 }
525 
526 
528 {
529  if (title.Set().size() == 0) {
530  s_AddNameTitle(title);
531  }
532  title.Set().front()->SetName() += " plus";
533 }
534 
535 
536 void s_AddJTATitle(CTitle& title)
537 {
539  t->SetJta("a random title");
540  title.Set().push_back(t);
541 }
542 
543 
545 {
546  if (title.Set().size() == 0) {
547  s_AddJTATitle(title);
548  }
549  title.Set().front()->SetJta() += " plus";
550 }
551 
552 void s_ChangeTitle(CPub& pub)
553 {
554  switch (pub.Which()) {
555  case CPub::e_Article:
557  break;
558  case CPub::e_Book:
560  break;
561  case CPub::e_Journal:
563  break;
564  case CPub::e_Proc:
565  s_ChangeNameTitle(pub.SetProc().SetBook().SetTitle());
566  break;
567  case CPub::e_Man:
568  s_ChangeNameTitle(pub.SetMan().SetCit().SetTitle());
569  break;
570  case CPub::e_Gen:
571  pub.SetGen().SetCit() += " plus";
572  break;
573  default:
574  break;
575  }
576 }
577 
578 
579 void s_ChangeDate(CDate& date)
580 {
581  date.SetStd().SetYear(2014);
582 }
583 
584 
585 void s_ChangeImprintNoMatch(CImprint& imp, int change_no)
586 {
587  switch (change_no) {
588  case 0:
589  s_ChangeDate(imp.SetDate());
590  break;
591  case 1:
592  imp.SetVolume("123");
593  break;
594  default:
595  break;
596  }
597 }
598 
599 
600 void s_ChangeImprintMatch(CImprint& imp, int change_no)
601 {
602  switch (change_no) {
603  case 0:
605  break;
606  case 1:
607  imp.SetPub().SetStr("Publisher");
608  break;
609  default:
610  break;
611  }
612 }
613 
614 
615 bool s_ChangeImprintNoMatch(CPub& pub, int change_no)
616 {
617  bool rval = false;
618  CRef<CImprint> imp = s_SetImprint(pub);
619  if (imp) {
620  s_ChangeImprintNoMatch(*imp, change_no);
621  rval = true;
622  }
623  return rval;
624 }
625 
626 
627 bool s_ChangeImprintMatch(CPub& pub, int change_no)
628 {
629  bool rval = false;
630  CRef<CImprint> imp = s_SetImprint(pub);
631  if (imp) {
632  s_ChangeImprintMatch(*imp, change_no);
633  rval = true;
634  }
635  return rval;
636 }
637 
638 
639 BOOST_AUTO_TEST_CASE(Test_AuthList_SameCitation)
640 {
641  CRef<CAuth_list> auth_list1 = s_MakeAuthList();
642  CRef<CAuth_list> auth_list2(new CAuth_list());
643  auth_list2->Assign(*auth_list1);
644 
645  // should match if identical
646  BOOST_CHECK_EQUAL(auth_list1->SameCitation(*auth_list2), true);
647 
648  // should match if only difference is author first name
649  s_ChangeAuthorFirstName(*auth_list2);
650  BOOST_CHECK_EQUAL(auth_list1->SameCitation(*auth_list2), true);
651 
652  // should not match if different last name
653  s_ChangeAuthorLastName(*auth_list2);
654  BOOST_CHECK_EQUAL(auth_list1->SameCitation(*auth_list2), false);
655 }
656 
657 
659 {
660  CRef<CCit_jour> jour(new CCit_jour());
661 
662  CRef<CTitle::C_E> j_title(new CTitle::C_E());
663  j_title->SetJta("Experimental Parasitology");
664  jour->SetTitle().Set().push_back(j_title);
665  jour->SetImp().Assign(*s_MakeImprint());
666 
667  return jour;
668 }
669 
670 
672 {
673  CRef<CPub> pub(new CPub());
674  CRef<CTitle::C_E> title(new CTitle::C_E());
675  title->SetName("Isospora streperae n. sp. (Apicomplexa: Eimeriidae) from a Grey Currawong (Strepera versicolour plumbea) (Passeriformes: Artamidae) in Western Australia");
676  pub->SetArticle().SetTitle().Set().push_back(title);
677  pub->SetArticle().SetFrom().SetJournal().Assign(*s_MakeJournal());
678  pub->SetArticle().SetAuthors().Assign(*s_MakeAuthList());
679  return pub;
680 }
681 
682 
684 {
685  CRef<CCit_book> book(new CCit_book());
686  CRef<CTitle::C_E> b_title(new CTitle::C_E());
687  b_title->SetName("Book Title");
688  book->SetTitle().Set().push_back(b_title);
689  book->SetImp().Assign(*s_MakeImprint());
690  book->SetAuthors().Assign(*s_MakeAuthList());
691 
692  return book;
693 }
694 
695 
697 {
698  CRef<CPub> pub(new CPub());
699  CRef<CTitle::C_E> title(new CTitle::C_E());
700  title->SetName("Isospora streperae n. sp. (Apicomplexa: Eimeriidae) from a Grey Currawong (Strepera versicolour plumbea) (Passeriformes: Artamidae) in Western Australia");
701  pub->SetArticle().SetTitle().Set().push_back(title);
702  pub->SetArticle().SetFrom().SetBook().Assign(*s_MakeBook());
703  pub->SetArticle().SetAuthors().Assign(*s_MakeAuthList());
704  return pub;
705 }
706 
707 
709 {
710  CRef<CPub> other(new CPub());
711  other->Assign(pub);
712  // should match if only difference is author first name
713  s_ChangeAuthorFirstName(*other);
714  BOOST_CHECK_EQUAL(pub.SameCitation(*other), true);
715 
716  // should not match if difference in last name
717  other->Assign(pub);
718  s_ChangeAuthorLastName(*other);
719  BOOST_CHECK_EQUAL(pub.SameCitation(*other), false);
720 }
721 
722 
724 {
725  CRef<CPub> other(new CPub());
726  other->Assign(pub);
727 
728  if (!s_SetImprint(pub)) {
729  if (pub.IsGen()) {
730  // test dates
731  s_ChangeDate(other->SetGen().SetDate());
732  BOOST_CHECK_EQUAL(pub.SameCitation(*other), false);
733  }
734  return;
735  }
736 
737 
738  // should match if noncritical Imprint change
739  s_ChangeImprintMatch(*other, 0);
740  BOOST_CHECK_EQUAL(pub.SameCitation(*other), true);
741  other->Assign(pub);
742  s_ChangeImprintMatch(*other, 1);
743  BOOST_CHECK_EQUAL(pub.SameCitation(*other), true);
744 
745  // should not match if cricital Imprint change
746  other->Assign(pub);
747  s_ChangeImprintNoMatch(*other, 0);
748  BOOST_CHECK_EQUAL(pub.SameCitation(*other), false);
749  other->Assign(pub);
750  s_ChangeImprintNoMatch(*other, 1);
751  BOOST_CHECK_EQUAL(pub.SameCitation(*other), false);
752 
753 }
754 
755 
757 {
758  // should not match if extra text in article title
759  CRef<CPub> other(new CPub());
760  other->Assign(pub);
761  s_ChangeTitle(*other);
762  BOOST_CHECK_EQUAL(pub.SameCitation(*other), false);
763 }
764 
765 
766 BOOST_AUTO_TEST_CASE(Test_Pub_SameCitation)
767 {
769  CRef<CPub> pub2(new CPub());
770  pub2->Assign(*pub1);
771 
772  // journal article
773  // should match if identical
774  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
775 
776  // change journal title
777  s_ChangeJTATitle(pub2->SetArticle().SetFrom().SetJournal().SetTitle());
778  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
779 
780  s_TestAuthorChanges(*pub1);
781  s_TestImprintChanges(*pub1);
782  s_TestTitleChange(*pub1);
783 
784  // journal pub
785  pub1->SetJournal().Assign(*s_MakeJournal());
786  pub2->Assign(*pub1);
787 
788  // should match if identical
789  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
790 
791  s_TestImprintChanges(*pub1);
792  s_TestTitleChange(*pub1);
793 
794  // book chapter
795  pub1 = s_MakeBookChapterPub();
796  pub2->Assign(*pub1);
797 
798  // should match if identical
799  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
800 
801  // change book title
802  s_ChangeNameTitle(pub2->SetArticle().SetFrom().SetBook().SetTitle());
803  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
804 
805  s_TestAuthorChanges(*pub1);
806  s_TestImprintChanges(*pub1);
807  s_TestTitleChange(*pub1);
808 
809  // Book
810  pub1->SetBook().Assign(*s_MakeBook());
811  pub2->Assign(*pub1);
812 
813  // should match if identical
814  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
815 
816  s_TestAuthorChanges(*pub1);
817  s_TestImprintChanges(*pub1);
818  s_TestTitleChange(*pub1);
819 
820  // Proc
821  pub1->SetProc().SetBook().Assign(*s_MakeBook());
822  pub2->Assign(*pub1);
823 
824  // should match if identical
825  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
826 
827  s_TestAuthorChanges(*pub1);
828  s_TestImprintChanges(*pub1);
829  s_TestTitleChange(*pub1);
830 
831  // Man
832  pub1->SetMan().SetCit().Assign(*s_MakeBook());
833  pub2->Assign(*pub1);
834 
835  // should match if identical
836  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
837 
838  s_TestAuthorChanges(*pub1);
839  s_TestImprintChanges(*pub1);
840  s_TestTitleChange(*pub1);
841 
842 
843  // Gen
844  pub1->SetGen().SetCit("citation title");
845  pub1->SetGen().SetVolume("volume");
846  pub1->SetGen().SetIssue("issue");
847  pub1->SetGen().SetPages("pages");
848  pub1->SetGen().SetTitle("title");
849 
850  pub1->SetGen().SetAuthors().Assign(*s_MakeAuthList());
851  pub2->Assign(*pub1);
852 
853  // should match if identical
854  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
855 
856  // change other fields
857  // volume
858  pub2->SetGen().SetVolume("x");
859  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
860  pub1->SetGen().SetVolume("y");
861  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
862  pub2->Assign(*pub1);
863  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
864  // issue
865  pub2->SetGen().SetIssue("x");
866  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
867  pub1->SetGen().SetIssue("y");
868  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
869  pub2->Assign(*pub1);
870  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
871  // pages
872  pub2->SetGen().SetPages("x");
873  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
874  pub1->SetGen().SetPages("y");
875  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
876  pub2->Assign(*pub1);
877  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
878  // title
879  pub2->SetGen().SetTitle("x");
880  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
881  pub1->SetGen().SetTitle("y");
882  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
883  pub2->Assign(*pub1);
884  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
885  // muid
886  pub2->SetGen().SetMuid(ENTREZ_ID_FROM(TIntId, 40));
887  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
888  pub2->Assign(*pub1);
889  pub1->SetGen().SetMuid(ENTREZ_ID_FROM(TIntId, 42));
890  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
891  pub2->Assign(*pub1);
892  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
893  // serial number
894  pub2->SetGen().SetSerial_number(40);
895  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
896  pub1->SetGen().SetSerial_number(42);
897  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
898  pub2->Assign(*pub1);
899  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
900 
901  // journal
902  s_AddNameTitle(pub2->SetGen().SetJournal());
903  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
904  // should still be false if title types are different
905  s_AddJTATitle(pub1->SetGen().SetJournal());
906  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), false);
907  // but ok now
908  s_AddJTATitle(pub2->SetGen().SetJournal());
909  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
910 
911  s_TestAuthorChanges(*pub1);
912  s_TestImprintChanges(*pub1);
913  s_TestTitleChange(*pub1);
914 
915  // sub
916  pub1->SetSub().SetAuthors().Assign(*s_MakeAuthList());
917  pub1->SetSub().SetImp().Assign(*s_MakeImprint());
918  pub2->Assign(*pub1);
919 
920  // should match if identical
921  BOOST_CHECK_EQUAL(pub1->SameCitation(*pub2), true);
922 
923  s_TestAuthorChanges(*pub1);
924  s_TestImprintChanges(*pub1);
925 
926 }
927 
928 
929 BOOST_AUTO_TEST_CASE(Test_PubEquiv_SameCitation)
930 {
931  CRef<CPub_equiv> eq1(new CPub_equiv());
932 
934  eq1->Set().push_back(pub);
935 
936  CRef<CPub_equiv> eq2(new CPub_equiv());
937  eq2->Assign(*eq1);
938 
939  // should match if identical
940  BOOST_CHECK_EQUAL(eq1->SameCitation(*eq2), true);
941 
942  // should match if second also has PubMed ID (but first does not)
943  CRef<CPub> pmid2(new CPub());
944  pmid2->SetPmid().Set(ENTREZ_ID_FROM(TIntId, 4));
945  eq2->Set().push_back(pmid2);
946  BOOST_CHECK_EQUAL(eq1->SameCitation(*eq2), true);
947 
948  // but not if first has different article
949  s_ChangeAuthorLastName(eq1->Set().front()->SetArticle().SetAuthors());
950  BOOST_CHECK_EQUAL(eq1->SameCitation(*eq2), false);
951 
952  // won't match even if PubMed IDs match
953  CRef<CPub> pmid1(new CPub());
954  pmid1->SetPmid().Set(ENTREZ_ID_FROM(TIntId, 4));
955  eq1->Set().push_back(pmid1);
956  BOOST_CHECK_EQUAL(eq1->SameCitation(*eq2), false);
957 }
958 
959 
960 #define CHECK_COMMON_FIELD(o1,o2,c,Field,val1,val2) \
961  o1->Set##Field(val1); \
962  o2->Reset##Field(); \
963  c = o1->MakeCommon(*o2); \
964  BOOST_CHECK_EQUAL(c->IsSet##Field(), false); \
965  o2->Set##Field(val2); \
966  c = o1->MakeCommon(*o2); \
967  BOOST_CHECK_EQUAL(c->IsSet##Field(), false); \
968  o2->Set##Field(val1); \
969  c = o1->MakeCommon(*o2); \
970  BOOST_CHECK_EQUAL(c->IsSet##Field(), true); \
971  BOOST_CHECK_EQUAL(c->Get##Field(), o1->Get##Field());
972 
973 
974 BOOST_AUTO_TEST_CASE(Test_OrgName_MakeCommon)
975 {
976  CRef<COrgName> on1(new COrgName());
977  CRef<COrgName> on2(new COrgName());
978  CRef<COrgName> common = on1->MakeCommon(*on2);
979  if (common) {
980  BOOST_ASSERT("common OrgName should not have been created");
981  }
982 
983  on1->SetDiv("bacteria");
984  common = on1->MakeCommon(*on2);
985  if (common) {
986  BOOST_ASSERT("common OrgName should not have been created");
987  }
988  on2->SetDiv("archaea");
989  common = on1->MakeCommon(*on2);
990  if (common) {
991  BOOST_ASSERT("common OrgName should not have been created");
992  }
993  on2->SetDiv("bacteria");
994  common = on1->MakeCommon(*on2);
995  BOOST_CHECK_EQUAL(common->GetDiv(), "bacteria");
996 
997  // one orgmod on 1, no orgmods on 2, should not add orgmods to common
998  CRef<COrgMod> m1(new COrgMod());
1000  m1->SetSubname("x");
1001  on1->SetMod().push_back(m1);
1002  common = on1->MakeCommon(*on2);
1003  BOOST_CHECK_EQUAL(common->IsSetMod(), false);
1004  // one orgmod on 1, one orgmods on 2 of different type, should not add orgmods to common
1005  CRef<COrgMod> m2(new COrgMod());
1007  m2->SetSubname("x");
1008  on2->SetMod().push_back(m2);
1009 
1010  common = on1->MakeCommon(*on2);
1011  BOOST_CHECK_EQUAL(common->IsSetMod(), false);
1012  // same orgmod on both, should add
1014  common = on1->MakeCommon(*on2);
1015  BOOST_CHECK_EQUAL(common->IsSetMod(), true);
1016  BOOST_CHECK_EQUAL(common->GetMod().size(), 1);
1017  BOOST_CHECK_EQUAL(common->GetMod().front()->Equals(*m2), true);
1018 
1019  CHECK_COMMON_FIELD(on1,on2,common,Attrib,"x","y");
1020  CHECK_COMMON_FIELD(on1,on2,common,Lineage,"x","y");
1021  CHECK_COMMON_FIELD(on1,on2,common,Gcode,1,2);
1022  CHECK_COMMON_FIELD(on1,on2,common,Mgcode,3,4);
1023  CHECK_COMMON_FIELD(on1,on2,common,Pgcode,5,6);
1024 
1025 }
1026 
1027 
1028 #define CHECK_COMMON_STRING_LIST(o1,o2,c,Field,val1,val2) \
1029  o1->Set##Field().push_back(val1); \
1030  c = o1->MakeCommon(*o2); \
1031  BOOST_CHECK_EQUAL(c->IsSet##Field(), false); \
1032  o2->Set##Field().push_back(val2); \
1033  c = o1->MakeCommon(*o2); \
1034  BOOST_CHECK_EQUAL(c->IsSet##Field(), false); \
1035  o2->Set##Field().push_back(val1); \
1036  c = o1->MakeCommon(*o2); \
1037  BOOST_CHECK_EQUAL(c->IsSet##Field(), true); \
1038  BOOST_CHECK_EQUAL(c->Get##Field().size(), 1); \
1039  BOOST_CHECK_EQUAL(c->Get##Field().front(), val1);
1040 
1041 BOOST_AUTO_TEST_CASE(Test_OrgRef_MakeCommon)
1042 {
1043  CRef<COrg_ref> org1(new COrg_ref());
1044  CRef<COrg_ref> org2(new COrg_ref());
1045  CRef<COrg_ref> common = org1->MakeCommon(*org2);
1046  if (common) {
1047  BOOST_ASSERT("common OrgRef should not have been created");
1048  }
1049  org1->SetTaxId(TAX_ID_CONST(1));
1050  org2->SetTaxId(TAX_ID_CONST(2));
1051  common = org1->MakeCommon(*org2);
1052  if (common) {
1053  BOOST_ASSERT("common OrgRef should not have been created");
1054  }
1055 
1056  org2->SetTaxId(TAX_ID_CONST(1));
1057  common = org1->MakeCommon(*org2);
1058  BOOST_CHECK_EQUAL(common->GetTaxId(), TAX_ID_CONST(1));
1059  BOOST_CHECK_EQUAL(common->IsSetTaxname(), false);
1060 
1061  CHECK_COMMON_FIELD(org1,org2,common,Taxname,"A","B");
1062  CHECK_COMMON_FIELD(org1,org2,common,Common,"A","B");
1063 
1064  CHECK_COMMON_STRING_LIST(org1,org2,common,Mod,"a","b");
1065  CHECK_COMMON_STRING_LIST(org1,org2,common,Syn,"a","b");
1066 
1067 }
1068 
1069 
1070 BOOST_AUTO_TEST_CASE(Test_BioSource_MakeCommon)
1071 {
1072  CRef<CBioSource> src1(new CBioSource());
1073  CRef<CBioSource> src2(new CBioSource());
1074  CRef<CBioSource> common = src1->MakeCommon(*src2);
1075  if (common) {
1076  BOOST_ASSERT("common BioSource should not have been created");
1077  }
1078 
1079  src1->SetOrg().SetTaxId(TAX_ID_CONST(1));
1080  src2->SetOrg().SetTaxId(TAX_ID_CONST(1));
1081  common = src1->MakeCommon(*src2);
1082  BOOST_CHECK_EQUAL(common->GetOrg().GetTaxId(), TAX_ID_CONST(1));
1083 
1084  CRef<CSubSource> s1(new CSubSource());
1086  s1->SetName("x");
1087  src1->SetSubtype().push_back(s1);
1088  common = src1->MakeCommon(*src2);
1089  BOOST_CHECK_EQUAL(common->IsSetSubtype(), false);
1090 
1091  CRef<CSubSource> s2(new CSubSource());
1093  s2->SetName("y");
1094  src2->SetSubtype().push_back(s2);
1095  common = src1->MakeCommon(*src2);
1096  BOOST_CHECK_EQUAL(common->IsSetSubtype(), false);
1097 
1098  s2->SetName("x");
1099  common = src1->MakeCommon(*src2);
1100  BOOST_CHECK_EQUAL(common->IsSetSubtype(), true);
1101  BOOST_CHECK_EQUAL(common->GetSubtype().size(), 1);
1102  BOOST_CHECK_EQUAL(common->GetSubtype().front()->Equals(*s2), true);
1103 
1106 }
1107 
1108 BOOST_AUTO_TEST_CASE(Test_BioSource_GetRepliconName_CXX_10657)
1109 {
1110  CRef<CBioSource> src1(new CBioSource());
1111 
1112  src1->SetOrg().SetTaxId(TAX_ID_CONST(1));
1113 
1115  BOOST_CHECK_EQUAL(src1->IsSetSubtype(), true);
1116  // chromosome-name
1118  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "X");
1119  // remove chromosome setting
1120  src1->ResetSubtype();
1121  // Plasmid-name
1123  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "plasmid1");
1124  src1->ResetSubtype();
1125 
1126  // Plastid-name
1128  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "pltd1");
1129  src1->ResetSubtype();
1130 
1131  // endogenous-virus-name
1133  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "virus1");
1134  src1->ResetSubtype();
1135 
1136  // linkage-group
1139  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "LG2");
1140 
1141  // cleanup for next test
1142  src1->ResetSubtype();
1143  src1->ResetGenome();
1144 
1145  // segment
1146  // {
1147  // subtype segment,
1148  // name "DNA-U1"
1149  // }
1150  src1->SetOrg().SetOrgname().SetLineage("Viruses; ssDNA viruses; Nanoviridae; Nanovirus");
1152  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "DNA-U1");
1153  // reset for next tests
1154  src1->ResetSubtype();
1155  src1->ResetGenome();
1156 
1159  BOOST_CHECK_EQUAL(NStr::IsBlank(src1->GetRepliconName()), true);
1160  src1->ResetSubtype();
1161  src1->ResetGenome();
1162  //
1163  // default values
1164  //
1166  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "unnamed");
1168  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "unnamed");
1170  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "unnamed");
1171  // chromosome
1173  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "ANONYMOUS");
1174  // kinetoplast
1176  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "kinetoplast");
1177  // plastid
1179  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1181  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1183  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1185  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1187  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1189  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1191  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "Pltd");
1192  //
1193  // mitochondrion
1194  //
1196  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "MT");
1198  BOOST_CHECK_EQUAL(src1->GetRepliconName(), "MT");
1199  // blank
1200  src1->ResetGenome();
1201  BOOST_CHECK_EQUAL(NStr::IsBlank(src1->GetRepliconName()), true);
1202 }
1203 
1204 
1205 BOOST_AUTO_TEST_CASE(Test_Regulatory)
1206 {
1209  BOOST_CHECK_EQUAL(CSeqFeatData::GetRegulatoryClass(CSeqFeatData::eSubtype_RBS), "ribosome_binding_site");
1210  BOOST_CHECK_EQUAL(CSeqFeatData::GetRegulatoryClass(CSeqFeatData::eSubtype_terminator), "terminator");
1211  BOOST_CHECK_EQUAL(CSeqFeatData::IsRegulatory(CSeqFeatData::eSubtype_LTR), true);
1212 }
1213 
1214 
1215 BOOST_AUTO_TEST_CASE(Test_RmCultureNotes)
1216 {
1217  CRef<CSubSource> ss(new CSubSource());
1219  ss->SetName("a; [mixed bacterial source]; b");
1220  ss->RemoveCultureNotes();
1221  BOOST_CHECK_EQUAL(ss->GetName(), "a; b");
1222  ss->SetName("[uncultured (using species-specific primers) bacterial source]");
1223  ss->RemoveCultureNotes();
1224  BOOST_CHECK_EQUAL(ss->GetName(), "amplified with species-specific primers");
1225  ss->SetName("[BankIt_uncultured16S_wizard]; [universal primers]; [tgge]");
1226  ss->RemoveCultureNotes();
1227  BOOST_CHECK_EQUAL(ss->IsSetName(), false);
1228  ss->SetName("[BankIt_uncultured16S_wizard]; [species_specific primers]; [dgge]");
1229  ss->RemoveCultureNotes();
1230  BOOST_CHECK_EQUAL(ss->GetName(), "amplified with species-specific primers");
1231 
1232  CRef<CBioSource> src(new CBioSource());
1233  ss->SetName("a; [mixed bacterial source]; b");
1234  src->SetSubtype().push_back(ss);
1235  src->RemoveCultureNotes();
1236  BOOST_CHECK_EQUAL(ss->GetName(), "a; b");
1237  ss->SetName("[BankIt_uncultured16S_wizard]; [universal primers]; [tgge]");
1238  src->RemoveCultureNotes();
1239  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1240 
1241  ss->SetName("[BankIt_uncultured16S_wizard]; [species_specific primers]; [dgge]");
1242  ss->RemoveCultureNotes(false);
1243  BOOST_CHECK_EQUAL(ss->GetName(), "[BankIt_uncultured16S_wizard]; [species_specific primers]; [dgge]");
1244 
1245  ss->SetName("[BankIt_cultured16S_wizard]");
1246  src->RemoveCultureNotes();
1247  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1248 
1249 }
1250 
1251 BOOST_AUTO_TEST_CASE(Test_DiscouragedEnums)
1252 {
1253  // check for enums that pass
1254  //
1255  // make sure to pick subtypes and quals that are
1256  // very unlikely to be deprecated in the future
1257 
1258  // check for discouraged enums
1259  BOOST_CHECK(
1261  BOOST_CHECK(
1263 
1264  BOOST_CHECK(
1266  BOOST_CHECK(
1268 }
1269 
1270 
1271 BOOST_AUTO_TEST_CASE(Test_CheckCellLine)
1272 {
1273  string msg = CSubSource::CheckCellLine("222", "Homo sapiens");
1274  BOOST_CHECK_EQUAL(msg, "The International Cell Line Authentication Committee database indicates that 222 from Homo sapiens is known to be contaminated by PA1 from Human. Please see http://iclac.org/databases/cross-contaminations/ for more information and references.");
1275 
1276  msg = CSubSource::CheckCellLine("223", "Homo sapiens");
1277  BOOST_CHECK_EQUAL(msg, "");
1278 
1279  msg = CSubSource::CheckCellLine("222", "Canis familiaris");
1280  BOOST_CHECK_EQUAL(msg, "");
1281 
1282  msg = CSubSource::CheckCellLine("ARO81-1", "Homo sapiens");
1283  BOOST_CHECK_EQUAL(msg, "The International Cell Line Authentication Committee database indicates that ARO81-1 from Homo sapiens is known to be contaminated by HT-29 from Human. Please see http://iclac.org/databases/cross-contaminations/ for more information and references.");
1284 
1285  msg = CSubSource::CheckCellLine("aRO81-1", "Homo sapiens");
1286  BOOST_CHECK_EQUAL(msg, "The International Cell Line Authentication Committee database indicates that aRO81-1 from Homo sapiens is known to be contaminated by HT-29 from Human. Please see http://iclac.org/databases/cross-contaminations/ for more information and references.");
1287 
1288  msg = CSubSource::CheckCellLine("IPRI-OL-7", "Orgyia leucostigma");
1289  BOOST_CHECK_EQUAL(msg, "The International Cell Line Authentication Committee database indicates that IPRI-OL-7 from Orgyia leucostigma is known to be contaminated by IPRI-CF-124 from Choristoneura fumiferana. Please see http://iclac.org/databases/cross-contaminations/ for more information and references.");
1290 }
1291 
1292 
1293 BOOST_AUTO_TEST_CASE(Test_FixStrain)
1294 {
1295  BOOST_CHECK_EQUAL(COrgMod::FixStrain("DSM1235"), "DSM 1235");
1296  BOOST_CHECK_EQUAL(COrgMod::FixStrain("DSM/1235"), "DSM 1235");
1297  BOOST_CHECK_EQUAL(COrgMod::FixStrain("dsm/1235"), "DSM 1235");
1298  BOOST_CHECK_EQUAL(COrgMod::FixStrain("dsm:1235"), "DSM 1235");
1299  BOOST_CHECK_EQUAL(COrgMod::FixStrain("dsm : 1235"), "DSM 1235");
1300  BOOST_CHECK_EQUAL(COrgMod::FixStrain("DSM"), "DSM");
1301 
1302  BOOST_CHECK_EQUAL(COrgMod::FixStrain("ATCC1235"), "ATCC 1235");
1303  BOOST_CHECK_EQUAL(COrgMod::FixStrain("ATCC/1235"), "ATCC 1235");
1304  BOOST_CHECK_EQUAL(COrgMod::FixStrain("atcc/1235"), "ATCC 1235");
1305  BOOST_CHECK_EQUAL(COrgMod::FixStrain("atcc:1235"), "ATCC 1235");
1306  BOOST_CHECK_EQUAL(COrgMod::FixStrain("atcc : 1235"), "ATCC 1235");
1307  BOOST_CHECK_EQUAL(COrgMod::FixStrain("ATCC"), "ATCC");
1308 }
1309 
1310 BOOST_AUTO_TEST_CASE(Test_AllowedFeatureLocation)
1311 {
1316 }
1317 
1318 
1319 BOOST_AUTO_TEST_CASE(Test_SQD_2180)
1320 {
1321  string msg = CSubSource::CheckCellLine("Yamada", "Canis lupus familiaris");
1322  BOOST_CHECK_EQUAL(msg, "The International Cell Line Authentication Committee database indicates that Yamada from Canis lupus familiaris is known to be contaminated by Unknown from Mouse. Please see http://iclac.org/databases/cross-contaminations/ for more information and references.");
1323 
1324 }
1325 
1326 
1327 BOOST_AUTO_TEST_CASE(Test_SQD_2183)
1328 {
1329  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("100 meters"), "100 m");
1330  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("100 meter"), "100 m");
1331  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("100 m"), "100 m");
1332  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("100 feet"), "30 m");
1333  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("100 foot"), "30 m");
1334 
1335  //for VR-823
1336  BOOST_CHECK_EQUAL(CSubSource::FixAltitude("1,950 m"), "1950 m");
1337 }
1338 
1339 
1340 BOOST_AUTO_TEST_CASE(Test_SQD_2164)
1341 {
1342  BOOST_CHECK_EQUAL(CCountries::CountryFixupItem("Mediterranean, Malvarrosa Beach (Valencia, Spain)", false),
1343  "Spain: Mediterranean, Malvarrosa Beach (Valencia)");
1344 
1345 }
1346 
1347 
1349 {
1350  BOOST_CHECK_EQUAL(CCountries::CountryFixupItem("China:, Guangdong Province, Guangzhou City, Tianlu Lake Forest Park", false),
1351  "China: Guangdong Province, Guangzhou City, Tianlu Lake Forest Park");
1352 
1353  BOOST_CHECK_EQUAL(CCountries::CountryFixupItem("China", false), "China");
1354  BOOST_CHECK_EQUAL(CCountries::CountryFixupItem("China: ,", false), "China");
1355  BOOST_CHECK_EQUAL(CCountries::CountryFixupItem("China: Guangdong Province", false), "China: Guangdong Province");
1356 }
1357 
1358 
1360 {
1361  bool ambig = false;
1362  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("06/11/11", true, ambig), "11-Jun-2011");
1363  BOOST_CHECK_EQUAL(ambig, true);
1364  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("06/11/11"), "");
1365 
1366  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("11/8/12"), "");
1367  ambig = false;
1368  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("11/8/12", true, ambig), "08-Nov-2012");
1369  ambig = false;
1370  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("11/8/12", false, ambig), "11-Aug-2012");
1371 
1372  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("Nov/8/12"), "08-Nov-2012");
1373  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("11/Aug/12"), "11-Aug-2012");
1374 }
1375 
1376 
1378 {
1379  bool ambig = false;
1380  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("15-Jul-13", false, ambig), "15-Jul-2013");
1381  BOOST_CHECK_EQUAL(ambig, false);
1382 }
1383 
1384 BOOST_AUTO_TEST_CASE(Test_SQD_2319)
1385 {
1386  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("2012-01-52"), "");
1387 }
1388 
1389 
1391 {
1392  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("June2011"), "Jun-2011");
1393 }
1394 
1395 
1396 BOOST_AUTO_TEST_CASE(Test_SQD_3603)
1397 {
1398  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("11-2009"), "Nov-2009");
1399 }
1400 
1402 {
1403  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13-Sept-2012"), "13-Sep-2012");
1404  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13-J-2012"), "");
1405  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13-Ja-2012"), "");
1406  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13-May-2012"), "13-May-2012");
1407  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13.Septemb.2012"), "13-Sep-2012");
1408  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("13-Setp-2012"), "");
1409 }
1410 
1412  const char * date_to_fix;
1413  const char * expected_result;
1414 };
1415 
1416 BOOST_AUTO_TEST_CASE(Test_FixDateFormat_for_BI_2614)
1417 {
1418  // all these formats should be acceptable, according to
1419  // https://intranet.ncbi.nlm.nih.gov/ieb/DIRSUB/FT/
1420  // (as of 10-Nov-2015), except a few which can be fixed by
1421  // CSubSource::FixDateFormat
1422  //
1423  // In most cases CSubSource::FixDateFormat doesn't do anything,
1424  // but there are a few formats which are not normally accepted but
1425  // which CSubSource::FixDateFormat can fix.
1426  static SCollDateInfo kGoodCollectionDates[] = {
1427  // ISO date/times stay the same after CSubSource::FixDateFormat
1428  { "1952", "1952" },
1429  { "1952-10-21T11:43Z", "1952-10-21T11:43Z"},
1430  { "1952-10-21T11Z", "1952-10-21T11Z" },
1431  { "1952-10-21","1952-10-21" },
1432  { "1952-10", "1952-10" },
1433  { "1952/1953", "1952/1953" },
1434  { "1952-10-21/1953-02-15", "1952-10-21/1953-02-15" },
1435  { "1952-10/1953-02", "1952-10/1953-02" },
1436  { "1952-10-21T11:43Z/1952-10-21T17:43Z",
1437  "1952-10-21T11:43Z/1952-10-21T17:43Z"},
1438 
1439  // Dates already in DD-Mmm-YYY format also remain unchanged
1440  // after CSubSource::FixDateFormat
1441  { "21-Oct-1952", "21-Oct-1952" },
1442  { "Oct-1952", "Oct-1952" },
1443  { "21-Oct-1952/15-Feb-1953", "21-Oct-1952/15-Feb-1953" },
1444  { "Oct-1952/Feb-1953", "Oct-1952/Feb-1953" },
1445 
1446  // A few formats can be corrected
1447  { "1-1-1952", "01-Jan-1952" },
1448  { "1-1-1952/2-2-1952", "01-Jan-1952/02-Feb-1952" }
1449  };
1450  ITERATE_0_IDX(idx, ArraySize(kGoodCollectionDates)) {
1451  // check CSubSource::FixDateFormat
1452  const string fixed_date =
1453  CSubSource::FixDateFormat(kGoodCollectionDates[idx].date_to_fix);
1454  const string expected_date(
1455  kGoodCollectionDates[idx].expected_result);
1456  BOOST_CHECK_EQUAL(fixed_date, expected_date);
1457 
1458  // check that fixed dates do pass CSubSource::IsCorrectDateFormat
1459  bool bad_format = false;
1460  bool in_future = false;
1462  fixed_date, bad_format, in_future);
1463  BOOST_CHECK_MESSAGE( ! bad_format, fixed_date );
1464  BOOST_CHECK_MESSAGE( ! in_future, fixed_date );
1465 
1466  // check that fixed_date also passes
1467  // CSubSource::GetCollectionDateProblem
1468  BOOST_CHECK_MESSAGE(
1469  "" == CSubSource::GetCollectionDateProblem(fixed_date),
1470  fixed_date);
1471 
1472  // divide into pieces for the functions that cannot handle a "/"
1473  vector<string> date_pieces_strs;
1474  NStr::Split(fixed_date, "/", date_pieces_strs);
1475 
1476  ITERATE( vector<string>, date_piece_ci, date_pieces_strs ) {
1477  const string & date_piece_str = *date_piece_ci;
1478 
1479  // make sure fixed dates are acceptable to
1480  // CSubSource::DateFromCollectionDate
1481  BOOST_CHECK_MESSAGE(
1482  CSubSource::DateFromCollectionDate(date_piece_str),
1483  date_piece_str);
1484  BOOST_CHECK_MESSAGE(
1485  CSubSource::DateFromCollectionDate(date_piece_str),
1486  date_piece_str);
1487  }
1488  }
1489 }
1490 
1491 BOOST_AUTO_TEST_CASE(Test_GetRNAProduct)
1492 {
1493  CRef<CRNA_ref> rna(new CRNA_ref());
1494  rna->SetType(CRNA_ref::eType_mRNA);
1495  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), kEmptyStr);
1496 
1497  string product("mRNA product");
1498  rna->SetExt().SetName(product);
1499  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1500 
1501  rna->SetType(CRNA_ref::eType_miscRNA);
1502  CRef<CRNA_gen> rna_gen(new CRNA_gen());
1503  rna->SetExt().SetGen(*rna_gen);
1504  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), kEmptyStr);
1505 
1506  product.assign("miscRNA product");
1507  rna_gen->SetProduct(product);
1508  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1509 
1510  // the type of RNA does not affect the product name
1511  rna->SetType(CRNA_ref::eType_ncRNA);
1512  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1513 
1514  rna->SetType(CRNA_ref::eType_tRNA);
1515  product.assign("tRNA-Ser");
1516  rna->SetExt().SetTRNA().SetAa().SetNcbieaa(83);
1517  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1518 
1519  rna->SetType(CRNA_ref::eType_ncRNA);
1520  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1521 
1522  product.assign("tRNA-Met");
1523  rna->SetType(CRNA_ref::eType_tRNA);
1524  rna->SetExt().SetTRNA().SetAa().SetIupacaa(77);
1525  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1526 
1527  product.assign("tRNA-OTHER");
1528  rna->SetExt().SetTRNA().SetAa().SetIupacaa(88);
1529  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1530 
1531  rna->SetExt().SetTRNA().SetAa().SetNcbieaa(88);
1532  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1533 
1534  product.assign("tRNA-TERM");
1535  rna->SetExt().SetTRNA().SetAa().SetNcbieaa(42);
1536  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1537 
1538  rna->SetExt().SetTRNA().SetAa().SetIupacaa(42);
1539  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1540 
1541  product.clear();
1542  rna->SetExt().SetTRNA().SetAa().SetIupacaa(43);
1543  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), product);
1544 }
1545 
1546 BOOST_AUTO_TEST_CASE(Test_SetRnaProductName)
1547 {
1548  CRef<CRNA_ref> rna(new CRNA_ref());
1549 
1550  string remainder;
1551  string product("mRNA product");
1552  rna->SetType(CRNA_ref::eType_mRNA);
1553  rna->SetRnaProductName(product, remainder);
1554  BOOST_CHECK_EQUAL(rna->IsSetExt(), true);
1555  BOOST_CHECK_EQUAL(rna->GetExt().GetName(), product);
1556  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1557 
1558  product.resize(0);
1559  rna->SetRnaProductName(product, remainder);
1560  BOOST_CHECK_EQUAL(rna->IsSetExt(), false);
1561  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1562 
1563  product.assign("rRNA product");
1564  rna->SetType(CRNA_ref::eType_rRNA);
1565  rna->SetRnaProductName(product, remainder);
1566  BOOST_CHECK_EQUAL(rna->IsSetExt(), true);
1567  BOOST_CHECK_EQUAL(rna->GetExt().GetName(), product);
1568  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1569 
1570  product.resize(0);
1571  rna->SetRnaProductName(product, remainder);
1572  BOOST_CHECK_EQUAL(rna->IsSetExt(), false);
1573  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1574 
1575  product.assign("miscRNA product");
1576  rna->SetType(CRNA_ref::eType_miscRNA);
1577  rna->SetRnaProductName(product, remainder);
1578  BOOST_CHECK_EQUAL(rna->IsSetExt(), true);
1579  BOOST_CHECK_EQUAL(rna->GetExt().GetGen().GetProduct(), product);
1580  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1581 
1582  product.resize(0);
1583  rna->SetRnaProductName(product, remainder);
1584  BOOST_CHECK_EQUAL(rna->IsSetExt(), false);
1585  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1586 
1587  // name containing underscore is not recognized
1588  product.assign("tRNA_Ala");
1589  rna->SetType(CRNA_ref::eType_tRNA);
1590  rna->SetRnaProductName(product, remainder);
1591  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1592  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().IsSetAa(), false);
1593  BOOST_CHECK_EQUAL(remainder, product);
1594 
1595  // it is also case-sensitive
1596  product.assign("TRNA-Ala");
1597  rna->SetRnaProductName(product, remainder);
1598  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1599  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().IsSetAa(), false);
1600  BOOST_CHECK_EQUAL(remainder, product);
1601 
1602  product.assign("tRNA-Ala");
1603  rna->SetRnaProductName(product, remainder);
1604  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().IsSetAa(), true);
1605  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 65);
1606  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1607 
1608  product.clear();
1609  rna->SetRnaProductName(product, remainder);
1610  BOOST_CHECK_EQUAL(rna->IsSetExt(), true);
1611  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().IsSetAa(), false);
1612  BOOST_CHECK_EQUAL(rna->GetRnaProductName(), kEmptyStr);
1613  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1614 
1615  product.assign("Ser");
1616  rna->SetRnaProductName(product, remainder);
1617  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1618  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 83);
1619  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1620 
1621  product.assign("TERM");
1622  rna->SetRnaProductName(product, remainder);
1623  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1624  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 42);
1625  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1626 
1627  product.assign("tRNA-other");
1628  rna->SetRnaProductName(product, remainder);
1629  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1630  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 88);
1631  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1632 
1633  // also take single-letter codes
1634  product.assign("tRNA-A(gct)");
1635  rna->SetRnaProductName(product, remainder);
1636  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1637  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 65);
1638  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1639 
1640  product.assign("tRNA-*(gct)");
1641  rna->SetRnaProductName(product, remainder);
1642  BOOST_CHECK_EQUAL(rna->GetExt().IsTRNA(), true);
1643  BOOST_CHECK_EQUAL(rna->GetExt().GetTRNA().GetAa().GetNcbieaa(), 42);
1644  BOOST_CHECK_EQUAL(remainder, kEmptyStr);
1645 
1646 }
1647 
1648 
1649 BOOST_AUTO_TEST_CASE(Test_IsIllegalQualName)
1650 {
1651  BOOST_CHECK_EQUAL(CGb_qual::IsIllegalQualName("exception"), true);
1652  BOOST_CHECK_EQUAL(CGb_qual::IsIllegalQualName("number"), false);
1653 }
1654 
1655 
1656 BOOST_AUTO_TEST_CASE(Test_IsECNumberSplit)
1657 {
1658  BOOST_CHECK_EQUAL(CProt_ref::IsECNumberSplit("1.1.1.246"), true);
1659  BOOST_CHECK_EQUAL(CProt_ref::IsECNumberSplit("1.1.1.63"), false);
1660  BOOST_CHECK_EQUAL(CProt_ref::IsECNumberSplit("1.1.1.128"), false);
1661 }
1662 
1663 
1664 BOOST_AUTO_TEST_CASE(Test_FileTrack)
1665 {
1666  CRef<CUser_object> obj(new CUser_object());
1667 
1668  obj->SetFileTrackUploadId("7azalbch/brev2_motif_summary.csv");
1669  BOOST_CHECK_EQUAL(obj->GetObjectType(), CUser_object::eObjectType_FileTrack);
1670  BOOST_CHECK_EQUAL(obj->GetData().front()->GetLabel().GetStr(), "BaseModification-FileTrackURL");
1671  BOOST_CHECK_EQUAL(obj->GetData().front()->GetData().GetStr(), "https://submit.ncbi.nlm.nih.gov/ft/byid/7azalbch/brev2_motif_summary.csv");
1672 }
1673 
1674 
1675 BOOST_AUTO_TEST_CASE(Test_EnvSampleCleanup)
1676 {
1677  CRef<CBioSource> src(new CBioSource());
1678 
1679  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1680  src->SetOrg().SetTaxname("uncultured x");
1681  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), true);
1682  BOOST_CHECK_EQUAL(src->GetSubtype().front()->GetSubtype(), CSubSource::eSubtype_environmental_sample);
1683  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1684 
1685  src->ResetSubtype();
1686  src->SetOrg().SetTaxname("Homo sapiens");
1687  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1689  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), true);
1690  BOOST_CHECK_EQUAL(src->GetSubtype().back()->GetSubtype(), CSubSource::eSubtype_environmental_sample);
1691  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1692 
1693  src->ResetSubtype();
1694  src->SetOrg().SetOrgname().SetDiv("ENV");
1695  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), true);
1696  BOOST_CHECK_EQUAL(src->GetSubtype().front()->GetSubtype(), CSubSource::eSubtype_environmental_sample);
1697  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1698 
1699  src->ResetSubtype();
1700  src->SetOrg().SetOrgname().ResetDiv();
1701  src->SetOrg().SetOrgname().SetLineage("metagenomes");
1702  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), true);
1703  BOOST_CHECK_EQUAL(src->GetSubtype().front()->GetSubtype(), CSubSource::eSubtype_environmental_sample);
1704  BOOST_CHECK_EQUAL(src->GetSubtype().back()->GetSubtype(), CSubSource::eSubtype_metagenomic);
1705  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1706 
1707  src->ResetSubtype();
1708  src->SetOrg().SetOrgname().ResetLineage();
1709  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_metagenome_source, "X")));
1710  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), true);
1711  BOOST_CHECK_EQUAL(src->GetSubtype().front()->GetSubtype(), CSubSource::eSubtype_environmental_sample);
1712  BOOST_CHECK_EQUAL(src->GetSubtype().back()->GetSubtype(), CSubSource::eSubtype_metagenomic);
1713  BOOST_CHECK_EQUAL(src->FixEnvironmentalSample(), false);
1714 
1715 }
1716 
1717 
1718 BOOST_AUTO_TEST_CASE(Test_RemoveNullTerms)
1719 {
1720  CRef<CBioSource> src(new CBioSource());
1721 
1723  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_acronym, "Missing")));
1724  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_anamorph, "not Missing")));
1725 
1726  BOOST_CHECK_EQUAL(src->RemoveNullTerms(), true);
1727  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1728  BOOST_CHECK_EQUAL(src->GetOrg().GetOrgname().GetMod().size(), 1);
1729  BOOST_CHECK_EQUAL(src->GetOrg().GetOrgname().GetMod().front()->GetSubtype(), COrgMod::eSubtype_anamorph);
1730 }
1731 
1732 
1733 BOOST_AUTO_TEST_CASE(Test_RemoveAbbreviation)
1734 {
1736  BOOST_CHECK_EQUAL(om->RemoveAbbreviation(), true);
1737  BOOST_CHECK_EQUAL(om->GetSubname(), "x");
1738 
1739  CRef<COrgMod> om2(new COrgMod(COrgMod::eSubtype_sub_species, "subsp. y"));
1740  BOOST_CHECK_EQUAL(om2->RemoveAbbreviation(), true);
1741  BOOST_CHECK_EQUAL(om2->GetSubname(), "y");
1742 
1743 }
1744 
1745 
1746 BOOST_AUTO_TEST_CASE(Test_FixSexMatingTypeInconsistencies)
1747 {
1748  CRef<CBioSource> src(new CBioSource());
1749 
1750  src->SetOrg().SetOrgname().SetLineage("Viruses; foo");
1751  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), false);
1752  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), false);
1753  src->SetOrg().SetOrgname().SetLineage("Bacteria; foo");
1754  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), false);
1755  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), true);
1756  src->SetOrg().SetOrgname().SetLineage("Archaea; foo");
1757  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), false);
1758  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), true);
1759  src->SetOrg().SetOrgname().SetLineage("Eukaryota; Fungi; foo");
1760  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), false);
1761  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), true);
1762  src->SetOrg().SetOrgname().SetLineage("Eukaryota; Metazoa; foo");
1763  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), true);
1764  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), false);
1765  src->SetOrg().SetOrgname().SetLineage("Eukaryota; Viridiplantae; Streptophyta; Embryophyta; foo");
1766  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), true);
1767  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), false);
1768  src->SetOrg().SetOrgname().SetLineage("Eukaryota; Rhodophyta; foo");
1769  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), true);
1770  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), false);
1771  src->SetOrg().SetOrgname().SetLineage("Eukaryota; stramenopiles; Phaeophyceae; foo");
1772  BOOST_CHECK_EQUAL(src->AllowSexQualifier(), true);
1773  BOOST_CHECK_EQUAL(src->AllowMatingTypeQualifier(), false);
1774 
1776  src->SetSubtype().push_back(s);
1777  BOOST_CHECK_EQUAL(src->FixSexMatingTypeInconsistencies(), false);
1778  BOOST_CHECK_EQUAL(src->GetSubtype().size(), 1);
1779 
1781  BOOST_CHECK_EQUAL(src->FixSexMatingTypeInconsistencies(), true);
1782  BOOST_CHECK_EQUAL(src->GetSubtype().size(), 1);
1783  BOOST_CHECK_EQUAL(src->GetSubtype().front()->GetSubtype(), CSubSource::eSubtype_sex);
1784 
1786  s->SetName("foo");
1787  BOOST_CHECK_EQUAL(src->FixSexMatingTypeInconsistencies(), true);
1788  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1789 
1790  src->SetOrg().SetOrgname().SetLineage("Viruses; foo");
1791  src->SetSubtype().push_back(s);
1792  BOOST_CHECK_EQUAL(src->FixSexMatingTypeInconsistencies(), true);
1793  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1794 
1796  src->SetSubtype().push_back(s);
1797  BOOST_CHECK_EQUAL(src->FixSexMatingTypeInconsistencies(), true);
1798  BOOST_CHECK_EQUAL(src->IsSetSubtype(), false);
1799 
1800 }
1801 
1802 
1803 BOOST_AUTO_TEST_CASE(Test_RemoveUnexpectedViralQualifiers)
1804 {
1805  CRef<CBioSource> src(new CBioSource());
1806 
1807  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_breed, "x")));
1808  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_cultivar, "y")));
1809  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_specimen_voucher, "z")));
1810  src->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(COrgMod::eSubtype_acronym, "a")));
1811 
1812  BOOST_CHECK_EQUAL(src->RemoveUnexpectedViralQualifiers(), false);
1813  BOOST_CHECK_EQUAL(src->GetOrg().GetOrgname().GetMod().size(), 4);
1814  src->SetOrg().SetOrgname().SetLineage("Viruses; foo");
1815  BOOST_CHECK_EQUAL(src->RemoveUnexpectedViralQualifiers(), true);
1816  BOOST_CHECK_EQUAL(src->GetOrg().GetOrgname().GetMod().size(), 1);
1817  BOOST_CHECK_EQUAL(src->GetOrg().GetOrgname().GetMod().front()->GetSubtype(), COrgMod::eSubtype_acronym);
1818 
1819 }
1820 
1821 
1822 BOOST_AUTO_TEST_CASE(Test_FixGenomeForQualifiers)
1823 {
1824  CRef<CBioSource> src(new CBioSource());
1825 
1826  BOOST_CHECK_EQUAL(src->FixGenomeForQualifiers(), false);
1828  BOOST_CHECK_EQUAL(src->FixGenomeForQualifiers(), true);
1829  BOOST_CHECK_EQUAL(src->GetGenome(), CBioSource::eGenome_plasmid);
1830  BOOST_CHECK_EQUAL(src->FixGenomeForQualifiers(), false);
1832  BOOST_CHECK_EQUAL(src->FixGenomeForQualifiers(), false);
1833  BOOST_CHECK_EQUAL(src->GetGenome(), CBioSource::eGenome_apicoplast);
1835  BOOST_CHECK_EQUAL(src->FixGenomeForQualifiers(), true);
1836  BOOST_CHECK_EQUAL(src->GetGenome(), CBioSource::eGenome_plasmid);
1837 }
1838 
1839 
1840 BOOST_AUTO_TEST_CASE(Test_AllowXref)
1841 {
1848 }
1849 
1850 BOOST_AUTO_TEST_CASE(Test_recombination_class)
1851 {
1854  BOOST_ASSERT(recomb_values.find("chromosome_breakpoint") != recomb_values.end());
1855 
1856 
1857  string old_recomb_value("meiotic_recombination");
1858  BOOST_CHECK_EQUAL(CGb_qual::FixRecombinationClassValue(old_recomb_value), true);
1859  BOOST_CHECK_EQUAL(old_recomb_value, "meiotic");
1860 
1861  old_recomb_value = ("other:non_allelic_homologous_recombination");
1862  BOOST_CHECK_EQUAL(CGb_qual::FixRecombinationClassValue(old_recomb_value), true);
1863  BOOST_CHECK_EQUAL(old_recomb_value, "non_allelic_homologous");
1864 
1865  string valid_recomb_value("mitotic");
1866  BOOST_CHECK_EQUAL(CGb_qual::FixRecombinationClassValue(valid_recomb_value), false);
1867  BOOST_CHECK_EQUAL(valid_recomb_value, "mitotic");
1868 }
1869 
1870 
1871 BOOST_AUTO_TEST_CASE(Test_OrgMod_IsDiscouraged)
1872 {
1874  BOOST_CHECK_EQUAL(COrgMod::IsDiscouraged(COrgMod::eSubtype_metagenome_source, true), false);
1875 }
1876 
1877 
1879 {
1880  src.SetOrg().SetOrgname().SetLineage("viruses");
1881  BOOST_CHECK_EQUAL(src.GetBioprojectType(), "eSegment");
1882  BOOST_CHECK_EQUAL(src.GetBioprojectLocation(), "eVirionPhage");
1883  src.SetOrg().SetOrgname().SetLineage("viroids");
1884  BOOST_CHECK_EQUAL(src.GetBioprojectType(), "eSegment");
1885  BOOST_CHECK_EQUAL(src.GetBioprojectLocation(), "eViroid");
1886  src.SetOrg().SetOrgname().ResetLineage();
1887 }
1888 
1889 
1891 {
1893  src.SetSubtype().push_back(p);
1894  BOOST_CHECK_EQUAL(src.GetBioprojectType(), "ePlasmid");
1895  src.ResetSubtype();
1896 }
1897 
1898 
1899 void CheckBioProjectLocationVals(CBioSource::EGenome genome, const string& bioprojectlocation)
1900 {
1901  CRef<CBioSource> src(new CBioSource());
1902  src->SetGenome(genome);
1903  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eChromosome");
1904  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), bioprojectlocation);
1905  CheckViruses(*src);
1906  CheckPlasmid(*src);
1907 }
1908 
1909 
1910 BOOST_AUTO_TEST_CASE(Test_GetBioProjectTypeAndLocation)
1911 {
1912  CRef<CBioSource> src(new CBioSource());
1913  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eChromosome");
1914  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), "eNuclearProkaryote");
1915  CheckViruses(*src);
1916 
1918  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eChromosome");
1919  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), "eNuclearProkaryote");
1920  CheckViruses(*src);
1921 
1923  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eChromosome");
1924  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), "eNuclearProkaryote");
1926  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eLinkageGroup");
1927  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), "eNuclearProkaryote");
1928  src->ResetSubtype();
1929 
1931  BOOST_CHECK_EQUAL(src->GetBioprojectType(), "eExtrachrom");
1932  BOOST_CHECK_EQUAL(src->GetBioprojectLocation(), "eNuclearProkaryote");
1933 
1951 
1952 }
1953 
1954 
1955 BOOST_AUTO_TEST_CASE(Test_OrgRefLookup)
1956 {
1957  string taxname = "Zea mays";
1958 
1960  if (! lookup) {
1961  BOOST_CHECK_EQUAL("", taxname);
1962  return;
1963  }
1964  BOOST_CHECK_EQUAL(lookup->GetTaxname(), taxname);
1965  BOOST_CHECK_EQUAL(lookup->GetOrgname().GetDiv(), "PLN");
1966 }
1967 
1968 
1969 BOOST_AUTO_TEST_CASE(Test_CleanupAndRepairInference)
1970 {
1971  BOOST_CHECK_EQUAL(CGb_qual::CleanupAndRepairInference("similar to sequence : UniProtKB : P39748"), "similar to sequence:UniProtKB:P39748");
1972  BOOST_CHECK_EQUAL(CGb_qual::CleanupAndRepairInference("similar to RNA sequence, mRNA: INSDC:AY262280.1"), "similar to RNA sequence, mRNA:INSDC:AY262280.1");
1973  BOOST_CHECK_EQUAL(CGb_qual::CleanupAndRepairInference("similar to AA: UniProtKB : P39748"), "similar to AA sequence:UniProtKB:P39748");
1974  BOOST_CHECK_EQUAL(CGb_qual::CleanupAndRepairInference("similar to AA sequence: UniProtKB : P39748"), "similar to AA sequence:UniProtKB:P39748");
1975 }
1976 
1977 
1978 BOOST_AUTO_TEST_CASE(Test_SQD_4173)
1979 {
1980  BOOST_CHECK_EQUAL(CBioSource::ShouldIgnoreConflict("lat-lon", "12.12345 N 23.123456 W", "12.12 N 23.12 W"), false);
1981 }
1982 
1983 
1985 {
1986  string voucher_type;
1987  bool is_miscapitalized;
1988  string correct_cap;
1989  bool needs_country;
1990  bool erroneous_country;
1991  string inst_code = "ARBH";
1992  BOOST_CHECK_EQUAL(COrgMod::IsInstitutionCodeValid(inst_code, voucher_type, is_miscapitalized, correct_cap, needs_country, erroneous_country), true);
1993  BOOST_CHECK_EQUAL(voucher_type, "s");
1994  BOOST_CHECK_EQUAL(is_miscapitalized, false);
1995  BOOST_CHECK_EQUAL(correct_cap, "ARBH");
1996  BOOST_CHECK_EQUAL(needs_country, false);
1997  BOOST_CHECK_EQUAL(erroneous_country, false);
1998 
1999  inst_code = "NMNH";
2000  BOOST_CHECK_EQUAL(COrgMod::IsInstitutionCodeValid(inst_code, voucher_type, is_miscapitalized, correct_cap, needs_country, erroneous_country), true);
2001  BOOST_CHECK_EQUAL(voucher_type, "sb");
2002  BOOST_CHECK_EQUAL(is_miscapitalized, false);
2003  BOOST_CHECK_EQUAL(correct_cap, "NMNH");
2004  BOOST_CHECK_EQUAL(needs_country, false);
2005  BOOST_CHECK_EQUAL(erroneous_country, false);
2006 
2007  inst_code = "ZMM";
2008  BOOST_CHECK_EQUAL(COrgMod::IsInstitutionCodeValid(inst_code, voucher_type, is_miscapitalized, correct_cap, needs_country, erroneous_country), true);
2009  BOOST_CHECK_EQUAL(voucher_type, "s");
2010  BOOST_CHECK_EQUAL(is_miscapitalized, false);
2011  BOOST_CHECK_EQUAL(correct_cap, "ZMM");
2012  BOOST_CHECK_EQUAL(needs_country, false);
2013  BOOST_CHECK_EQUAL(erroneous_country, false);
2014 
2015  inst_code = "ZMUM";
2016  BOOST_CHECK_EQUAL(COrgMod::IsInstitutionCodeValid(inst_code, voucher_type, is_miscapitalized, correct_cap, needs_country, erroneous_country), true);
2017  BOOST_CHECK_EQUAL(voucher_type, "s");
2018  BOOST_CHECK_EQUAL(is_miscapitalized, false);
2019  BOOST_CHECK_EQUAL(correct_cap, "ZMUM");
2020  BOOST_CHECK_EQUAL(needs_country, false);
2021  BOOST_CHECK_EQUAL(erroneous_country, false);
2022 }
2023 
2024 
2026 {
2027  BOOST_CHECK_EQUAL(CSubSource::FixDevStageCapitalization("FOO"), "FOO");
2028  BOOST_CHECK_EQUAL(CSubSource::FixDevStageCapitalization("LARVA"), "larva");
2029 
2030  BOOST_CHECK_EQUAL(CSubSource::FixCellTypeCapitalization("FOO"), "FOO");
2031  BOOST_CHECK_EQUAL(CSubSource::FixCellTypeCapitalization("Lymphocyte"), "lymphocyte");
2032 
2033  BOOST_CHECK_EQUAL(CSubSource::FixTissueTypeCapitalization("CLINICAL"), "clinical");
2034 
2035  BOOST_CHECK_EQUAL(CSubSource::FixIsolationSourceCapitalization("Bovine (feces)"), "bovine feces");
2036  BOOST_CHECK_EQUAL(CSubSource::FixIsolationSourceCapitalization("BLOOD"), "blood");
2037 
2038  BOOST_CHECK_EQUAL(CSubSource::FixIsolationSourceCapitalization("Leaf"), "leaf");
2039  BOOST_CHECK_EQUAL(CSubSource::FixIsolationSourceCapitalization("Roots"), "roots");
2040 
2041 }
2042 
2043 
2044 BOOST_AUTO_TEST_CASE(Test_IsLegalClass)
2045 {
2046  BOOST_CHECK_EQUAL(CRNA_gen::IsLegalClass("lncRNA"), true);
2047  BOOST_CHECK_EQUAL(CRNA_gen::IsLegalClass("babble"), false);
2048  BOOST_CHECK_EQUAL(CRNA_gen::GetncRNAClassList().size(), 24);
2049 }
2050 
2051 
2052 BOOST_AUTO_TEST_CASE(Test_LegalMobileElement)
2053 {
2054  BOOST_CHECK_EQUAL(CGb_qual::IsLegalMobileElementValue("foo"), false);
2055  BOOST_CHECK_EQUAL(CGb_qual::IsLegalMobileElementValue("integron"), true);
2056 
2057  string val = "p-element";
2058  BOOST_CHECK_EQUAL(CGb_qual::FixMobileElementValue(val), true);
2059  BOOST_CHECK_EQUAL(val, "P-element");
2060 }
2061 
2062 
2063 BOOST_AUTO_TEST_CASE(Test_FixImportKey)
2064 {
2065  string val = "Exon";
2066  BOOST_CHECK_EQUAL(CSeqFeatData::FixImportKey(val), true);
2067  BOOST_CHECK_EQUAL(val, "exon");
2068  BOOST_CHECK_EQUAL(CSeqFeatData::FixImportKey(val), false);
2069 }
2070 
2071 
2072 BOOST_AUTO_TEST_CASE(Test_IsTypeMaterialValid)
2073 {
2074  BOOST_CHECK_EQUAL(COrgMod::IsValidTypeMaterial("holotype X"), true);
2075  BOOST_CHECK_EQUAL(COrgMod::IsINSDCValidTypeMaterial("holotype X"), true);
2076  BOOST_CHECK_EQUAL(COrgMod::IsValidTypeMaterial("culture from epitype Y"), true);
2077  BOOST_CHECK_EQUAL(COrgMod::IsINSDCValidTypeMaterial("culture from epitype Y"), true);
2078  BOOST_CHECK_EQUAL(COrgMod::IsValidTypeMaterial("ex-syntype Z"), true);
2079  BOOST_CHECK_EQUAL(COrgMod::IsINSDCValidTypeMaterial("ex-syntype Z"), true);
2080 
2081 
2082 }
2083 
2084 
2086 {
2087  int hour, min, sec;
2088  // succeed
2089  BOOST_CHECK_EQUAL(CSubSource::IsISOFormatTime("11:13:00Z", hour, min, sec), true);
2090  BOOST_CHECK_EQUAL(hour, 11);
2091  BOOST_CHECK_EQUAL(min, 13);
2092  BOOST_CHECK_EQUAL(sec, 0);
2093  // fail because no time zone specified
2094  BOOST_CHECK_EQUAL(CSubSource::IsISOFormatTime("11:13:00", hour, min, sec), false);
2095  // succeed because time zone not required
2096  BOOST_CHECK_EQUAL(CSubSource::IsISOFormatTime("11:13:00", hour, min, sec, false), true);
2097  BOOST_CHECK_EQUAL(hour, 11);
2098  BOOST_CHECK_EQUAL(min, 13);
2099  BOOST_CHECK_EQUAL(sec, 0);
2100 
2101  BOOST_CHECK_EQUAL(CSubSource::FixDateFormat("2012-10-26T11:13:00"), "2012-10-26");
2102 }
2103 
2104 
2105 BOOST_AUTO_TEST_CASE(Test_RefGeneTracking)
2106 {
2107  CRef<CUser_object> user(new CUser_object());
2109  BOOST_CHECK_EQUAL(user->GetType().GetStr(), "RefGeneTracking");
2110  BOOST_CHECK_EQUAL(user->GetObjectType(), CUser_object::eObjectType_RefGeneTracking);
2111  BOOST_CHECK_EQUAL(user->IsRefGeneTracking(), true);
2112 
2114  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingStatus(), false);
2116  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingStatus(), true);
2118  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "Status");
2119  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "PIPELINE");
2122  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "Status");
2123  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "INFERRED");
2124  BOOST_CHECK_EQUAL(user->GetData().size(), 1);
2125 
2126  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingGenomicSource(), false);
2127  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), kEmptyStr);
2128  user->SetRefGeneTrackingGenomicSource("XXX");
2129  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingGenomicSource(), true);
2130  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), "XXX");
2131  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "GenomicSource");
2132  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "XXX");
2134  user->SetRefGeneTrackingGenomicSource("XXX2");
2135  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), "XXX2");
2136  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "GenomicSource");
2137  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "XXX2");
2139  BOOST_CHECK_EQUAL(user->GetData().size(), 2);
2140 
2141  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingCollaborator(), false);
2142  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), kEmptyStr);
2143  user->SetRefGeneTrackingCollaborator("YYY");
2144  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingCollaborator(), true);
2145  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), "YYY");
2146  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "Collaborator");
2147  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "YYY");
2148  user->SetRefGeneTrackingCollaborator("YYY2");
2149  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), "YYY2");
2150  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "Collaborator");
2151  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "YYY2");
2153  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), "XXX2");
2154  BOOST_CHECK_EQUAL(user->GetData().size(), 3);
2155 
2156  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingCollaboratorURL(), false);
2157  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaboratorURL(), kEmptyStr);
2158  user->SetRefGeneTrackingCollaboratorURL("ZZZ");
2159  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingCollaboratorURL(), true);
2160  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaboratorURL(), "ZZZ");
2161  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "CollaboratorURL");
2162  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetStr(), "ZZZ");
2164  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), "XXX2");
2165  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), "YYY2");
2166  BOOST_CHECK_EQUAL(user->GetData().size(), 4);
2167 
2168  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenerated(), false);
2169  user->SetRefGeneTrackingGenerated(true);
2170  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenerated(), true);
2171  BOOST_CHECK_EQUAL(user->GetData().back()->GetLabel().GetStr(), "Generated");
2172  BOOST_CHECK_EQUAL(user->GetData().back()->GetData().GetBool(), true);
2173 
2175  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), "XXX2");
2176  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), "YYY2");
2177  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaboratorURL(), "ZZZ");
2178  BOOST_CHECK_EQUAL(user->GetData().size(), 5);
2179 
2180  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingIdenticalTo(), false);
2183  user->SetRefGeneTrackingIdenticalTo(*ident);
2184  BOOST_CHECK_EQUAL(user->IsSetRefGeneTrackingIdenticalTo(), true);
2186  BOOST_CHECK_EQUAL(r_ident->GetAccession(), "AY12345");
2187  BOOST_CHECK_EQUAL(user->GetData().size(), 6);
2188 
2189  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingAssembly().size(), 0);
2190  vector<CConstRef<CUser_object::CRefGeneTrackingAccession> > assembly;
2193  ("XXX", GI_CONST(123), 0, 100, "comment1", "name1")));
2196  ("YYY", GI_CONST(124), 10, 1100, "comment2", "name2")));
2197  user->SetRefGeneTrackingAssembly(assembly);
2198  BOOST_CHECK_EQUAL(user->GetData().size(), 7);
2199 
2201  BOOST_CHECK_EQUAL(r_assembly.size(), 2);
2202  BOOST_CHECK_EQUAL(r_assembly.front()->GetAccession(), "XXX");
2203  BOOST_CHECK_EQUAL(r_assembly.front()->GetGI(), GI_CONST(123));
2204  BOOST_CHECK_EQUAL(r_assembly.front()->GetFrom(), 0);
2205  BOOST_CHECK_EQUAL(r_assembly.front()->GetTo(), 100);
2206  BOOST_CHECK_EQUAL(r_assembly.front()->GetName(), "name1");
2207  BOOST_CHECK_EQUAL(r_assembly.front()->GetComment(), "comment1");
2208  BOOST_CHECK_EQUAL(r_assembly.back()->GetAccession(), "YYY");
2209  BOOST_CHECK_EQUAL(r_assembly.back()->GetGI(), GI_CONST(124));
2210  BOOST_CHECK_EQUAL(r_assembly.back()->GetFrom(), 10);
2211  BOOST_CHECK_EQUAL(r_assembly.back()->GetTo(), 1100);
2212  BOOST_CHECK_EQUAL(r_assembly.back()->GetName(), "name2");
2213  BOOST_CHECK_EQUAL(r_assembly.back()->GetComment(), "comment2");
2214 
2216  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingAssembly().size(), 0);
2217  BOOST_CHECK_EQUAL(user->GetData().size(), 6);
2220  BOOST_CHECK_EQUAL(user->GetData().size(), 5);
2222  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaboratorURL(), kEmptyStr);
2223  BOOST_CHECK_EQUAL(user->GetData().size(), 4);
2225  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingCollaborator(), kEmptyStr);
2226  BOOST_CHECK_EQUAL(user->GetData().size(), 3);
2228  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenerated(), false);
2229  BOOST_CHECK_EQUAL(user->GetData().size(), 2);
2231  BOOST_CHECK_EQUAL(user->GetRefGeneTrackingGenomicSource(), kEmptyStr);
2232  BOOST_CHECK_EQUAL(user->GetData().size(), 1);
2235  BOOST_CHECK_EQUAL(user->GetData().size(), 0);
2236 
2237  BOOST_CHECK_EQUAL(user->GetObjectType(), CUser_object::eObjectType_RefGeneTracking);
2238 }
2239 
2240 
2241 BOOST_AUTO_TEST_CASE(Test_IsValidEcNumberFormat)
2242 {
2243  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.1.2.4"), true);
2244  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.1.2.-"), true);
2245  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.1.2.n"), true);
2246  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("11.22.33.44"), true);
2247  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("11.22.n33.44"), false);
2248  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.2.3.10"), true);
2249  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1"), false);
2250  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.2"), false);
2251  BOOST_CHECK_EQUAL(CProt_ref::IsValidECNumberFormat("1.2.3"), false);
2252 
2253 }
2254 
2255 
2256 BOOST_AUTO_TEST_CASE(Test_IsValidLocalID)
2257 {
2258  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID(""), false);
2259  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY"), false);
2260  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX"), true);
2261  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc1"), true);
2262  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc 1"), false);
2263  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc>1"), false);
2264  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc[1"), false);
2265  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc]1"), false);
2266  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc|1"), false);
2267  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc=1"), true);
2268  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc\"1"), false);
2269  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc$1"), true);
2270  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc@1"), true);
2271  BOOST_CHECK_EQUAL(CSeq_id::IsValidLocalID("nuc{1"), true);
2272 }
2273 
2274 
2275 BOOST_AUTO_TEST_CASE(Test_Unverified)
2276 {
2277  CRef<CUser_object> obj(new CUser_object());
2278  BOOST_CHECK_EQUAL(obj->IsUnverified(), false);
2279  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2280  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2281  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2282  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2283 
2285  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2286  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2287  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2288  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2289  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2290 
2291  obj->AddUnverifiedContaminant();
2292  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2293  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), true);
2294  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2295  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2296  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2297 
2298  obj->AddUnverifiedFeature();
2299  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2300  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), true);
2301  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), true);
2302  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2303  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2304 
2306  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2307  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), true);
2308  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), true);
2309  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), true);
2310  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2311 
2312  obj->AddUnverifiedOrganism();
2313  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2314  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), true);
2315  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), true);
2316  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), true);
2317  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), true);
2318 
2320  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2321  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2322  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), true);
2323  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), true);
2324  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), true);
2325 
2326  obj->RemoveUnverifiedFeature();
2327  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2328  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2329  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2330  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), true);
2331  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), true);
2332 
2334  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2335  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2336  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2337  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2338  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), true);
2339 
2340  obj->RemoveUnverifiedOrganism();
2341  BOOST_CHECK_EQUAL(obj->IsUnverified(), true);
2342  BOOST_CHECK_EQUAL(obj->IsUnverifiedContaminant(), false);
2343  BOOST_CHECK_EQUAL(obj->IsUnverifiedFeature(), false);
2344  BOOST_CHECK_EQUAL(obj->IsUnverifiedMisassembled(), false);
2345  BOOST_CHECK_EQUAL(obj->IsUnverifiedOrganism(), false);
2346 
2347 }
2348 
2349 
2350 BOOST_AUTO_TEST_CASE(Test_LegalQualsAny)
2351 {
2352  const size_t numExpectedQuals = 138;
2353  size_t count = 0;
2355  BOOST_CHECK_EQUAL(all_quals.size(), numExpectedQuals);
2356  for (auto b : all_quals)
2357  ++count;
2358  BOOST_CHECK_EQUAL(count, numExpectedQuals);
2359 
2361  BOOST_CHECK_EQUAL(empty_quals.size(), 0);
2362  count = 0;
2363  for (auto b : empty_quals)
2364  ++count;
2365  BOOST_CHECK_EQUAL(count, 0);
2366 
2368 
2369  for (auto rec: mandatory)
2370  {
2371  std::cout << rec << std::endl;
2372  }
2373 }
2374 
2375 BOOST_AUTO_TEST_CASE(Test_GetQualifierTypeAndCheckCase)
2376 {
2377  auto test1 = CSeqFeatData::GetQualifierTypeAndValue("host");
2378  BOOST_CHECK(test1.first == CSeqFeatData::eQual_host);
2379  BOOST_CHECK_EQUAL(test1.second, "host");
2381  BOOST_CHECK(test2.first == CSeqFeatData::eQual_host);
2382  BOOST_CHECK_EQUAL(test2.second, "host");
2383  auto test3 = CSeqFeatData::GetQualifierTypeAndValue("specific_host");
2384  BOOST_CHECK(test3.first == CSeqFeatData::eQual_host);
2385  BOOST_CHECK_EQUAL(test3.second, "specific_host");
2386  auto test4 = CSeqFeatData::GetQualifierTypeAndValue("Specific_host");
2387  BOOST_CHECK(test4.first == CSeqFeatData::eQual_host);
2388  BOOST_CHECK_EQUAL(test4.second, "specific_host");
2389 
2391  BOOST_CHECK_EQUAL(test5, "host");
2392 }
2393 BOOST_AUTO_TEST_CASE(Test_x_ExhonerateQualifier)
2394 {
2396  size_t orig_size = orig.size();
2397  BOOST_CHECK(orig_size == 2);
2398  std::vector<CSeqFeatData::EQualifier> mandatory = orig;
2400  bool res = false;
2401  ERASE_ITERATE(std::vector<CSeqFeatData::EQualifier>, it, mandatory) {
2402  if (*it == not_mandatory) {
2403  res = true;
2404  VECTOR_ERASE(it, mandatory);
2405  }
2406  }
2407 
2408  BOOST_CHECK(mandatory.size() == 1);
2409 
2410  auto mandatory_copy = orig;
2411  bool res2 = mandatory_copy.reset(not_mandatory);
2412  BOOST_CHECK(res == res2);
2413  BOOST_CHECK(mandatory_copy.size() == 1);
2414 
2415  bool res3 = mandatory_copy.set(not_mandatory);
2416  BOOST_CHECK(res != res3);
2417  BOOST_CHECK(mandatory_copy.size() == 2);
2418 
2419 }
2420 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static int lookup(const char *name, const struct lookup_int *table)
Definition: attributes.c:50
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
bool SameCitation(const CAuth_list &other) const
Definition: Auth_list.cpp:264
CAuthor –.
Definition: Author.hpp:59
bool FixEnvironmentalSample()
Definition: BioSource.cpp:1681
string GetRepliconName(void) const
Definition: BioSource.cpp:421
static bool ShouldIgnoreConflict(const string &label, string src_val, string sample_val, bool is_local_copy=false)
Definition: BioSource.cpp:1033
static bool AllowSexQualifier(const string &lineage)
Definition: BioSource.cpp:1845
void RemoveCultureNotes(bool is_species_level=true)
Definition: BioSource.cpp:1428
string GetBioprojectLocation(void) const
Definition: BioSource.cpp:522
bool FixSexMatingTypeInconsistencies()
Definition: BioSource.cpp:1910
bool RemoveNullTerms()
Definition: BioSource.cpp:1772
CRef< CBioSource > MakeCommon(const CBioSource &other) const
Definition: BioSource.cpp:2022
static bool AllowMatingTypeQualifier(const string &lineage)
Definition: BioSource.cpp:1878
bool FixGenomeForQualifiers()
Definition: BioSource.cpp:1974
string GetBioprojectType(void) const
Definition: BioSource.cpp:482
bool RemoveUnexpectedViralQualifiers()
Definition: BioSource.cpp:1949
CConstRef –.
Definition: ncbiobj.hpp:1266
static string CountryFixupItem(const string &input, bool capitalize_after_colon)
Definition: SubSource.cpp:4765
Definition: Date.hpp:53
static bool IsLegalMobileElementValue(const string &val)
Definition: Gb_qual.cpp:454
static bool IsIllegalQualName(const string &val)
Definition: Gb_qual.cpp:508
static bool FixRecombinationClassValue(string &val)
Definition: Gb_qual.cpp:345
static string CleanupAndRepairInference(const string &orig_inference)
Definition: Gb_qual.cpp:735
static bool FixMobileElementValue(string &val)
Definition: Gb_qual.cpp:469
static const TLegalRecombinationClassSet & GetSetOfLegalRecombinationClassValues(void)
Definition: Gb_qual.cpp:329
CImprint –.
Definition: Imprint.hpp:66
@OrgMod.hpp User-defined methods of the data storage class.
Definition: OrgMod.hpp:54
static string FixCapitalization(TSubtype subtype, const string &value)
Definition: OrgMod.cpp:1012
static bool IsINSDCValidTypeMaterial(const string &type_material)
Definition: OrgMod.cpp:1214
static bool IsInstitutionCodeValid(const string &inst_coll, string &voucher_type, bool &is_miscapitalized, string &correct_cap, bool &needs_country, bool &erroneous_country)
Definition: OrgMod.cpp:356
static bool IsDiscouraged(const TSubtype stype, bool indexer=false)
Definition: OrgMod.cpp:159
static string FixHost(const string &value)
Definition: OrgMod.cpp:999
bool RemoveAbbreviation()
Definition: OrgMod.cpp:1095
static bool IsValidTypeMaterial(const string &type_material)
Definition: OrgMod.cpp:1192
static string FixHostCapitalization(const string &value)
Definition: OrgMod.cpp:956
static string FixStrain(const string &strain)
Definition: OrgMod.cpp:799
CRef< COrgName > MakeCommon(const COrgName &other) const
Definition: OrgName.cpp:323
TTaxId GetTaxId() const
Definition: Org_ref.cpp:72
static CConstRef< COrg_ref > TableLookup(const string &taxname)
Definition: Org_ref.cpp:448
TTaxId SetTaxId(TTaxId tax_id)
Definition: Org_ref.cpp:93
CRef< COrg_ref > MakeCommon(const COrg_ref &other) const
Definition: Org_ref.cpp:280
static bool IsECNumberSplit(const string &old_ecno)
Definition: Prot_ref.cpp:226
static bool IsValidECNumberFormat(const string &ecno)
Verify correct form of EC number.
Definition: Prot_ref.cpp:257
bool SameCitation(const CPub_equiv &other) const
Definition: Pub_equiv.cpp:127
Definition: Pub.hpp:56
bool SameCitation(const CPub &other) const
Definition: Pub.cpp:733
static vector< string > GetncRNAClassList()
Definition: RNA_gen.cpp:86
bool IsLegalClass() const
Definition: RNA_gen.cpp:119
@RNA_ref.hpp User-defined methods of the data storage class.
Definition: RNA_ref.hpp:54
CRef –.
Definition: ncbiobj.hpp:618
static const string & GetRegulatoryClass(ESubtype subtype)
bool IsLegalQualifier(EQualifier qual) const
Test wheather a certain qualifier is legal for the feature.
static bool IsDiscouragedQual(EQualifier qual)
static EFeatureLocationAllowed AllowedFeatureLocation(ESubtype subtype)
EQualifier
List of available qualifiers for feature keys.
@ eQual_recombination_class
@ eFeatureLocationAllowed_NucOnly
@ eFeatureLocationAllowed_Error
@ eFeatureLocationAllowed_ProtOnly
@ eFeatureLocationAllowed_Any
static bool ProhibitXref(CSeqFeatData::ESubtype subtype1, CSeqFeatData::ESubtype subtype2)
const TLegalQualifiers & GetLegalQualifiers(void) const
Get a list of all the legal qualifiers for the feature.
const TQualifiers & GetMandatoryQualifiers(void) const
Get the list of all mandatory qualifiers for the feature.
static bool IsDiscouragedSubtype(ESubtype subtype)
static std::pair< EQualifier, CTempString > GetQualifierTypeAndValue(CTempString qual)
static bool FixImportKey(string &key)
@ eSubtype_bad
These no longer need to match the FEATDEF values in the C toolkit's objfdef.h.
static CTempString GetQualifierAsString(EQualifier qual)
Convert a qualifier from an enumerated value to a string representation or empty if not found.
static ESubtype SubtypeNameToValue(CTempString sName)
Turn a string into its ESubtype which is NOT necessarily related to the identifier of the enum.
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
static bool IsRegulatory(ESubtype subtype)
static bool AllowXref(CSeqFeatData::ESubtype subtype1, CSeqFeatData::ESubtype subtype2)
const_iterator find(const key_type &key) const
Return a const_iterator pointing to the specified element, or to the end if the element is not found.
Definition: static_set.hpp:680
const_iterator end() const
Return the end of the controlled sequence.
Definition: static_set.hpp:647
static string FixCapitalization(TSubtype subtype, const string &value)
Definition: SubSource.cpp:4969
static string GetCollectionDateProblem(const string &date_string)
static string FixTissueTypeCapitalization(const string &value)
Definition: SubSource.cpp:4936
static bool IsISOFormatTime(const string &orig_time, int &hour, int &min, int &sec, bool require_time_zone=true)
Definition: SubSource.cpp:610
static string FixLatLonFormat(string orig_lat_lon, bool guess=false)
Definition: SubSource.cpp:1828
static string FixIsolationSourceCapitalization(const string &value)
Definition: SubSource.cpp:4909
static string FixCellTypeCapitalization(const string &value)
Definition: SubSource.cpp:4829
static string FixDateFormat(const string &orig_date)
Attempt to fix the format of the date Returns a blank if the format of the date cannot be determined.
Definition: SubSource.cpp:586
static string CheckCellLine(const string &cell_line, const string &organism)
Definition: SubSource.cpp:2921
static CRef< CDate > DateFromCollectionDate(const string &str) THROWS((CException))
Definition: SubSource.cpp:253
static string FixDevStageCapitalization(const string &value)
Definition: SubSource.cpp:4808
static string FixAltitude(const string &value)
Definition: SubSource.cpp:2656
static void RemoveCultureNotes(string &value, bool is_species_level=true)
Definition: SubSource.cpp:5145
static void IsCorrectDateFormat(const string &date_string, bool &bad_format, bool &in_future)
Definition: SubSource.cpp:420
C_E –.
Definition: Title_.hpp:96
Definition: Title.hpp:51
const string & GetRefGeneTrackingCollaborator() const
void SetObjectType(EObjectType obj_type)
void ResetRefGeneTrackingAssembly()
void ResetRefGeneTrackingStatus()
void RemoveUnverifiedFeature()
void AddUnverifiedOrganism()
void SetRefGeneTrackingCollaboratorURL(const string &collaborator_url)
const string & GetRefGeneTrackingCollaboratorURL() const
void AddUnverifiedContaminant()
@ eRefGeneTrackingStatus_INFERRED
@ eRefGeneTrackingStatus_NotSet
@ eRefGeneTrackingStatus_PIPELINE
void ResetRefGeneTrackingCollaboratorURL()
bool IsRefGeneTracking() const
void SetRefGeneTrackingAssembly(const TRefGeneTrackingAccessions &acc_list)
void ResetRefGeneTrackingGenerated()
void RemoveUnverifiedMisassembled()
void ResetRefGeneTrackingGenomicSource()
bool IsSetRefGeneTrackingIdenticalTo() const
bool IsSetRefGeneTrackingGenomicSource() const
void SetRefGeneTrackingStatus(ERefGeneTrackingStatus status)
void RemoveUnverifiedContaminant()
void SetRefGeneTrackingCollaborator(const string &collaborator)
void SetRefGeneTrackingIdenticalTo(const CRefGeneTrackingAccession &accession)
void SetRefGeneTrackingGenomicSource(const string &genomic_source)
@ eObjectType_RefGeneTracking
bool IsUnverifiedMisassembled() const
bool IsSetRefGeneTrackingCollaboratorURL() const
void SetRefGeneTrackingGenerated(bool val=true)
void SetFileTrackUploadId(const string &upload_id)
vector< CConstRef< CRefGeneTrackingAccession > > TRefGeneTrackingAccessions
const string & GetRefGeneTrackingGenomicSource() const
bool IsSetRefGeneTrackingStatus() const
bool IsUnverifiedOrganism() const
bool GetRefGeneTrackingGenerated() const
void ResetRefGeneTrackingCollaborator()
ERefGeneTrackingStatus GetRefGeneTrackingStatus() const
bool IsUnverifiedContaminant() const
TRefGeneTrackingAccessions GetRefGeneTrackingAssembly() const
bool IsUnverifiedFeature() const
bool IsUnverified() const
void RemoveUnverifiedOrganism()
void AddUnverifiedMisassembled()
CConstRef< CRefGeneTrackingAccession > GetRefGeneTrackingIdenticalTo() const
bool IsSetRefGeneTrackingCollaborator() const
void ResetRefGeneTrackingIdenticalTo()
EObjectType GetObjectType() const
void AddUnverifiedFeature()
Definition: set.hpp:45
#define ITERATE_0_IDX(idx, up_to)
idx loops from 0 (inclusive) to up_to (exclusive)
Definition: ncbimisc.hpp:865
#define TAX_ID_CONST(id)
Definition: ncbimisc.hpp:1112
constexpr size_t ArraySize(const Element(&)[Size])
Definition: ncbimisc.hpp:1532
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
Definition: ncbimisc.hpp:843
Int8 TIntId
Definition: ncbimisc.hpp:999
#define VECTOR_ERASE(Var, Cont)
Use this macro inside body of ERASE_ITERATE cycle to erase from vector-like container.
Definition: ncbimisc.hpp:852
#define GI_CONST(gi)
Definition: ncbimisc.hpp:1087
#define ENTREZ_ID_FROM(T, value)
Definition: ncbimisc.hpp:1098
#define NULL
Definition: ncbistd.hpp:225
TPrim & Set(void)
Definition: serialbase.hpp:351
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static bool IsValidLocalID(const CTempString &s)
Perform rudimentary validation on potential local IDs, whose contents should be pure ASCII and limite...
Definition: Seq_id.cpp:2575
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define kEmptyStr
Definition: ncbistr.hpp:123
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3457
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5352
void SetBook(TBook &value)
Assign a value to Book data member.
Definition: Cit_proc_.cpp:61
void SetIssue(const TIssue &value)
Assign a value to Issue data member.
Definition: Cit_gen_.hpp:780
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_art_.cpp:210
const TFrom & GetFrom(void) const
Get the From member data.
Definition: Cit_art_.hpp:567
void SetJournal(TJournal &value)
Assign a value to Journal data member.
Definition: Cit_gen_.cpp:81
void SetImp(TImp &value)
Assign a value to Imp data member.
Definition: Cit_jour_.cpp:75
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_book_.cpp:62
void SetName(TName &value)
Assign a value to Name data member.
Definition: Author_.cpp:81
void SetFrom(TFrom &value)
Assign a value to From data member.
Definition: Cit_art_.cpp:248
void SetAffil(TAffil &value)
Assign a value to Affil data member.
Definition: Auth_list_.cpp:160
bool IsSetFrom(void) const
Check if a value has been assigned to From data member.
Definition: Cit_art_.hpp:555
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_art_.cpp:227
void SetSerial_number(TSerial_number value)
Assign a value to Serial_number data member.
Definition: Cit_gen_.hpp:902
void SetPages(const TPages &value)
Assign a value to Pages data member.
Definition: Cit_gen_.hpp:827
void SetDate(TDate &value)
Assign a value to Date data member.
Definition: Cit_gen_.cpp:116
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_sub_.cpp:74
void SetPub(TPub &value)
Assign a value to Pub data member.
Definition: Imprint_.cpp:107
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_jour_.cpp:61
void SetImp(TImp &value)
Assign a value to Imp data member.
Definition: Cit_book_.cpp:107
void SetCit(TCit &value)
Assign a value to Cit data member.
Definition: Cit_let_.cpp:70
void SetCit(const TCit &value)
Assign a value to Cit data member.
Definition: Cit_gen_.hpp:597
void SetVolume(const TVolume &value)
Assign a value to Volume data member.
Definition: Imprint_.hpp:767
void SetNames(TNames &value)
Assign a value to Names data member.
Definition: Auth_list_.cpp:149
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_book_.cpp:93
void SetDate(TDate &value)
Assign a value to Date data member.
Definition: Imprint_.cpp:73
void SetVolume(const TVolume &value)
Assign a value to Volume data member.
Definition: Cit_gen_.hpp:733
void SetTitle(const TTitle &value)
Assign a value to Title data member.
Definition: Cit_gen_.hpp:942
void SetMuid(TMuid value)
Assign a value to Muid data member.
Definition: Cit_gen_.hpp:672
bool IsBook(void) const
Check if variant Book is selected.
Definition: Cit_art_.hpp:501
bool IsJournal(void) const
Check if variant Journal is selected.
Definition: Cit_art_.hpp:495
void SetPrepub(TPrepub value)
Assign a value to Prepub data member.
Definition: Imprint_.hpp:1108
void SetImp(TImp &value)
Assign a value to Imp data member.
Definition: Cit_sub_.cpp:84
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_gen_.cpp:64
Tdata & Set(void)
Assign a value to data member.
Definition: Title_.hpp:787
@ ePrepub_in_press
accepted, not published
Definition: Imprint_.hpp:96
@ ePrepub_submitted
submitted, not accepted
Definition: Imprint_.hpp:95
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
Definition: BioSource_.hpp:539
TGenome GetGenome(void) const
Get the Genome member data.
Definition: BioSource_.hpp:422
void ResetGenome(void)
Reset Genome data member.
Definition: BioSource_.hpp:409
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
Definition: SubSource_.hpp:319
bool IsSetSubtype(void) const
Check if a value has been assigned to Subtype data member.
Definition: BioSource_.hpp:527
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:509
void SetGenome(TGenome value)
Assign a value to Genome data member.
Definition: BioSource_.hpp:428
void SetOrg(TOrg &value)
Assign a value to Org data member.
Definition: BioSource_.cpp:108
void SetName(const TName &value)
Assign a value to Name data member.
Definition: SubSource_.hpp:359
const TName & GetName(void) const
Get the Name member data.
Definition: SubSource_.hpp:350
EGenome
biological context
Definition: BioSource_.hpp:97
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
Definition: SubSource_.hpp:338
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
Definition: BioSource_.hpp:545
void ResetSubtype(void)
Reset Subtype data member.
Definition: BioSource_.cpp:113
@ eSubtype_environmental_sample
Definition: SubSource_.hpp:111
@ eSubtype_endogenous_virus_name
Definition: SubSource_.hpp:109
@ eOrigin_mut
artificially mutagenized
Definition: BioSource_.hpp:132
@ eOrigin_artificial
artificially engineered
Definition: BioSource_.hpp:133
@ eGenome_plasmid_in_mitochondrion
Definition: BioSource_.hpp:121
void SetYear(TYear value)
Assign a value to Year data member.
Definition: Date_std_.hpp:435
TStd & SetStd(void)
Select the variant.
Definition: Date_.cpp:115
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
const TData & GetData(void) const
Get the Data member data.
const TType & GetType(void) const
Get the Type member data.
const TMod & GetMod(void) const
Get the Mod member data.
Definition: OrgName_.hpp:839
const TDiv & GetDiv(void) const
Get the Div member data.
Definition: OrgName_.hpp:1005
const TSubname & GetSubname(void) const
Get the Subname member data.
Definition: OrgMod_.hpp:347
void SetDiv(const TDiv &value)
Assign a value to Div data member.
Definition: OrgName_.hpp:1014
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
Definition: OrgMod_.hpp:316
bool IsSetMod(void) const
Check if a value has been assigned to Mod data member.
Definition: OrgName_.hpp:827
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
Definition: Org_ref_.hpp:360
TMod & SetMod(void)
Assign a value to Mod data member.
Definition: OrgName_.hpp:845
void SetSubname(const TSubname &value)
Assign a value to Subname data member.
Definition: OrgMod_.hpp:356
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
Definition: Org_ref_.hpp:541
@ eSubtype_anamorph
Definition: OrgMod_.hpp:112
@ eSubtype_sub_species
Definition: OrgMod_.hpp:105
@ eSubtype_nat_host
natural host of this specimen
Definition: OrgMod_.hpp:104
@ eSubtype_cultivar
Definition: OrgMod_.hpp:93
@ eSubtype_metagenome_source
Definition: OrgMod_.hpp:120
@ eSubtype_acronym
Definition: OrgMod_.hpp:102
@ eSubtype_specimen_voucher
Definition: OrgMod_.hpp:106
@ eSubtype_serovar
Definition: OrgMod_.hpp:92
TProc & SetProc(void)
Select the variant.
Definition: Pub_.cpp:305
TPmid & SetPmid(void)
Select the variant.
Definition: Pub_.hpp:690
TBook & SetBook(void)
Select the variant.
Definition: Pub_.cpp:283
Tdata & Set(void)
Assign a value to data member.
Definition: Pub_equiv_.hpp:171
const TArticle & GetArticle(void) const
Get the variant data.
Definition: Pub_.cpp:233
E_Choice Which(void) const
Which variant is currently selected.
Definition: Pub_.hpp:555
TMan & SetMan(void)
Select the variant.
Definition: Pub_.cpp:371
TSub & SetSub(void)
Select the variant.
Definition: Pub_.cpp:195
TGen & SetGen(void)
Select the variant.
Definition: Pub_.cpp:173
TJournal & SetJournal(void)
Select the variant.
Definition: Pub_.cpp:261
TArticle & SetArticle(void)
Select the variant.
Definition: Pub_.cpp:239
bool IsGen(void) const
Check if variant Gen is selected.
Definition: Pub_.hpp:584
@ e_Article
Definition: Pub_.hpp:106
@ e_Book
Definition: Pub_.hpp:108
@ e_Gen
general or generic unparsed
Definition: Pub_.hpp:102
@ e_Journal
Definition: Pub_.hpp:107
@ e_Proc
proceedings of a meeting
Definition: Pub_.hpp:109
@ e_Man
manuscript, thesis, or letter
Definition: Pub_.hpp:112
@ e_Sub
submission
Definition: Pub_.hpp:103
@ eType_ncRNA
non-coding RNA; subsumes snRNA, scRNA, snoRNA
Definition: RNA_ref_.hpp:104
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
const struct ncbi::grid::netcache::search::fields::SIZE size
const CharType(& source)[N]
Definition: pointer.h:1149
EIPRangeType t
Definition: ncbi_localip.c:101
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Miscellaneous common-use basic types and functionality.
T max(T x_, T y_)
T min(T x_, T y_)
USING_SCOPE(objects)
void s_ChangeAuthorLastName(CAuth_list &auth_list)
void s_TestAuthorChanges(CPub &pub)
void s_ChangeNameTitle(CTitle &title)
#define ESUBTYPE_SHOULD_FAIL(name)
#define CHECK_COMMON_FIELD(o1, o2, c, Field, val1, val2)
CRef< CImprint > s_SetImprint(CPub &pub)
CRef< CPub > s_MakeJournalArticlePub()
void s_ChangeImprintNoMatch(CImprint &imp, int change_no)
CRef< CCit_book > s_MakeBook()
static void SetSubSource(objects::CBioSource &src, objects::CSubSource::TSubtype subtype, string val)
BOOST_AUTO_TEST_CASE(s_TestSubtypeMaps)
CRef< CPub > s_MakeBookChapterPub()
CRef< CAuth_list > s_SetAuthList(CPub &pub)
void s_ChangeImprintMatch(CImprint &imp, int change_no)
CRef< CCit_jour > s_MakeJournal()
void s_TestImprintChanges(CPub &pub)
void CheckBioProjectLocationVals(CBioSource::EGenome genome, const string &bioprojectlocation)
void s_ChangeJTATitle(CTitle &title)
void s_AddJTATitle(CTitle &title)
void s_AddNameTitle(CTitle &title)
CRef< CImprint > s_MakeImprint()
void s_ChangeTitle(CPub &pub)
void s_ChangeDate(CDate &date)
void CheckPlasmid(CBioSource &src)
void s_TestTitleChange(CPub &pub)
CRef< CAuth_list > s_MakeAuthList()
void CheckViruses(CBioSource &src)
void s_ChangeAuthorFirstName(CAuth_list &auth_list)
#define CHECK_COMMON_STRING_LIST(o1, o2, c, Field, val1, val2)
CRef< objects::CObjectManager > om
const char * expected_result
#define test2(s, m, d, r)
Definition: t0007.c:124
Utility stuff for more convenient using of Boost.Test library.
#define NCBITEST_CHECK(P)
Definition: test_boost.hpp:616
static bool ambig(char c)
Modified on Wed Sep 27 02:42:18 2023 by modify_doxy.py rev. 669887