vector<string> taxnames;
76taxnames.push_back(
"Banana bunchy top virus");
77taxnames.push_back(
"Escherichia coli");
78 stringorig_prot(
"Banana Bunchy Top Virus Coat Protein");
80BOOST_CHECK_EQUAL(new_prot,
"Coat Protein");
82orig_prot.assign(
"Coat protein (Banana buncHY Top virus)");
84BOOST_CHECK_EQUAL(new_prot,
"Coat protein");
86orig_prot.assign(
"Coat protein [Banana bunchy top VIRUS] gene");
88BOOST_CHECK_EQUAL(new_prot,
"Coat protein gene");
93 string text=
"Drs3 isolate and DrS3 and DRS3";
94 stringfind =
"Drs3";
95 stringreplace =
"ssss";
96 boolcase_sens =
false;
97 boolis_regex =
false;
99BOOST_CHECK_EQUAL(res,
true);
100BOOST_CHECK_EQUAL(
text,
"ssss isolate and ssss and ssss");
102 text=
"Drs3 isolate and DrS3 and Drs3";
105BOOST_CHECK_EQUAL(res,
true);
106BOOST_CHECK_EQUAL(
text,
"ssss isolate and DrS3 and ssss");
108 text=
"Putative terminase";
110replace =
"putative";
113BOOST_CHECK_EQUAL(res,
true);
114BOOST_CHECK_EQUAL(
text,
"putative terminase");
116 text=
"llumina technology";
118replace =
"Illumina";
121BOOST_CHECK_EQUAL(res,
true);
122BOOST_CHECK_EQUAL(
text,
"Illumina technology");
124 text=
"some isolate";
129BOOST_CHECK_EQUAL(res,
true);
130BOOST_CHECK_EQUAL(
text,
"some");
132 text=
"some isolate";
137BOOST_CHECK_EQUAL(res,
false);
138BOOST_CHECK_EQUAL(
text,
"some isolate");
145BOOST_CHECK_EQUAL(res,
false);
148 text=
"Bubalus bubalis";
153BOOST_CHECK_EQUAL(res,
true);
154BOOST_CHECK_EQUAL(
text,
"Butestlus butestlis");
160name.
SetLast(
"Sotomayor-Gonzalez");
164BOOST_CHECK_EQUAL(name.
GetFirst(),
"Alicia");
170BOOST_CHECK_EQUAL(name.
GetFirst(),
"Alicia");
176BOOST_CHECK_EQUAL(name.
GetFirst(),
"Alicia Carmen");
182BOOST_CHECK_EQUAL(name.
GetFirst(),
"Alicia Carmen");
188BOOST_CHECK_EQUAL(name.
GetFirst(),
"Alicia Carmen Ana");
189BOOST_CHECK_EQUAL(name.
GetInitials(),
"A.C.A.");
194BOOST_CHECK_EQUAL(name.
GetFirst(),
"Maria Elena");
197name.
SetFirst(
"Maria del Carmen");
200BOOST_CHECK_EQUAL(name.
GetFirst(),
"Maria del Carmen");
206BOOST_CHECK_EQUAL(name.
GetFirst(),
"Maria da Luz");
207BOOST_CHECK_EQUAL(name.
GetInitials(),
"M.d.L.");
209name.
SetFirst(
"Eloiza Lopes de Lira");
212BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes de Lira");
213BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.Ld.L.");
215name.
SetFirst(
"Eloiza Lopes De Lira");
218BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes De Lira");
219BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.L.D.L.");
221name.
SetFirst(
"Eloiza Lopes de Lira");
224BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes de Lira");
225BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.Ld.L.A.");
227name.
SetFirst(
"Eloiza Lopes De Lira");
230BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes De Lira");
231BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.L.D.L.A.");
233name.
SetFirst(
"Eloiza Lopes de Lira");
236BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes de Lira Ana");
237BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.Ld.L.A.");
239name.
SetFirst(
"Eloiza Lopes de Lira");
242BOOST_CHECK_EQUAL(name.
GetFirst(),
"Eloiza Lopes de Lira Ana");
243BOOST_CHECK_EQUAL(name.
GetInitials(),
"E.Ld.L.A.");
248BOOST_CHECK_EQUAL(name.
GetFirst(),
"Wei Ning");
254BOOST_CHECK_EQUAL(name.
GetFirst(),
"Wei Ning Ning");
255BOOST_CHECK_EQUAL(name.
GetInitials(),
"W.N.N.");
260BOOST_CHECK_EQUAL(name.
GetFirst(),
"J Jiage");
266BOOST_CHECK_EQUAL(name.
GetFirst(),
"Lei");
272BOOST_CHECK_EQUAL(name.
GetFirst(),
"Z");
278BOOST_CHECK_EQUAL(name.
GetFirst(),
"Z A");
284BOOST_CHECK_EQUAL(name.
GetFirst(),
"Z Ning");
303BOOST_CHECK_EQUAL(name.
GetInitials(),
"X.A.-S.");
307BOOST_CHECK_EQUAL(name.
GetInitials(),
"X.A.-S.");
311BOOST_CHECK_EQUAL(name.
GetInitials(),
"X.A.S.");
315BOOST_CHECK_EQUAL(name.
GetInitials(),
"X.A.S.");
324BOOST_CHECK_EQUAL(name.
GetInitials(),
"Wb.A.S.");
330stdname.
SetLast(
"Freitas");
342BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"T.M.");
346BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"T.M.S.");
356BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.S.");
360BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.S.");
364BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.S.");
368BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.S.");
372BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.-S.");
376BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.-S.");
380BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"R.A.S.");
382stdname.
SetFirst(
"Maria del Carmen");
385BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"Md.C.A.");
390BOOST_CHECK_EQUAL(stdname.
GetInitials(),
"Wb.");
399firstname =
"Robert";
402firstname =
"Robert Alvarez";
405firstname =
"Robert-Alvarez";
408firstname =
"Robert-alvarez";
411firstname =
"Robert alvarez";
414firstname =
"Robert Alvarez Santos";
417firstname =
"Robert Alvarez-Santos";
420firstname =
"Robert-Alvarez-Santos";
423firstname =
"Robert Alvarez-santos";
426firstname =
"Robert-alvarez santos";
429firstname =
"Maria del Carmen";
432firstname =
"Maria de los Angeles";
435firstname =
"Maria de los";
438firstname =
"Maria de La Luz";
446 stringlastname =
"Freitas";
447 stringfirstname =
"Robert";
452BOOST_CHECK_EQUAL(
MakeAsn(stdname),
454 " last \"Freitas\",\n" 455 " first \"Robert\",\n" 462BOOST_CHECK_EQUAL(
MakeAsn(stdname),
464 " last \"Freitas\",\n" 465 " first \"Robert\",\n" 466 " initials \"R.A.\"\n" 470mid_initials =
"Alvarez Santos";
472BOOST_CHECK_EQUAL(
MakeAsn(stdname),
474 " last \"Freitas\",\n" 475 " first \"Robert\",\n" 476 " initials \"R.A.S.\"\n" 480mid_initials =
"AS";
482BOOST_CHECK_EQUAL(
MakeAsn(stdname),
484 " last \"Freitas\",\n" 485 " first \"Robert\",\n" 486 " initials \"R.A.S.\"\n" 490mid_initials =
"Alvarez-Santos";
492BOOST_CHECK_EQUAL(
MakeAsn(stdname),
494 " last \"Freitas\",\n" 495 " first \"Robert\",\n" 496 " initials \"R.A.-S.\"\n" 500mid_initials =
"Alvarez-santos";
502BOOST_CHECK_EQUAL(
MakeAsn(stdname),
504 " last \"Freitas\",\n" 505 " first \"Robert\",\n" 506 " initials \"R.A.-S.\"\n" 510mid_initials.clear();
511firstname =
"Robert Alvarez Santos";
513BOOST_CHECK_EQUAL(
MakeAsn(stdname),
515 " last \"Freitas\",\n" 516 " first \"Robert Alvarez Santos\",\n" 517 " initials \"R.A.S.\"\n" 521firstname =
"Robert Alvarez-Santos";
523BOOST_CHECK_EQUAL(
MakeAsn(stdname),
525 " last \"Freitas\",\n" 526 " first \"Robert Alvarez-Santos\",\n" 527 " initials \"R.A.-S.\"\n" 531firstname =
"Robert Alvarez santos";
533BOOST_CHECK_EQUAL(
MakeAsn(stdname),
535 " last \"Freitas\",\n" 536 " first \"Robert Alvarez santos\",\n" 537 " initials \"R.As.\"\n" 541firstname =
"Robert Alvarez-santos";
543BOOST_CHECK_EQUAL(
MakeAsn(stdname),
545 " last \"Freitas\",\n" 546 " first \"Robert Alvarez-santos\",\n" 547 " initials \"R.A.-s.\"\n" 551mid_initials =
"Jose";
553BOOST_CHECK_EQUAL(
MakeAsn(stdname),
555 " last \"Freitas\",\n" 556 " first \"Robert Alvarez-santos\",\n" 557 " initials \"R.A.-s.J.\"\n" 561mid_initials =
"Jose";
562firstname =
"Robert Alvarez Santos";
564BOOST_CHECK_EQUAL(
MakeAsn(stdname),
566 " last \"Freitas\",\n" 567 " first \"Robert Alvarez Santos\",\n" 568 " initials \"R.A.S.J.\"\n" 572mid_initials.clear();
573firstname =
"Maria del Carmen";
575BOOST_CHECK_EQUAL(
MakeAsn(stdname),
577 " last \"Freitas\",\n" 578 " first \"Maria del Carmen\",\n" 579 " initials \"Md.C.\"\n" 583mid_initials =
"Anna";
585BOOST_CHECK_EQUAL(
MakeAsn(stdname),
587 " last \"Freitas\",\n" 588 " first \"Maria del Carmen\",\n" 589 " initials \"Md.C.A.\"\n" 593mid_initials.clear();
594firstname =
"Maria de los Angeles";
596BOOST_CHECK_EQUAL(
MakeAsn(stdname),
598 " last \"Freitas\",\n" 599 " first \"Maria de los Angeles\",\n" 600 " initials \"Mdl.A.\"\n" 605firstname =
"Maria de los Angeles";
607BOOST_CHECK_EQUAL(
MakeAsn(stdname),
609 " last \"Freitas\",\n" 610 " first \"Maria de los Angeles\",\n" 611 " initials \"Mdl.A.A.\"\n" 615mid_initials.clear();
616firstname =
"Maria de La Luz";
618BOOST_CHECK_EQUAL(
MakeAsn(stdname),
620 " last \"Freitas\",\n" 621 " first \"Maria de La Luz\",\n" 622 " initials \"Md.L.L.\"\n" 626firstname =
"Maria de los";
628BOOST_CHECK_EQUAL(
MakeAsn(stdname),
630 " last \"Freitas\",\n" 631 " first \"Maria de los\",\n" 632 " initials \"Mdl.\"\n" 638BOOST_CHECK_EQUAL(
MakeAsn(stdname),
640 " last \"Freitas\"\n" 649stdname.
SetLast(
"Freitas");
650BOOST_TEST_MESSAGE(
"Apply middle initial to a name with a last name:");
652BOOST_TEST_MESSAGE(
"when the first name and initials fields are not set");
659BOOST_TEST_MESSAGE(
"and a first name and the initials field is not set");
665BOOST_TEST_MESSAGE(
"and a first name and the first initial is set (replace old)");
671BOOST_TEST_MESSAGE(
"and a first name and the first initial is set (append with no delimiter)");
677BOOST_TEST_MESSAGE(
"and a first name and a middle initial");
683BOOST_TEST_MESSAGE(
"and a first name and two middle initials");
693BOOST_TEST_MESSAGE(
"with no first name and a middle initial");
699BOOST_TEST_MESSAGE(
"with no first name and a middle initial (leave old)");
705BOOST_TEST_MESSAGE(
"with no first name and a middle initial (cancel)");
714stdname.
SetLast(
"Freitas");
715BOOST_TEST_MESSAGE(
"Dot at the end of the new value will be silenced");
755stdname.
SetLast(
"Benites");
756BOOST_TEST_MESSAGE(
"Apply first name to a name with a last name:");
758BOOST_TEST_MESSAGE(
"when the first name and initials fields are not set");
760BOOST_CHECK(stdname.
GetFirst() ==
"Maria");
765BOOST_TEST_MESSAGE(
"when the first name is not set but the initials fields is set");
767BOOST_CHECK(stdname.
GetFirst() ==
"Adam");
772BOOST_TEST_MESSAGE(
"when the first name is not set but the initials fields is set");
774BOOST_CHECK(stdname.
GetFirst() ==
"Maria");
779BOOST_TEST_MESSAGE(
"when there is a first name but the initials fields is not set");
781BOOST_CHECK(stdname.
GetFirst() ==
"Maria");
788BOOST_CHECK(stdname.
GetFirst() ==
"Adam Marc");
793BOOST_TEST_MESSAGE(
"when there is a first name and no middle initial");
795BOOST_CHECK(stdname.
GetFirst() ==
"Marc");
800BOOST_TEST_MESSAGE(
"when there is a first name and there is a middle initial");
802BOOST_CHECK(stdname.
GetFirst() ==
"Marc");
807BOOST_TEST_MESSAGE(
"when there is a first name and there is a middle initial");
809BOOST_CHECK(stdname.
GetFirst() ==
"Marc");
815BOOST_CHECK(stdname.
GetFirst() ==
"Adam Marc");
822stdname.
SetLast(
"Freitas");
823BOOST_TEST_MESSAGE(
"Remove middle initial from a name with a last name:");
827BOOST_TEST_MESSAGE(
"when the first name and initials fields are not set");
832BOOST_TEST_MESSAGE(
"with no first name and a middle initial");
840BOOST_TEST_MESSAGE(
"and a first name and the initials field is not set");
846BOOST_TEST_MESSAGE(
"and a first name and the initials field is set");
852BOOST_TEST_MESSAGE(
"and a first name and a middle initial");
858BOOST_TEST_MESSAGE(
"and a first name and multiple middle initials");
868stdname.
SetLast(
"Freitas");
869BOOST_TEST_MESSAGE(
"Remove first name from a name with a last name:");
873BOOST_TEST_MESSAGE(
"Remove first name when there is a first name:");
902stdname.
SetFirst(
"Maria de La Luz");
908stdname.
SetFirst(
"Maria de La Luz");
920BOOST_TEST_MESSAGE(
"Reverse names when the first name is missing");
925BOOST_CHECK_EQUAL(
MakeAsn(name),
927 " last \"Albert\",\n" 928 " first \"Freitas\"\n" 935BOOST_CHECK_EQUAL(
MakeAsn(name),
937 " last \"Albert\",\n" 938 " first \"Freitas\",\n" 946BOOST_CHECK_EQUAL(
MakeAsn(name),
948 " last \"Albert Bela\",\n" 949 " first \"Freitas\",\n" 957BOOST_CHECK_EQUAL(
MakeAsn(name),
959 " last \"Albert Bela\",\n" 960 " first \"Freitas\",\n" 968BOOST_CHECK_EQUAL(
MakeAsn(name),
970 " last \"Albert\",\n" 971 " first \"Freitas\",\n" 972 " initials \"F.G.\"\n" 979BOOST_CHECK_EQUAL(
MakeAsn(name),
981 " last \"Albert\",\n" 982 " first \"Freitas\",\n" 983 " initials \"F.G.\"\n" 990BOOST_CHECK_EQUAL(
MakeAsn(name),
992 " last \"Albert Bela\",\n" 993 " first \"Freitas\",\n" 994 " initials \"F.G.\"\n" 1001BOOST_CHECK_EQUAL(
MakeAsn(name),
1003 " last \"Albert Bela\",\n" 1004 " first \"Freitas\",\n" 1005 " initials \"F.B.R.\"\n" 1010name.
SetFirst(
"Maria de La Luz");
1013BOOST_CHECK_EQUAL(
MakeAsn(name),
1015 " last \"Maria de La Luz\",\n" 1016 " first \"Freitas\"\n" 1020name.
SetFirst(
"Maria de La Luz");
1023BOOST_CHECK_EQUAL(
MakeAsn(name),
1025 " last \"Maria de La Luz\",\n" 1026 " first \"Freitas\",\n" 1027 " initials \"F.A.\"\n" 1032name.
SetFirst(
"Maria de La Luz");
1035BOOST_CHECK_EQUAL(
MakeAsn(name),
1037 " last \"Maria de La Luz\",\n" 1038 " first \"Freitas\",\n" 1039 " initials \"F.A.\"\n" 1043name.
SetFirst(
"Maria de La Luz");
1046BOOST_CHECK_EQUAL(
MakeAsn(name),
1048 " last \"Maria de La Luz\",\n" 1049 " first \"Freitas\",\n" 1050 " initials \"F.\"\n" 1054name.
SetFirst(
"Maria de La Luz");
1057BOOST_CHECK_EQUAL(
MakeAsn(name),
1059 " last \"Maria de La Luz\",\n" 1060 " first \"Freitas\",\n" 1061 " initials \"F.A.\"\n" 1064name.
SetLast(
"Maria de La Luz");
1068BOOST_CHECK_EQUAL(
MakeAsn(name),
1070 " last \"Freitas\",\n" 1071 " first \"Maria de La Luz\",\n" 1072 " initials \"Md.L.L.\"\n" 1075name.
SetLast(
"Maria de los");
1079BOOST_CHECK_EQUAL(
MakeAsn(name),
1081 " last \"Freitas\",\n" 1082 " first \"Maria de los\",\n" 1083 " initials \"Mdl.C.\"\n" 1094authors =
"Jeffrey M. Lorch";
1096BOOST_CHECK_EQUAL(
MakeAsn(auth_list),
1101 " last \"Lorch\",\n" 1102 " first \"Jeffrey\",\n" 1103 " initials \"J.M.\"\n" 1110authors =
"Jeffrey M. Lorch, Jonathan M. Palmer";
1112BOOST_CHECK_EQUAL(
MakeAsn(auth_list),
1117 " last \"Lorch\",\n" 1118 " first \"Jeffrey\",\n" 1119 " initials \"J.M.\"\n" 1124 " last \"Palmer\",\n" 1125 " first \"Jonathan\",\n" 1126 " initials \"J.M.\"\n" 1133authors =
"Anne Ballmann, George, Kathryn Griffin Jr., Susan Knowles Maria, ";
1135BOOST_CHECK_EQUAL(
MakeAsn(auth_list),
1140 " last \"Ballmann\",\n" 1141 " first \"Anne\",\n" 1142 " initials \"A.\"\n" 1147 " last \"George\"\n" 1153 " first \"Kathryn\",\n" 1154 " initials \"K.G.\"\n" 1159 " last \"Maria\",\n" 1160 " first \"Susan\",\n" 1161 " initials \"S.K.\"\n" 1176 str=
"apple, orange";
1179 str=
"apple \"orange\"";
1182 str=
"apple, \"pear";
1185 str=
"apple\npear";
1192BOOST_CHECK(
str.empty());
1197BOOST_CHECK(
str==
"integron");
1202BOOST_CHECK(
str==
"name");
1207BOOST_CHECK(
str==
"other:name");
1213BOOST_CHECK(
str.empty());
1216BOOST_CHECK(
str==
"apple");
1223macro::CMacroRep* macro_rep = engine.
Parse(macro);
1224BOOST_CHECK(macro_rep);
1226cout <<
"Parsing failed for macro:\n"<< macro << endl;
1230vector<CRef<CMacroRep>> macros;
1231macros.push_back(
Ref(macro_rep));
1233BOOST_REQUIRE(syn_files.size() == 1);
1234BOOST_CHECK(syn_files[0] == syn_file);
1246 "MACRO Macro_name \"Description\"\n" 1248 "new_value = \"walnut\"\n" 1249 "existing_text = \"eReplace\"\n" 1250 "contains1 = \"walnut\"\n" 1252 "FOR EACH BioSource\n" 1253 "WHERE CONTAINS(\"org.taxname\", contains1, true, false, false, false, false, \"local_synfile.txt\", match1, true, false, contains1, false, true)\n" 1255 "obj = Resolve(\"org.orgname.mod\") WHERE obj.subtype = \"acronym\"; \n" 1256 "SetModifier(obj, \"org.orgname.mod\", \"acronym\", new_value, existing_text);\n" 1264 "MACRO Macro_name \"Description\"\n" 1266 "match = \"taxon\"\n" 1267 "case_sensitive = false\n" 1268 "ignore_space = true\n" 1269 "ignore_punctuation = true\n" 1270 "FOR EACH Cdregion\n" 1272 "obj = Resolve(\"dbxref\") WHERE STARTS(\"obj.db\", match, case_sensitive, ignore_space, ignore_punctuation, \"synonyms.txt\", match);\n" 1273 "RemoveQual(obj);\n" 1281 "MACRO Macro_name \"Description\"\n" 1283 "match = \"taxon\"\n" 1284 "case_sensitive = false\n" 1285 "ignore_space = true\n" 1286 "ignore_punctuation = true\n" 1287 "FOR EACH Cdregion\n" 1289 "obj = Resolve(\"dbxref\") WHERE STARTS(\"obj.db\", match, \"synonyms.txt\", match, \"apple\");\n" 1290 "RemoveQual(obj);\n" 1298 "MACRO Macro_name \"Description\"\n" 1300 "match = \"taxon\"\n" 1301 "case_sensitive = false\n" 1302 "ignore_space = true\n" 1303 "ignore_punctuation = true\n" 1304 "FOR EACH Cdregion\n" 1306 "obj = Resolve(\"dbxref\") WHERE STARTS(\"obj.db\", match, \"local_synfile.txt\", match, \"apple\");\n" 1307 "RemoveQual(obj);\n" 1315 "MACRO Macro_name \"Description\"\n" 1317 "new_value = \"Homo sapiens\"\n" 1318 "match = \"taxon\"\n" 1319 "case_sensitive = false\n" 1320 "ignore_space = true\n" 1321 "ignore_punctuation = true\n" 1322 "FOR EACH BioSource\n" 1323 "WHERE EQUALS(\"subtype\", \"isolation-source\", new_value, true, \"synonyms.txt\", new_value)\n" 1325 "RemoveQual(\"org.common\");\n" 1333 "MACRO Macro_name \"Description\"\n" 1335 "new_value = \"Homo sapiens\"\n" 1336 "match = \"taxon\"\n" 1337 "case_sensitive = false\n" 1338 "ignore_space = true\n" 1339 "ignore_punctuation = true\n" 1340 "FOR EACH BioSource\n" 1341 "WHERE EQUALS(\"subtype\", \"isolation-source\", new_value, true, \"local_synfile.txt\", new_value)\n" 1343 "RemoveQual(\"org.common\");\n" 1351 "MACRO Macro_name \"Description\"\n" 1354 "FOR EACH Pubdesc\n" 1356 "obj = PUB_AFFIL(\"affil\") WHERE EQUALS(obj, match, \"synonyms.txt\", match);\n" 1357 "RemoveQual(obj);\n" 1365 "MACRO Macro_name \"Description\"\n" 1368 "FOR EACH Pubdesc\n" 1370 "obj = PUB_AFFIL(\"affil\") WHERE EQUALS(obj, match, \"local_synfile.txt\", match);\n" 1371 "RemoveQual(obj);\n" 1379 "MACRO Macro_name \"Description\"\n" 1382 "FOR EACH Pubdesc\n" 1384 "obj = PUB_AFFIL(\"affil\") WHERE EQUALS(obj, match, true);\n" 1385 "RemoveQual(obj);\n" 1388macro::CMacroRep* macro_rep = engine.
Parse(macro);
1389BOOST_CHECK(macro_rep);
1391vector<CRef<CMacroRep>> macros;
1392macros.push_back(
Ref(macro_rep));
1394BOOST_CHECK(syn_files.empty());
1399 "MACRO Macro_name \"Description\"\n" 1402 "FOR EACH Pubdesc\n" 1404 "obj = PUB_AFFIL(\"affil\") WHERE CONTAINS(obj, match);\n" 1405 "RemoveQual(obj);\n" 1408macro::CMacroRep* macro_rep = engine.
Parse(macro);
1409BOOST_CHECK(macro_rep);
1411vector<CRef<CMacroRep>> macros;
1412macros.push_back(
Ref(macro_rep));
1414BOOST_CHECK(syn_files.empty());
1419 "MACRO Macro_name \"Description\"\n" 1421 "match1 = \"synonym02-DSM\"\n" 1422 "match2 = \"test\"\n" 1423 "case_sensitive = false\n" 1424 "ignore_spaces = true\n" 1425 "ignore_punctuation = true\n" 1426 "include_left = true\n" 1427 "include_right = false\n" 1428 "case_sens_parse = true\n" 1429 "whole_word = false\n" 1430 "cap_change = \"none\"\n" 1431 "existing_text = \"eReplace\"\n" 1432 "find_text = \"find\"\n" 1433 "FOR EACH BioSource\n" 1435 "src = Resolve(\"org.orgname.mod\") WHERE src.subtype = \"strain\" AND \n" 1436 "NOT EQUALS(\"src.subname\", \"DSM\", \"synonyms.txt\", match1) AND \n" 1437 "NOT CONTAINS(\"src.subname\", \",\") AND \n" 1438 "NOT CONTAINS(\"src.subname\", \"CBS\", case_sensitive, ignore_spaces, ignore_punctuation, \"synonyms.txt\", match2) AND \n" 1439 "STARTS(\"src.subname\", find_text, case_sensitive, ignore_spaces, ignore_punctuation, \"synonyms.txt\", \"DSMZ\");\n" 1440 "text = ParsedText(\"src.subname\", find_text, include_left, \"repl\", include_right, case_sens_parse, whole_word);\n" 1441 "AddParsedText(text, \"culture-collection\", cap_change, existing_text); \n" 1449 "MACRO Macro_name \"Description\"\n" 1451 "match1 = \"synonym02-DSM\"\n" 1452 "match2 = \"test\"\n" 1453 "case_sensitive = false\n" 1454 "ignore_spaces = true\n" 1455 "ignore_punctuation = true\n" 1456 "include_left = true\n" 1457 "include_right = false\n" 1458 "case_sens_parse = true\n" 1459 "whole_word = false\n" 1460 "cap_change = \"none\"\n" 1461 "existing_text = \"eReplace\"\n" 1462 "find_text = \"find\"\n" 1463 "FOR EACH BioSource\n" 1465 "src = Resolve(\"org.orgname.mod\") WHERE src.subtype = \"strain\" AND \n" 1466 "NOT EQUALS(\"src.subname\", \"DSM\", \"local_synfile.txt\", match1) AND \n" 1467 "NOT CONTAINS(\"src.subname\", \",\") AND \n" 1468 "NOT CONTAINS(\"src.subname\", \"CBS\", case_sensitive, ignore_spaces, ignore_punctuation, \"local_synfile.txt\", match2) AND \n" 1469 "STARTS(\"src.subname\", find_text, case_sensitive, ignore_spaces, ignore_punctuation, \"local_synfile.txt\", \"DSMZ\");\n" 1470 "text = ParsedText(\"src.subname\", find_text, include_left, \"repl\", include_right, case_sens_parse, whole_word);\n" 1471 "AddParsedText(text, \"culture-collection\", cap_change, existing_text); \n" 1479 "MACRO Macro_name \"Description\"\n" 1481 "match1 = \"synonym02-DSM\"\n" 1482 "match2 = \"test\"\n" 1483 "case_sensitive = false\n" 1484 "ignore_spaces = true\n" 1485 "ignore_punctuation = true\n" 1486 "include_left = true\n" 1487 "include_right = false\n" 1488 "case_sens_parse = true\n" 1489 "whole_word = false\n" 1490 "cap_change = \"none\"\n" 1491 "existing_text = \"eReplace\"\n" 1492 "find_text = \"find\"\n" 1493 "FOR EACH BioSource\n" 1495 "src = Resolve(\"org.orgname.mod\") WHERE src.subtype = \"strain\" AND \n" 1496 "NOT EQUALS(\"src.subname\", \"DSM\", \"synonyms.txt\", match1) AND \n" 1497 "NOT CONTAINS(\"src.subname\", \",\") AND \n" 1498 "NOT CONTAINS(\"src.subname\", \"CBS\", case_sensitive, ignore_spaces, ignore_punctuation, \"local_synfile.txt\", match2) AND \n" 1499 "STARTS(\"src.subname\", find_text, case_sensitive, ignore_spaces, ignore_punctuation, \"local_synfile.txt\", \"DSMZ\");\n" 1500 "text = ParsedText(\"src.subname\", find_text, include_left, \"repl\", include_right, case_sens_parse, whole_word);\n" 1501 "AddParsedText(text, \"culture-collection\", cap_change, existing_text); \n" 1504macro::CMacroRep* macro_rep = engine.
Parse(macro);
1505BOOST_CHECK(macro_rep);
1507cout <<
"Parsing failed for macro:\n"<< macro << endl;
1511vector<CRef<CMacroRep>> macros;
1512macros.push_back(
Ref(macro_rep));
1514BOOST_REQUIRE(syn_files.size() == 2);
1515 sort(syn_files.begin(), syn_files.end());
1516BOOST_CHECK(syn_files[0] ==
"local_synfile.txt");
1517BOOST_CHECK(syn_files[1] ==
"synonyms.txt");
@Auth_list.hpp User-defined methods of the data storage class.
@Name_std.hpp User-defined methods of the data storage class.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
static const char * str(char *buf, int n)
static string s_GetFirstNameInitials(const string &first_name)
bool RemoveFirstName(objects::CName_std &std_name)
bool ApplyMiddleInitial(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
static bool s_EditText(string &str, const string &find, const string &repl, ESearchLoc loc, bool case_sensitive, bool is_regex=false)
static bool s_FixInitials(objects::CName_std &name)
static string s_GetMobileElemTType(const string &value)
static string s_GetMobileElemTName(const string &value)
static string s_FixProteinNameFormat(const string &protein, const vector< string > &taxnames)
unsigned ApplyAuthorNames(objects::CAuth_list &auth_list, const string &newValue)
string TransformForCSV(const string &str)
static bool s_ReverseAuthorNames(objects::CName_std &name)
bool RemoveMiddleInitial(objects::CName_std &std_name)
static void s_BuildName(const string &firstname, const string &mid_initials, const string &lastname, const string &suffix, objects::CName_std &name)
static bool s_TruncateMiddleInitials(objects::CName_std &name)
static string s_MakeMobileElementT(const string &type, const string &name)
bool ApplyFirstName(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
vector< string > GetSynonymFilenames(const vector< CRef< CMacroRep >> ¯o_list) const
Extracts synonym files present in the list of macros.
static bool s_MoveMiddleToFirst(objects::CName_std &name)
CMacroRep * Parse(const string ¯o_text)
Parses macro script into its binary representation.
#define MSerial_AsnText
I/O stream manipulators â.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void SetInitials(const TInitials &value)
Assign a value to Initials data member.
void ResetInitials(void)
Reset Initials data member.
const TInitials & GetInitials(void) const
Get the Initials member data.
void ResetFirst(void)
Reset First data member.
void SetLast(const TLast &value)
Assign a value to Last data member.
void SetFirst(const TFirst &value)
Assign a value to First data member.
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
virtual void Reset(void)
Reset the whole object.
const TFirst & GetFirst(void) const
Get the First member data.
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
Macro engine for macro execution.
static void text(MDB_val *v)
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
@ eExistingText_append_space
@ eExistingText_append_none
@ eExistingText_leave_old
@ eExistingText_replace_old
Utility stuff for more convenient using of Boost.Test library.
string MakeAsn(const T &object)
BOOST_AUTO_TEST_CASE(Test_FixProteinNames)
void Test_SynonymFiles(const string ¯o, const string &syn_file, CMacroEngine &engine)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4