fmt <<
"NC_"<< setfill(
'0') << setw(6) <<
m_Random.
GetRand(1, 10);
108 for(
int i= 0;
i< 1000; ++
i) {
117 if(
m_Ids.size() > 10 ) {
135vector< CRef<CThread> > tt;
136 for(
int i= 0;
i< 10; ++
i) {
151 const size_tNQ = 20;
152vector<thread> tt(NQ);
153 for(
size_t i= 0;
i< NQ; ++
i) {
160 for(
int i= 0;
i< 1000000; ++
i) {
166 for(
size_t i= 0;
i< NQ; ++
i) {
194BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
" 1234 ")));
195BOOST_CHECK(id->
IsGi());
196BOOST_CHECK(id->
GetGi() == 1234);
203BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"9876543210")));
204BOOST_CHECK(id->
IsGi());
218BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"N00068")));
219BOOST_CHECK(id->
IsDdbj());
228BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"N20001.1")));
247BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"bn000123")));
248BOOST_CHECK(id->
IsTpe());
253BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"FAA00017")));
254BOOST_CHECK(id->
IsTpd());
258BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"CAAA01020304")));
259BOOST_CHECK(id->
IsEmbl());
260BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"AACN011056789")));
261BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"ABCD1234567890")));
324BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"550086A")));
325BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"650771AF")));
326BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"0806162C")));
327BOOST_CHECK(id->
IsPrf());
329BOOST_CHECK_EQUAL(id->
GetPrf().
GetName(),
string(
"0806162C"));
330BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"2015436HX")));
331BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1309311A:PDB=1EMD,2CMD")));
344BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV")));
345BOOST_CHECK(id->
IsPdb());
346BOOST_CHECK_EQUAL(id->
GetPdb().
GetMol().
Get(),
string(
"1GAV"));
357BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV|X")));
358BOOST_CHECK(id->
IsPdb());
359BOOST_CHECK_EQUAL(id->
GetPdb().
GetMol().
Get(),
string(
"1GAV"));
362BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV|XY")));
365BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV|XX")));
368BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV_!")));
371BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV|VB")));
374BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"1GAV|AAA")));
398BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"q7cqj0")));
403BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"A2ASS6.1")));
407BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"A0A022YWF9")));
424BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NM_000170.1")));
426BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NM_001000170")));
429BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"ZP_00345678")));
432BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NZ_CH959311.1")));
436BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NZ_AABC03000051")));
437BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NZ_ABJB030000051")));
438BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"NZ_ABJB0300000510")));
448BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"GPC_123456789.1")));
460BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"AT_123456789.1")));
471BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|0")));
476BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|123")));
481BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|0123")));
486BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|-123")));
491BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|asdf")));
494BOOST_CHECK_EQUAL(id->
GetLocal().
GetStr(),
string(
"asdf"));
496BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"lcl|NM_002020|")));
499BOOST_CHECK_EQUAL(id->
GetLocal().
GetStr(),
string(
"NM_002020"));
507BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"bbs|123")));
509BOOST_CHECK_EQUAL(id->
GetGibbsq(), 123);
511BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"bbs|0")));
517BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"bbm|123")));
520BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"gim|123")));
521BOOST_CHECK(id->
IsGiim());
530BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"gb|U12345.1|AMU12345")));
542BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"emb|AL123456|MTBH37RV")));
543BOOST_CHECK(id->
IsEmbl());
545BOOST_CHECK_EQUAL(id->
GetEmbl().
GetName(),
string(
"MTBH37RV"));
554BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pir||S16356")));
555BOOST_CHECK(id->
IsPir());
557BOOST_CHECK_EQUAL(id->
GetPir().
GetName(),
string(
"S16356"));
566BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"sp|Q7CQJ0|RS22_SALTY")));
573BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"tr|Q90RT2|Q90RT2_9HIV1")));
576BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"sp|Q7CQJ0.1")));
586BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pat|US|RE33188|1")));
592 string(
"RE33188"));
612 "US",
"RE33188", 1)));
614 string(
"RE33188"));
628BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"ref|NM_000170.1")));
635BOOST_CHECK_EQUAL(
version, 1);
646(
"gnl|dbSNP|rs31251_allelePos=201totallen=401|taxid=9606" 647 "|snpClass=1|alleles=?|mol=?|build=?")));
652 string(
"rs31251_allelePos=201totallen=401|taxid=9606" 653 "|snpClass=1|alleles=?|mol=?|build=?"));
655BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"gnl|taxon|9606")));
666BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"gi|1234")));
667BOOST_CHECK(id->
IsGi());
668BOOST_CHECK_EQUAL(id->
GetGi(), 1234);
675BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"dbj|N00068")));
676BOOST_CHECK(id->
IsDdbj());
684BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"prf||0806162C")));
685BOOST_CHECK(id->
IsPrf());
692BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV")));
693BOOST_CHECK(id->
IsPdb());
694BOOST_CHECK_EQUAL(id->
GetPdb().
GetMol().
Get(),
string(
"1GAV"));
698BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|X")));
699BOOST_CHECK(id->
IsPdb());
700BOOST_CHECK_EQUAL(id->
GetPdb().
GetMol().
Get(),
string(
"1GAV"));
704BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|XY")));
707BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|XX")));
710BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|!")));
713BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|VB")));
716BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"pdb|1GAV|AAA")));
725BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"tpg|BK003456")));
726BOOST_CHECK(id->
IsTpg());
727BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"tpe|BN000123")));
728BOOST_CHECK(id->
IsTpe());
729BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"tpd|FAA00017")));
730BOOST_CHECK(id->
IsTpd());
736BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"gpp|GPC_123456789")));
743BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(
"nat|AT_123456789")));
749 boolset_as_general =
false)
754 return new CSeq_id(dbtag, set_as_general);
758 boolset_as_general =
false)
763 return new CSeq_id(dbtag, set_as_general);
778BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"EMBL",
"AL123456.7")));
779BOOST_CHECK(id->
IsEmbl());
790BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"DDBJ",
"N00068")));
791BOOST_CHECK(id->
IsDdbj());
794BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"GI",
"12345",
true)));
799BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"GI", 12345,
true)));
805BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"taxon", 9606,
true)));
809BOOST_CHECK_NO_THROW(
id.Reset(
s_NewDbtagId(
"TRACE_ASSM",
"992",
true)));
818BOOST_CHECK(id->
IsGi());
819BOOST_CHECK_EQUAL(id->
GetGi(), 1234);
834BOOST_CHECK(id->
IsGiim());
849 "gb|U12345.1|AMU12345",
850 "emb|AL123456|MTBH37RV",
852 "sp|Q7CQJ0|RS22_SALTY",
853 "tr|Q90RT2|Q90RT2_9HIV1",
858 "gnl|EcoSeq|EcoAce",
859 "gnl|Celera|CDM:10213987",
872 "gpp|GPC_123456789|",
873 "nat|AT_123456789.1|",
875 "gnl|dbSNP|rs31251_allelePos=201totallen=401|taxid=9606" 876 "|snpClass=1|alleles=?|mol=?|build=?" 884BOOST_TEST_MESSAGE(
string(
"Testing round trip for ") << s);
885BOOST_CHECK_NO_THROW(
id.Reset(
new CSeq_id(s)));
891BOOST_REQUIRE_EQUAL(ids.size(), 1u);
892BOOST_CHECK_EQUAL(ids.front()->AsFastaString(), s);
893BOOST_CHECK(ids.front()->Equals(*
id));
894BOOST_CHECK(id->
Match(*
id));
898pos !=
NPOS&& (s[pos] ==
'|'|| s[pos] ==
' ');
902BOOST_TEST_MESSAGE(
"Testing equality with "<< ss);
905BOOST_CHECK(id->
Match(*id2));
916BOOST_CHECK_NO_THROW(
id.SetGiim().SetDb(
"foo"));
917BOOST_CHECK_NO_THROW(
id.SetGiim().SetRelease(
"2.0"));
918BOOST_CHECK(
id.IsGiim());
919BOOST_CHECK(
id.GetGiim().IsSetDb());
920BOOST_CHECK(
id.GetGiim().IsSetRelease());
921BOOST_CHECK_NO_THROW(
id.Set(
"gim|123"));
922BOOST_CHECK(
id.IsGiim());
923BOOST_CHECK( !
id.GetGiim().IsSetDb() );
924BOOST_CHECK( !
id.GetGiim().IsSetRelease() );
926BOOST_CHECK_NO_THROW(
id.SetGenbank().SetRelease(
"135"));
927BOOST_CHECK(
id.IsGenbank());
928BOOST_CHECK(
id.GetGenbank().IsSetRelease());
929BOOST_CHECK_NO_THROW(
id.Set(
"gb|U12345.1|AMU12345"));
930BOOST_CHECK(
id.IsGenbank());
931BOOST_CHECK( !
id.GetGenbank().IsSetRelease() );
933BOOST_CHECK_NO_THROW(
id.SetPatent().SetCit().SetDoc_type(
"app"));
934BOOST_CHECK(
id.IsPatent());
935BOOST_CHECK(
id.GetPatent().GetCit().IsSetDoc_type());
936BOOST_CHECK_NO_THROW(
id.Set(
"pat|US|RE33188|1"));
937BOOST_CHECK(
id.IsPatent());
938BOOST_CHECK( !
id.GetPatent().GetCit().IsSetDoc_type() );
940BOOST_CHECK_NO_THROW(
id.SetPdb().SetRel().SetToTime(
GetFastLocalTime()));
941BOOST_CHECK(
id.IsPdb());
942BOOST_CHECK(
id.GetPdb().IsSetRel());
943BOOST_CHECK_NO_THROW(
id.Set(
"pdb|1GAV|X"));
944BOOST_CHECK(
id.IsPdb());
945BOOST_CHECK( !
id.GetPdb().IsSetRel() );
965 string(
"gi|1234|ref|NM_000170.1|"));
967 string(
"gi|1234"));
970 string(
"ref|NM_000170.1"));
973 string(
"ref|NM_000170"));
990mix1->
SetMix().Set().push_back(loc1);
996mix2->
SetMix().Set().push_back(loc2);
998BOOST_CHECK(loc1->
IsWhole());
1002BOOST_CHECK(loc2->
IsEmpty());
1006BOOST_CHECK(loc1->
GetId());
1008BOOST_CHECK_EQUAL(loc1->
GetId()->
GetGi(), 1);
1010BOOST_CHECK(loc2->
GetId());
1012BOOST_CHECK_EQUAL(loc2->
GetId()->
GetGi(), 2);
1019BOOST_CHECK(loc1->
IsEmpty());
1023BOOST_CHECK(loc2->
IsEmpty());
1027BOOST_CHECK(loc1->
GetId());
1029BOOST_CHECK_EQUAL(loc1->
GetId()->
GetGi(), 2);
1031BOOST_CHECK(loc2->
GetId());
1033BOOST_CHECK_EQUAL(loc2->
GetId()->
GetGi(), 2);
1040feat1->
SetData().SetRegion(
"1");
1047feat2->
SetData().SetRegion(
"2");
1050BOOST_CHECK(loc1->
IsWhole());
1054BOOST_CHECK(loc2->
IsEmpty());
1058BOOST_CHECK(loc1->
GetId());
1060BOOST_CHECK_EQUAL(loc1->
GetId()->
GetGi(), 1);
1062BOOST_CHECK(loc2->
GetId());
1064BOOST_CHECK_EQUAL(loc2->
GetId()->
GetGi(), 2);
1074BOOST_CHECK(loc1->
IsEmpty());
1078BOOST_CHECK(loc2->
IsEmpty());
1082BOOST_CHECK(loc1->
GetId());
1084BOOST_CHECK_EQUAL(loc1->
GetId()->
GetGi(), 2);
1086BOOST_CHECK(loc2->
GetId());
1088BOOST_CHECK_EQUAL(loc2->
GetId()->
GetGi(), 2);
1096 static const char* sc_SeqIdLabels[] = {
1106 "Seq-id ::= gi 1234",
1107 "gi",
"1234",
"gi|1234",
1108 "gi|1234",
"1234",
"1234",
"GI|1234",
1110 "Seq-id ::= other { accession \"NM_123456\", version 1}",
1111 "ref",
"NM_123456.1",
"ref|NM_123456.1",
1112 "ref|NM_123456.1|",
"NM_123456.1",
"NM_123456",
"REF|NM_123456.1",
1114 "Seq-id ::= general { db \"ti\", tag id 1}",
1115 "gnl",
"ti:1",
"gnl|ti:1",
1116 "gnl|ti|1",
"ti:1",
"ti:1",
"GNL|TI|1",
1118 "Seq-id ::= general { db \"NCBI_GENOMES\", tag id 1}",
1119 "gnl",
"NCBI_GENOMES:1",
"gnl|NCBI_GENOMES:1",
1120 "gnl|NCBI_GENOMES|1",
"NCBI_GENOMES:1",
"NCBI_GENOMES:1",
"GNL|NCBI_GENOMES|1",
1122 "Seq-id ::= pir { name \"S34010\" }",
1123 "pir",
"S34010",
"pir|S34010",
1124 "pir||S34010",
"S34010",
"S34010",
"PIR|S34010",
1126 "Seq-id ::= patent { seqid 257, cit { country \"JP\", id number \"2003530853\" } }",
1127 "pat",
"JP2003530853_257",
"pat|JP2003530853_257",
1128 "pat|JP|2003530853|257",
"JP2003530853_257",
"JP2003530853_257",
"PAT|JP|2003530853|257",
1130 "Seq-id ::= pdb { mol \"1GAV\", chain 120 }",
1131 "pdb",
"1GAV_x",
"pdb|1GAV_x",
1132 "pdb|1GAV|x",
"1GAV_x",
"1GAV_x",
"PDB|1GAV|x",
1134 "Seq-id ::= pdb { mol \"1GAV\", chain-id \"xY\" }",
1135 "pdb",
"1GAV_xY",
"pdb|1GAV_xY",
1136 "pdb|1GAV|xY",
"1GAV_xY",
"1GAV_xY",
"PDB|1GAV|xY",
1139 "Seq-id ::= local str \"abcdABCD\"",
1140 "lcl",
"abcdABCD",
"lcl|abcdABCD",
1141 "lcl|abcdABCD",
"abcdABCD",
"abcdABCD",
"LCL|ABCDABCD",
1143 "Seq-id ::= local id 1234",
1144 "lcl",
"1234",
"lcl|1234",
1145 "lcl|1234",
"1234",
"1234",
"LCL|1234",
1151 const char** p = sc_SeqIdLabels;
1152 for( ; p && *p; p += 8) {
1153 const char* src_id = *(p + 0);
1154 const char*
type= *(p + 1);
1155 const char* content = *(p + 2);
1156 const char* both = *(p + 3);
1157 const char* fasta_str = *(p + 4);
1158 const char* seqid_str1 = *(p + 5);
1159 const char* seqid_str2 = *(p + 6);
1160 const char* upper_case = *(p + 7);
1174BOOST_CHECK_EQUAL(s,
type);
1179BOOST_CHECK_EQUAL(s, content);
1184BOOST_CHECK_EQUAL(s, both);
1186 LOG_POST(
Info<<
" fasta string: "<<
id.AsFastaString());
1187BOOST_CHECK_EQUAL(
id.AsFastaString(), fasta_str);
1199BOOST_CHECK_EQUAL(s, upper_case);
1208 static const char*
sc_Ids=
"\ 1212 Seq-id ::= patent {\ 1216 id number \"2003530853\"\ 1234BOOST_CHECK_EQUAL(
label, fasta_seqid);
1237BOOST_CHECK(other.Equals(
id));
1247 static const char*
const sc_Ids[] = {
1248 "lcl|-723121231214",
1249 "lcl|-723121231214",
1263 "lcl|723121231214",
1273 "ref|NC_000001|chr1_build35",
1274 "ref|NC_000001|chr1_build36",
1279 "ref|NC_000001.9|chr1_build36",
1280 "gnl|ti|-9223372036854775808",
1281 "gnl|ti|-623121231214",
1282 "gnl|Ti|-2147483649",
1283 "gnl|Ti|-2147483648",
1284 "gnl|Ti|-2147483647",
1294 "gnl|Ti|2147483647",
1295 "gnl|Ti|2147483648",
1296 "gnl|TI|52312123124",
1297 "gnl|ti|623121231214",
1298 "gnl|ti|9223372036854775807",
1304 "gnl|ti|-9223372036854775809",
1305 "gnl|ti|22312-234",
1306 "gnl|ti|9223372036854775808",
1308 "gnl|trace|-623121231214",
1309 "gnl|trace|-623121231214",
1310 "gnl|TRACE|-12312",
1311 "gnl|TRACE|-12312",
1316 "gnl|trace|3231212",
1317 "gnl|trace|3231212",
1318 "gnl|TRACE|42312324",
1319 "gnl|TRACE|42312324",
1320 "gnl|TRACE|2123123241",
1321 "gnl|TRACE|2423123241",
1322 "gnl|TRACE|52312123124",
1323 "gnl|trace|623121231214",
1329 "gnl|TRACE|22312-234",
1343 if( ids[
i]->IsLocal() ) {
1344BOOST_CHECK_EQUAL(ids[
i]->AsFastaString(),
sc_Ids[
i]);
1345 if( ids[
i]->GetLocal().IsId() ) {
1346 int id= ids[
i]->GetLocal().GetId();
1347BOOST_CHECK(
id> 0);
1350BOOST_CHECK_EQUAL(ids[
i]->AsFastaString(),
sc_Ids[
i]);
1354 const string&
id= ids[
i]->GetLocal().GetStr();
1356 id[0] <
'1'||
id[0] >
'9');
1359 if( ids[
i]->IsGeneral() ) {
1360BOOST_CHECK_EQUAL(ids[
i]->AsFastaString(),
sc_Ids[
i]);
1361 if( ids[
i]->GetGeneral().GetTag().IsId() ) {
1362 int id= ids[
i]->GetGeneral().GetTag().GetId();
1363BOOST_CHECK(
id> 0);
1366BOOST_CHECK_EQUAL(ids[
i]->AsFastaString(),
sc_Ids[
i]);
1370 const string&
id= ids[
i]->GetGeneral().GetTag().GetStr();
1372 id[0] <
'1'||
id[0] >
'9');
1377 for(
size_t i= 0;
i< ids.size(); ++
i) {
1378 swap(ids[
i], ids[
rnd.GetRandSize_t(
i, ids.size()-1)]);
1380vector<TRef> sorted_ids = ids;
1381stable_sort(sorted_ids.begin(), sorted_ids.end(),
PPtrLess<TRef>());
1384 ITERATE( vector<TRef>, it, sorted_ids ) {
1388 for(
size_t i= 0;
i< sorted_ids.size(); ++
i) {
1389BOOST_CHECK_EQUAL(sorted_ids[
i]->CompareOrdered(*sorted_ids[
i]), 0);
1390 for(
size_tj = 0; j <
i; ++j ) {
1391BOOST_CHECK(sorted_ids[j]->CompareOrdered(*sorted_ids[
i]) <= 0);
1392BOOST_CHECK(sorted_ids[
i]->CompareOrdered(*sorted_ids[j]) >= 0);
1396BOOST_CHECK_EQUAL(sorted_ids[
i]->AsFastaString(),
1398BOOST_CHECK_EQUAL(sorted_ids[
i]->AsFastaString(),
"");
1402TSet ids_set(ids.begin(), ids.end());
1403BOOST_CHECK(ids_set.size() < sorted_ids.size());
1404 ITERATE( TSet, it, ids_set ) {
1406BOOST_CHECK_EQUAL((*it)->CompareOrdered(**it), 0);
1407 ITERATE( TSet, it2, ids_set ) {
1411BOOST_CHECK((*it2)->CompareOrdered(**it) < 0);
1412BOOST_CHECK((*it)->CompareOrdered(**it2) > 0);
1422vector<CSeq_id_Handle> sorted_idhs;
1423 for(
auto&
i: sorted_ids ) {
1426 for(
size_t i= 0;
i< sorted_idhs.size(); ++
i) {
1427BOOST_CHECK_EQUAL(sorted_idhs[
i].CompareOrdered(sorted_idhs[
i]), 0);
1428 for(
size_tj = 0; j <
i; ++j ) {
1430BOOST_CHECK_LE(sorted_idhs[j].CompareOrdered(sorted_idhs[
i]), 0);
1431BOOST_CHECK_GE(sorted_idhs[
i].CompareOrdered(sorted_idhs[j]), 0);
1434sorted_idhs.clear();
1435 for(
auto&
i: ids ) {
1441 for(
auto&
id: sorted_idhs ) {
1445BOOST_REQUIRE_EQUAL(sorted_ids.size(), sorted_idhs.size());
1446 for(
size_t i= 0;
i< sorted_idhs.size(); ++
i) {
1450 for(
size_tj = 0; j <
i; ++j ) {
1457 for(
size_t i= 0;
i< sorted_idhs.size(); ++
i) {
1458BOOST_CHECK_EQUAL(sorted_idhs[
i].CompareOrdered(sorted_idhs[
i]), 0);
1459 for(
size_tj = 0; j <
i; ++j ) {
1460BOOST_CHECK(sorted_idhs[j].CompareOrdered(sorted_idhs[
i]) <= 0);
1461BOOST_CHECK(sorted_idhs[
i].CompareOrdered(sorted_idhs[j]) >= 0);
1479 if(
rnd.GetRand(0, 10) == 0 ) {
1486 if( from == to &&
rnd.GetRand(0, 1) ) {
1487loc->
SetPnt().SetId(*
id);
1488loc->
SetPnt().SetPoint(from);
1489 if(
rnd.GetRand(0, 1) ) {
1494loc->
SetInt().SetId(*
id);
1495 if( from > to || (from == to &&
rnd.GetRand(0, 1)) ) {
1499loc->
SetInt().SetFrom(from);
1500loc->
SetInt().SetTo(to);
1508 if( 0 && (
a.IsNull() ||
b.IsNull()) ) {
1513 if( 0 && (
a.IsNull() ||
b.IsNull()) ) {
1514cout <<
" = "<< diff << endl;
1521 return(*
this)(*
a, *
b);
1527 if(0 && (
a.IsNull() ||
b.IsNull())) {
1532 if(0 && (
a.IsNull() ||
b.IsNull())) {
1533cout <<
" = "<< diff << endl;
1540 return(*
this)(*
a, *
b);
1549 for(
int t= 0;
t< 1000; ++
t) {
1550vector< CRef<CSeq_loc> > locs;
1551 for(
int i= 0;
i< 10; ++
i) {
1552 size_tsegs =
rnd.GetRand(1, 10);
1554 if( segs == 1 &&
rnd.GetRand(0, 1) ) {
1558 for(
size_tj = 0; j < segs; ++j ) {
1562locs.push_back(loc);
1565 for(
size_t i= 0;
i< locs.size(); ++
i) {
1572 for(
size_tj = 0; j <
i; ++j ) {
1587 for(
size_t i= 0;
i< locs.size(); ++
i) {
1594 for(
size_tj = 0; j <
i; ++j) {
1615 if( it != ids.
begin() ) {
1626 ITERATE( vector<CSeq_id_Handle>, it, ids ) {
1627 if( it != ids.begin() ) {
1637 constvector<CSeq_id_Handle>& ids,
1645good_matches = matches == exp_matches;
1648good_matches =
true;
1650 if( !matches.count(*it) ) {
1651good_matches =
false;
1656 if( !exp_matches.count(*it) &&
1657 count(ids.begin(), ids.end(), *it) ) {
1658good_matches =
false;
1663 if( !good_matches ) {
1669BOOST_CHECK(good_matches);
1674 const char*
constfasta_ids[],
1675 const char*
constmatch_to_ids[],
1676 const char*
constweak_match_to_ids[],
1677 boolstrict =
true)
1680 for(
size_txi = 0; xi < num_ids; ++xi ) {
1683 for(
size_txi = 0; xi <= num_ids; ++xi ) {
1685vector<CSeq_id_Handle> ids;
1690 for(
size_t i= 0;
i< num_ids; ++
i) {
1694strs.
insert(fasta_ids[
i]);
1696ids.push_back(
id);
1698 for(
size_t i= 0;
i< num_ids; ++
i) {
1705 ITERATE( vector<string>, it, ids ) {
1706 if( !strs.count(*it) ) {
1710match_to_map[id].
insert(match_to_id);
1711matching_map[match_to_id].
insert(
id);
1714 for(
size_t i= 0;
i< num_ids; ++
i) {
1721 ITERATE( vector<string>, it, ids ) {
1722 if( !strs.count(*it) ) {
1726weak_match_to_map[id].
insert(match_to_id);
1727weak_matching_map[match_to_id].
insert(
id);
1730 for(
size_t i= 0;
i< ids.size(); ++
i) {
1732ids[
i].GetMatchingHandles(matches);
1734exp_matches.
insert(ids[
i]);
1737BOOST_CHECK(ids[
i].MatchesTo(*it));
1739 for(
size_tj = 0; j < ids.size(); ++j ) {
1740 if( j == xi || matches.count(ids[j]) ) {
1743BOOST_CHECK(!ids[
i].MatchesTo(ids[j]));
1746 for(
size_t i= 0;
i< ids.size(); ++
i) {
1748ids[
i].GetReverseMatchingHandles(matches);
1750exp_matches.
insert(ids[
i]);
1753BOOST_CHECK(it->MatchesTo(ids[
i]));
1756 for(
size_t i= 0;
i< ids.size(); ++
i) {
1760exp_matches.
insert(ids[
i]);
1761 s_CheckMatches(ids[
i], ids, matches, exp_matches, strict,
"weak");
1764 if( ids[
i].Which() != id2.
Which() ) {
1766 id.
Select(ids[
i].Which());
1767 const_cast<CTextseq_id&
>(*
id.GetTextseq_Id())
1771BOOST_CHECK(ids[
i].MatchesTo(id2));
1774 for(
size_t i= 0;
i< ids.size(); ++
i) {
1778exp_matches.
insert(ids[
i]);
1779 s_CheckMatches(ids[
i], ids, matches, exp_matches, strict,
"weak rev");
1782 if( ids[
i].Which() != id2.
Which() ) {
1784 id.
Select(ids[
i].Which());
1785 const_cast<CTextseq_id&
>(*
id.GetTextseq_Id())
1797 const char*
constfasta_ids[] = {
1805 const char*
constmatch_to_ids[] = {
1813 const char*
constweak_match_to_ids[] = {
1815 "tpg|A000001,tpg|A000001.2,gb|A000001",
1816 "tpg|A000001,tpg|A000001.3,gb|A000001",
1818 "gb|A000001,gb|A000001.2,tpg|A000001",
1819 "gb|A000001,gb|A000001.3,tpg|A000001",
1822fasta_ids, match_to_ids, weak_match_to_ids);
1828 const char*
constfasta_ids[] = {
1842 const char*
constmatch_to_ids[] = {
1856 const char*
constweak_match_to_ids[] = {
1858 "tpg|A000001,tpg|A000001.2,gb|A000001",
1859 "tpg|A000001,tpg|A000001.3,gb|A000001",
1861 "gb|A000001,gb|A000001.2,tpg|A000001",
1862 "gb|A000001,gb|A000001.3,tpg|A000001",
1864 "tpg|AAAAAAA,tpg|AAAAAAA.2,gb|AAAAAAA",
1865 "tpg|AAAAAAA,gb|AAAAAAA",
1867 "gb|AAAAAAA,gb|AAAAAAA.2,tpg|AAAAAAA",
1868 "gb|AAAAAAA,tpg|AAAAAAA",
1871fasta_ids, match_to_ids, weak_match_to_ids);
1877 const char*
constfasta_ids[] = {
1890 "tpg|A000002.5|name2",
1892 "ref|NT_025975.2|HsY_2613",
1893 "ref|NT_025975.2|HsY_2614",
1895 "ref|NT_025975.3|HsY_2613",
1896 "ref|NT_025975.3|HsY_2614",
1898 "ref|NT_025975|HsY_2613",
1899 "ref|NT_025975|HsY_2614",
1901 const char*
constmatch_to_ids[] = {
1913 "tpg|A000002,tpg|A000002.5|name2",
1914 "tpg|A000002,tpg|A000002.5",
1915 "ref|NT_025975.2|HsY_2613,ref|NT_025975.2|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1916 "ref|NT_025975.2,ref|NT_025975.2|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1917 "ref|NT_025975.2,ref|NT_025975.2|HsY_2613,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1918 "ref|NT_025975.3|HsY_2613,ref|NT_025975.3|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1919 "ref|NT_025975.3,ref|NT_025975.3|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1920 "ref|NT_025975.3,ref|NT_025975.3|HsY_2613,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1921 "ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1922 "ref|NT_025975,ref|NT_025975|HsY_2614",
1923 "ref|NT_025975,ref|NT_025975|HsY_2613",
1925 const char*
constweak_match_to_ids[] = {
1927 "tpg|A000001,tpg|A000001.2,gb|A000001",
1928 "tpg|A000001,tpg|A000001.3,gb|A000001",
1930 "gb|A000001,gb|A000001.2,tpg|A000001",
1931 "gb|A000001,gb|A000001.3,tpg|A000001",
1933 "tpg|A000002,tpg|A000002.2,gb|A000002",
1934 "tpg|A000002,gb|A000002",
1936 "gb|A000002,gb|A000002.2,tpg|A000002",
1937 "gb|A000002,tpg|A000002,tpg|A000002.5|name2",
1938 "gb|A000002,tpg|A000002,tpg|A000002.5",
1939 "ref|NT_025975.2|HsY_2613,ref|NT_025975.2|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1940 "ref|NT_025975.2,ref|NT_025975.2|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1941 "ref|NT_025975.2,ref|NT_025975.2|HsY_2613,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1942 "ref|NT_025975.3|HsY_2613,ref|NT_025975.3|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1943 "ref|NT_025975.3,ref|NT_025975.3|HsY_2614,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1944 "ref|NT_025975.3,ref|NT_025975.3|HsY_2613,ref|NT_025975,ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1945 "ref|NT_025975|HsY_2613,ref|NT_025975|HsY_2614",
1946 "ref|NT_025975,ref|NT_025975|HsY_2614",
1947 "ref|NT_025975,ref|NT_025975|HsY_2613",
1950fasta_ids, match_to_ids, weak_match_to_ids,
false);
1955 stringacc =
"HP56600";
1956 for(
int i= 0;
i< 10; ++
i) {
1958cout << acc <<
" -> "<<
type<<
" = 0x"<<
hex<<
type<< dec << endl;
1959acc.erase(acc.size()-1);
1963 for(
int i= 0;
i< 10; ++
i) {
1965cout << acc <<
" -> "<<
type<<
" = 0x"<<
hex<<
type<< dec << endl;
1966acc.erase(acc.size()-1);
1970 for(
int i= 0;
i< 10; ++
i) {
1972cout << acc <<
" -> "<<
type<<
" = 0x"<<
hex<<
type<< dec << endl;
1973acc.erase(acc.size()-1);
1981 LOG_POST(
"Matching local int<>str ids");
1991BOOST_CHECK(id1->
Match(*id2));
1992BOOST_CHECK(id2->
Match(*id1));
1996BOOST_CHECK(id1->
Match(*id2));
1997BOOST_CHECK(id2->
Match(*id1));
2001BOOST_CHECK(!id1->
Match(*id2));
2002BOOST_CHECK(!id2->
Match(*id1));
2006BOOST_CHECK(!id1->
Match(*id2));
2007BOOST_CHECK(!id2->
Match(*id1));
2011BOOST_CHECK(!id1->
Match(*id2));
2012BOOST_CHECK(!id2->
Match(*id1));
2016BOOST_CHECK(id1->
Match(*id2));
2017BOOST_CHECK(id2->
Match(*id1));
2021BOOST_CHECK(!id1->
Match(*id2));
2022BOOST_CHECK(!id2->
Match(*id1));
2035BOOST_CHECK(!id1->
Match(*id2));
2036BOOST_CHECK(!id2->
Match(*id1));
2040BOOST_CHECK(!id1->
Match(*id2));
2041BOOST_CHECK(!id2->
Match(*id1));
2045BOOST_CHECK(!id1->
Match(*id2));
2046BOOST_CHECK(!id2->
Match(*id1));
2050BOOST_CHECK(!id1->
Match(*id2));
2051BOOST_CHECK(!id2->
Match(*id1));
2055BOOST_CHECK(!id1->
Match(*id2));
2056BOOST_CHECK(!id2->
Match(*id1));
2060BOOST_CHECK(!id1->
Match(*id2));
2061BOOST_CHECK(!id2->
Match(*id1));
2065BOOST_CHECK(!id1->
Match(*id2));
2066BOOST_CHECK(!id2->
Match(*id1));
2077BOOST_CHECK(id1->
Match(*id2));
2078BOOST_CHECK(id2->
Match(*id1));
2082BOOST_CHECK(id1->
Match(*id2));
2083BOOST_CHECK(id2->
Match(*id1));
2087BOOST_CHECK(!id1->
Match(*id2));
2088BOOST_CHECK(!id2->
Match(*id1));
2092BOOST_CHECK(!id1->
Match(*id2));
2093BOOST_CHECK(!id2->
Match(*id1));
2097BOOST_CHECK(!id1->
Match(*id2));
2098BOOST_CHECK(!id2->
Match(*id1));
2102BOOST_CHECK(id1->
Match(*id2));
2103BOOST_CHECK(id2->
Match(*id1));
2107BOOST_CHECK(!id1->
Match(*id2));
2108BOOST_CHECK(!id2->
Match(*id1));
2113 for(
autov0 : start_ids ) {
2114 for(
intd1 = -2; d1 <= 2; ++d1 ) {
2121BOOST_REQUIRE_EQUAL(oid1.
GetId8(), v1);
2122 for(
intd2 = -2; d2 <= 2; ++d2 ) {
2126BOOST_REQUIRE_EQUAL(oid2.
GetId8(),
v2);
2128BOOST_CHECK(id1->
Match(*id2));
2129BOOST_CHECK(id2->
Match(*id1));
2134BOOST_CHECK(!id1->
Match(*id2));
2135BOOST_CHECK(!id2->
Match(*id1));
2140BOOST_REQUIRE_EQUAL(oid2.
GetId8(),
v2);
2142BOOST_CHECK(id1->
Match(*id2));
2143BOOST_CHECK(id2->
Match(*id1));
2148BOOST_CHECK(!id1->
Match(*id2));
2149BOOST_CHECK(!id2->
Match(*id1));
2161 LOG_POST(
"Testing case preservation");
2167BOOST_CHECK_EQUAL(id1, id2);
2168BOOST_CHECK_EQUAL(id1.
AsString(),
"ref|abcdef|");
2169BOOST_CHECK_EQUAL(id2.
AsString(),
"ref|ABCDeF|");
2176BOOST_CHECK_EQUAL(id1, id2);
2179BOOST_CHECK_EQUAL(id1.
AsString(),
"ref|NC_000001|");
2180BOOST_CHECK_EQUAL(id2.
AsString(),
"ref|nc_000001|");
2184BOOST_CHECK_EQUAL(id3, id4);
2187BOOST_CHECK_EQUAL(id3.
AsString(),
"ref|nC_000001.1|");
2188BOOST_CHECK_EQUAL(id4.
AsString(),
"ref|Nc_000001.1|");
2190BOOST_CHECK(id3 != id1);
2193BOOST_CHECK_EQUAL(id1.
AsString(),
"ref|NC_000001|");
2194BOOST_CHECK_EQUAL(id2.
AsString(),
"ref|nc_000001|");
2199BOOST_CHECK_EQUAL(id1, id2);
2202BOOST_CHECK_EQUAL(id1.
AsString(),
"lcl|Test");
2203BOOST_CHECK_EQUAL(id2.
AsString(),
"lcl|test");
2207BOOST_CHECK_EQUAL(id3, id4);
2210BOOST_CHECK_EQUAL(id3.
AsString(),
"lcl|TEST");
2211BOOST_CHECK_EQUAL(id4.
AsString(),
"lcl|tEsT");
2213BOOST_CHECK_EQUAL(id3, id1);
2216BOOST_CHECK_EQUAL(id1.
AsString(),
"lcl|Test");
2217BOOST_CHECK_EQUAL(id2.
AsString(),
"lcl|test");
2222BOOST_CHECK_EQUAL(id1, id2);
2225BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|SRR");
2226BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|SRA|srr");
2230BOOST_CHECK_EQUAL(id3, id4);
2233BOOST_CHECK_EQUAL(id3.
AsString(),
"gnl|sra|SRR");
2234BOOST_CHECK_EQUAL(id4.
AsString(),
"gnl|Sra|Srr");
2236BOOST_CHECK_EQUAL(id3, id1);
2239BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|SRR");
2240BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|SRA|srr");
2245BOOST_CHECK_EQUAL(id1, id2);
2248BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|SRR000010.2");
2249BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|SRA|srr000010.2");
2253BOOST_CHECK_EQUAL(id3, id4);
2256BOOST_CHECK_EQUAL(id3.
AsString(),
"gnl|sra|SRR000011.s");
2257BOOST_CHECK_EQUAL(id4.
AsString(),
"gnl|Sra|Srr000011.S");
2259BOOST_CHECK(id3 != id1);
2262BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|SRR000010.2");
2263BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|SRA|srr000010.2");
2268BOOST_CHECK_EQUAL(id1, id2);
2271BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|1");
2272BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|Sra|1");
2276BOOST_CHECK_EQUAL(id3, id4);
2279BOOST_CHECK_EQUAL(id3.
AsString(),
"gnl|sra|2");
2280BOOST_CHECK_EQUAL(id4.
AsString(),
"gnl|Sra|2");
2282BOOST_CHECK(id3 != id1);
2285BOOST_CHECK_EQUAL(id1.
AsString(),
"gnl|SRA|1");
2286BOOST_CHECK_EQUAL(id2.
AsString(),
"gnl|Sra|1");
2292{
"lcl|123", {
""} },
2293{
"bbs|123", {
"123",
"123"} },
2294{
"bbm|123", {
"123",
"123"} },
2295{
"gim|123", {
"123",
"123"} },
2296{
"gb|U12345.1|amu12345", {
"U12345",
"AMU12345"} },
2297{
"emb|AL123456|MtBh37RV", {
"AL123456",
"MTBH37RV"} },
2298{
"pir||S16356", {
"S16356"} },
2299{
"sp|Q7CQJ0|RS22_saltY", {
"Q7CQJ0",
"RS22_SALTY"} },
2300{
"tr|Q90RT2|Q90RT2_9hiv1", {
"Q90RT2",
"Q90RT2_9HIV1"} },
2301{
"sp|Q7CQJ0.1|", {
"Q7CQJ0"} },
2302{
"pat|US|re33188|1", {
"",
"US|RE33188|1"} },
2304{
"ref|NM_000170.1|", {
"NM_000170"} },
2305{
"gnl|EcoSeq|EcoAce", {
"",
"ECOSEQ|ECOACE"} },
2306{
"gnl|Celera|cdm:10213987", {
"",
"CELERA|CDM:10213987"} },
2307{
"gnl|WGS:AAAB|CRA_x9P1GAV4nra", {
"",
"WGS:AAAB|CRA_X9P1GAV4NRA"} },
2308{
"gnl|WGS:ABCD|cont1", {
"",
"WGS:ABCD|CONT1"} },
2309{
"gi|1234", {
"",
"1234"} },
2310{
"dbj|N00068|", {
"N00068"} },
2311{
"prf||0806162C", {
"0806162C"} },
2312{
"pdb|1GAV|", {
"1GAV"} },
2313{
"pdb|1GAV|X", {
"1GAV|X"} },
2314{
"pdb|1GAV|x", {
"1GAV|x"} },
2315{
"pdb|1gav|x", {
"1GAV|x"} },
2316{
"pdb|1GAV|xyZ", {
"1GAV|xyZ"} },
2317{
"tpg|BK003456|", {
"BK003456"} },
2318{
"tpe|BN000123|", {
"BN000123"} },
2319{
"tpd|FAA00017|", {
"FAA00017"} },
2320{
"gpp|GPC_123456789.1|", {
"GPC_123456789",
"GPC_123456789.1"} },
2321{
"gpp|GPC_123456789|", {
"GPC_123456789",
"GPC_123456789.1"} },
2322{
"nat|AT_123456789.1|", {
"AT_123456789"} },
2323{
"gnl|REF_WGS:ACJF|NECHADRAFT_MRNA79537", {
"",
"REF_WGS:ACJF|NECHADRAFT_MRNA79537"} },
2324{
"gnl|TESTDB|", {
""} }
2329 stringprimary_id_ref;
2331 stringsecondary_id_ref;
2332 boolhas_secondary_ids;
2334 LOG_POST(
"Testing generation of OSLT strings");
2338primary_id_ref = it->second[0];
2339has_secondary_ids = (it->second.size() == 2);
2340 if(has_secondary_ids)
2341secondary_id_ref = it->second[1];
2342list<string> secondary_ids;
2343 stringprimary_id =
id.ComposeOSLT(&secondary_ids,
2345BOOST_CHECK_EQUAL(primary_id, primary_id_ref);
2346 size_tsecondary_ids_size = secondary_ids.size();
2347BOOST_CHECK_EQUAL((secondary_ids_size > 0), has_secondary_ids);
2348 if(secondary_ids_size && has_secondary_ids)
2349BOOST_CHECK_EQUAL(secondary_ids.front(), secondary_id_ref);
2364acc =
"CABIVQ012345678";
2381istringstream
in(
string(
"Seq-id::=pdb ")+
str);
2396 LOG_POST(
"Testing PDB equivalence");
2398 const char* str_eq[] = {
2399 "{mol\"4XNU\",chain 65,chain-id \"A\"}",
2400 "{mol\"4XNU\",chain-id \"A\"}",
2401 "{mol\"4XNU\",chain 65}",
2402 "{mol\"4XNU\",chain 65,rel std {year 2017},chain-id \"A\"}",
2403 "{mol\"4XNU\",chain 65,rel std {year 2017,month 6,day 2},chain-id \"A\"}",
2404 "{mol\"4XNU\",chain 65,rel std {year 2017,month 6,day 2,hour 12,minute 22,second 33},chain-id \"A\"}",
2406 const char* str_ne[] = {
2408 "{mol\"4XNU\",chain 66,chain-id \"A\"}",
2409 "{mol\"4XNU\",chain 65,chain-id \"B\"}",
2410 "{mol\"4XNV\",chain 65,chain-id \"A\"}",
2411 "{mol\"4XNU\",chain 65,rel std {year 2017,month 6,day 2,season\"summer\"},chain-id \"A\"}",
2412 "{mol\"4XNU\",chain 65,rel std {year 0,month 6,day 2,season\"summer\"},chain-id \"A\"}",
2413 "{mol\"4XNU\",chain 65,rel str \"02/06/2017\",chain-id \"A\"}",
2415vector<CRef<CSeq_id>> id_eq;
2416 for(
auto str: str_eq ) {
2419vector<CRef<CSeq_id>> id_ne;
2420 for(
auto str: str_ne ) {
2423vector<CSeq_id_Handle> idh_eq;
2424 for(
auto id: id_eq ) {
2427vector<CSeq_id_Handle> idh_ne;
2428 for(
auto id: id_ne ) {
2431 for(
auto& id1 : idh_eq ) {
2432 autoseq_id1 = id1.GetSeqId();
2433 for(
auto& id2 : idh_eq ) {
2434BOOST_CHECK_EQUAL(id1, id2);
2435 autoseq_id2 = id2.GetSeqId();
2436 if( &id1 == &id2 ) {
2443 for(
auto& id2 : idh_ne ) {
2444BOOST_CHECK_NE(id1, id2);
2445 autoseq_id2 = id2.GetSeqId();
2449 for(
auto& id1 : idh_ne ) {
2450 autoseq_id1 = id1.GetSeqId();
2451 for(
auto& id2 : idh_ne ) {
2452 autoseq_id2 = id2.GetSeqId();
2453 if( &id1 == &id2 ) {
2457BOOST_CHECK_NE(id1, id2);
2462 for(
size_t i= 0;
i<
size(str_eq); ++
i) {
2463BOOST_CHECK_NE(idh_eq[
i].
GetSeqId(), id_eq[
i]);
2466 for(
size_t i= 0;
i<
size(str_ne); ++
i) {
2467BOOST_CHECK_NE(idh_ne[
i].
GetSeqId(), id_ne[
i]);
2471BOOST_CHECK_EQUAL(idh_set_eq.
size(), 1u);
2474BOOST_CHECK_EQUAL(idh_set_ne.
size(),
size(idh_ne));
Thrown on an attempt to access wrong choice variant.
CSeq_id_Handle GetRandomId(bool other, bool with_version)
virtual void * Main(void)
Derived (user-created) class must provide a real thread function.
deque< CSeq_id_Handle > m_Ids
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
namespace ncbi::objects::
iterator_bool insert(const value_type &val)
iterator_bool insert(const value_type &val)
const_iterator begin() const
string GetSeqIdString(const CSeq_id &id)
std::ofstream out("events_result.xml")
main entry point for tests
static const char * str(char *buf, int n)
#define GI_FROM(T, value)
unsigned int TSeqPos
Type for sequence locations and lengths.
constexpr size_t ArraySize(const Element(&)[Size])
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Info(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
const TPrim & Get(void) const
#define MSerial_AsnText
I/O stream manipulators â.
const string AsFastaString(void) const
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
CConstRef< CSeq_id > GetSeqId(void) const
EAccessionInfo
For IdentifyAccession (below)
static CSeq_id_Handle GetGiHandle(TGi gi)
Faster way to create a handle for a gi.
int CompareOrdered(const CSeq_id &sid2) const
static SIZE_TYPE ParseFastaIds(CBioseq::TId &ids, const CTempString &s, bool allow_partial_failure=false)
Parse an entire set of |-delimited FASTA-style IDs, appending the results to IDS.
bool MatchesTo(const CSeq_id_Handle &h) const
True if *this matches to h.
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
void GetReverseMatchingHandles(TMatches &matches) const
static string GetStringDescr(const CBioseq &bioseq, EStringFormat fmt)
int CompareOrdered(const CSeq_id_Handle &id) const
Compare ids in a defined order (see CSeq_id::CompareOrdered())
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
string AsString(void) const
CSeq_id::E_Choice Which(void) const
const CTextseq_id * GetTextseq_Id(void) const
Return embedded CTextseq_id, if any.
E_SIC Compare(const CSeq_id &sid2) const
Compare() - more general.
@ fLabel_UpperCase
Upper case label, with special encoding for PDB chain-ids.
@ fLabel_Default
default options - always show the version
@ e_YES
SeqIds compared, but are different.
@ fGpipeAddSecondary
Add "ACC.VER(=1)" for a 2ndary id.
@ fParse_RawText
Try to ID raw non-numeric accessions.
@ fParse_ValidLocal
Treat otherwise unidentified strings as raw accessions, provided that they pass rudimentary validatio...
@ eFormat_BestWithoutVersion
@ eFormat_BestWithVersion
@ eContent
Untagged human-readable accession or the like.
@ eDefault
default is to show type + content
@ eBoth
Type and content, delimited by a vertical bar.
@ eType
FASTA-style type, or database in GeneralDbIsContent mode.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void SetNull(void)
Override all setters to incorporate cache invalidation.
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
void Reset(void)
Reset reference object.
int64_t Int8
8-byte (64-bit) signed integer
TValue GetRand(void)
Get the next random number in the interval [0..GetMax()] (inclusive)
NCBI_NS_STD::string::size_type SIZE_TYPE
static int StringToNonNegativeInt(const CTempString str, TStringToNumFlags flags=0)
Convert string to non-negative integer value.
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.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
CTime GetFastLocalTime(void)
Quick and dirty getter of local time.
static const char label[]
bool IsNumber(void) const
Check if variant Number is selected.
const TId & GetId(void) const
Get the Id member data.
const TNumber & GetNumber(void) const
Get the variant data.
const TCountry & GetCountry(void) const
Get the Country member data.
bool IsStr(void) const
Check if variant Str is selected.
const TTag & GetTag(void) const
Get the Tag member data.
void SetTag(TTag &value)
Assign a value to Tag data member.
bool IsId(void) const
Check if variant Id is selected.
const TDb & GetDb(void) const
Get the Db member data.
const TStr & GetStr(void) const
Get the variant data.
TStr & SetStr(void)
Select the variant.
void SetDb(const TDb &value)
Assign a value to Db data member.
TId & SetId(void)
Select the variant.
TId GetId(void) const
Get the variant data.
void SetLocation(TLocation &value)
Assign a value to Location data member.
const TRegion & GetRegion(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
bool IsPatent(void) const
Check if variant Patent is selected.
bool IsGenbank(void) const
Check if variant Genbank is selected.
TGeneral & SetGeneral(void)
Select the variant.
TChain GetChain(void) const
Get the Chain member data.
const TEmbl & GetEmbl(void) const
Get the variant data.
const TPdb & GetPdb(void) const
Get the variant data.
TGibbsq GetGibbsq(void) const
Get the variant data.
TId GetId(void) const
Get the Id member data.
bool IsSetChain_id(void) const
chain identifier; length-independent generalization of 'chain' Check if a value has been assigned to ...
bool IsSetChain(void) const
Deprecated: 'chain' can't support multiple character PDB chain identifiers (introduced in 2015).
bool IsSetAccession(void) const
Check if a value has been assigned to Accession data member.
bool IsTpg(void) const
Check if variant Tpg is selected.
const TGenbank & GetGenbank(void) const
Get the variant data.
const TName & GetName(void) const
Get the Name member data.
bool IsEmpty(void) const
Check if variant Empty is selected.
bool IsTpd(void) const
Check if variant Tpd is selected.
bool IsGibbmt(void) const
Check if variant Gibbmt is selected.
bool IsOther(void) const
Check if variant Other is selected.
const TWhole & GetWhole(void) const
Get the variant data.
bool IsGeneral(void) const
Check if variant General is selected.
bool IsPrf(void) const
Check if variant Prf is selected.
bool IsEmbl(void) const
Check if variant Embl is selected.
bool IsPdb(void) const
Check if variant Pdb is selected.
bool IsSwissprot(void) const
Check if variant Swissprot is selected.
TGi GetGi(void) const
Get the variant data.
TVersion GetVersion(void) const
Get the Version member data.
bool IsSetRelease(void) const
Check if a value has been assigned to Release data member.
const TRelease & GetRelease(void) const
Get the Release member data.
const TMol & GetMol(void) const
Get the Mol member data.
TSeqid GetSeqid(void) const
Get the Seqid member data.
const TOther & GetOther(void) const
Get the variant data.
const TGiim & GetGiim(void) const
Get the variant data.
const TSwissprot & GetSwissprot(void) const
Get the variant data.
TLocal & SetLocal(void)
Select the variant.
const TDdbj & GetDdbj(void) const
Get the variant data.
const TLocal & GetLocal(void) const
Get the variant data.
const TEmpty & GetEmpty(void) const
Get the variant data.
bool IsGiim(void) const
Check if variant Giim is selected.
bool IsLocal(void) const
Check if variant Local is selected.
const TPir & GetPir(void) const
Get the variant data.
const TChain_id & GetChain_id(void) const
Get the Chain_id member data.
bool IsGpipe(void) const
Check if variant Gpipe is selected.
const TGeneral & GetGeneral(void) const
Get the variant data.
bool IsGi(void) const
Check if variant Gi is selected.
const TPatent & GetPatent(void) const
Get the variant data.
bool IsWhole(void) const
Check if variant Whole is selected.
const TPrf & GetPrf(void) const
Get the variant data.
bool IsSetVersion(void) const
Check if a value has been assigned to Version data member.
bool IsTpe(void) const
Check if variant Tpe is selected.
bool IsNamed_annot_track(void) const
Check if variant Named_annot_track is selected.
const TCit & GetCit(void) const
Get the Cit member data.
bool IsPir(void) const
Check if variant Pir is selected.
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
bool IsGibbsq(void) const
Check if variant Gibbsq is selected.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
const TAccession & GetAccession(void) const
Get the Accession member data.
bool IsDdbj(void) const
Check if variant Ddbj is selected.
@ e_Gibbmt
Geninfo backbone moltype.
@ e_Giim
Geninfo import id.
@ e_Other
for historical reasons, 'other' = 'refseq'
@ e_Tpe
Third Party Annot/Seq EMBL.
@ e_Gibbsq
Geninfo backbone seqid.
@ e_Gi
GenInfo Integrated Database.
@ e_not_set
No variant selected.
TId & SetId(void)
Assign a value to Id data member.
list< CRef< CSeq_id > > TId
void SetInst(TInst &value)
Assign a value to Inst data member.
@ eRepr_virtual
no seq data
static void hex(unsigned char c)
static void text(MDB_val *v)
constexpr auto sort(_Init &&init)
const string version
version string
const struct ncbi::grid::netcache::search::fields::SIZE size
int strcmp(const char *str1, const char *str2)
static size_t rnd(size_t minimal, size_t maximal)
#define NCBI_CONST_INT8(v)
64-bit integers
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
std::istream & in(std::istream &in_, double &x_)
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static const TFastaOSLTMap kTestFastaOSLTMap
static void s_TestFastaRoundTrip(const char *s)
static const char *const sc_Ids[]
static CRef< CSeq_id > s_ParsePDB(const char *str)
static CSeq_id * s_NewDbtagId(const string &db, const string &tag, bool set_as_general=false)
static const char * kTestFastaStrings[]
static const size_t kNumFastaStrings
BOOST_AUTO_TEST_CASE(s_MTTest)
ostream & operator<<(ostream &out, const CSeq_id_Handle::TMatches &ids)
#define NCBI_CHECK_THROW_SEQID(s)
map< string, vector< string > > TFastaOSLTMap
void s_CheckMatches(const CSeq_id_Handle &id, const vector< CSeq_id_Handle > &ids, const CSeq_id_Handle::TMatches &matches, const CSeq_id_Handle::TMatches &exp_matches, bool strict, const char *type)
BOOST_AUTO_PARAM_TEST_CASE(s_TestFastaRoundTrip, kTestFastaStrings+0, kTestFastaStrings+kNumFastaStrings)
void s_Match_id(size_t num_ids, const char *const fasta_ids[], const char *const match_to_ids[], const char *const weak_match_to_ids[], bool strict=true)
static string s_ToASN(const C &obj)
CRef< CSeq_loc > GetRandomSegment(CRandom &rnd)
Predicate for sorting CSeq_id_Handles in a defined order.
Compare objects pointed to by (smart) pointer.
bool operator()(const CSeq_loc &a, const CSeq_loc &b) const
bool operator()(const CRef< CSeq_loc > &a, const CRef< CSeq_loc > &b) const
bool operator()(const CSeq_loc &a, const CSeq_loc &b) const
bool operator()(const CRef< CSeq_loc > &a, const CRef< CSeq_loc > &b) const
Utility stuff for more convenient using of Boost.Test library.
void g_IgnoreDataFile(const string &pattern, bool do_ignore=true)
Ignore (or stop ignoring, depending on do_ignore) NCBI application data files matching the given patt...
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