A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/seq__id__unit__test_8cpp_source.html below:

NCBI C++ ToolKit: src/objects/seq/unit_test/seq_id_unit_test.cpp Source File

33 #define NCBI_TEST_APPLICATION 50 #include <boost/test/parameterized_test.hpp> 62 #define NCBI_CHECK_THROW_SEQID(s) BOOST_CHECK_THROW(s, CSeqIdException) 81

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 ) {

135

vector< CRef<CThread> > tt;

136  for

(

int i

= 0;

i

< 10; ++

i

) {

151  const size_t

NQ = 20;

152

vector<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

) {

194

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

" 1234 "

)));

195

BOOST_CHECK(id->

IsGi

());

196

BOOST_CHECK(id->

GetGi

() == 1234);

203

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"9876543210"

)));

204

BOOST_CHECK(id->

IsGi

());

218

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"N00068"

)));

219

BOOST_CHECK(id->

IsDdbj

());

228

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"N20001.1"

)));

247

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"bn000123"

)));

248

BOOST_CHECK(id->

IsTpe

());

253

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"FAA00017"

)));

254

BOOST_CHECK(id->

IsTpd

());

258

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"CAAA01020304"

)));

259

BOOST_CHECK(id->

IsEmbl

());

260

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"AACN011056789"

)));

261

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"ABCD1234567890"

)));

324

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"550086A"

)));

325

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"650771AF"

)));

326

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"0806162C"

)));

327

BOOST_CHECK(id->

IsPrf

());

329

BOOST_CHECK_EQUAL(id->

GetPrf

().

GetName

(),

string

(

"0806162C"

));

330

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"2015436HX"

)));

331

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1309311A:PDB=1EMD,2CMD"

)));

344

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV"

)));

345

BOOST_CHECK(id->

IsPdb

());

346

BOOST_CHECK_EQUAL(id->

GetPdb

().

GetMol

().

Get

(),

string

(

"1GAV"

));

357

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV|X"

)));

358

BOOST_CHECK(id->

IsPdb

());

359

BOOST_CHECK_EQUAL(id->

GetPdb

().

GetMol

().

Get

(),

string

(

"1GAV"

));

362

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV|XY"

)));

365

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV|XX"

)));

368

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV_!"

)));

371

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV|VB"

)));

374

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"1GAV|AAA"

)));

398

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"q7cqj0"

)));

403

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"A2ASS6.1"

)));

407

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"A0A022YWF9"

)));

424

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NM_000170.1"

)));

426

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NM_001000170"

)));

429

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"ZP_00345678"

)));

432

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NZ_CH959311.1"

)));

436

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NZ_AABC03000051"

)));

437

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NZ_ABJB030000051"

)));

438

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"NZ_ABJB0300000510"

)));

448

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"GPC_123456789.1"

)));

460

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"AT_123456789.1"

)));

471

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|0"

)));

476

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|123"

)));

481

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|0123"

)));

486

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|-123"

)));

491

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|asdf"

)));

494

BOOST_CHECK_EQUAL(id->

GetLocal

().

GetStr

(),

string

(

"asdf"

));

496

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"lcl|NM_002020|"

)));

499

BOOST_CHECK_EQUAL(id->

GetLocal

().

GetStr

(),

string

(

"NM_002020"

));

507

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"bbs|123"

)));

509

BOOST_CHECK_EQUAL(id->

GetGibbsq

(), 123);

511

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"bbs|0"

)));

517

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"bbm|123"

)));

520

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"gim|123"

)));

521

BOOST_CHECK(id->

IsGiim

());

530

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"gb|U12345.1|AMU12345"

)));

542

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"emb|AL123456|MTBH37RV"

)));

543

BOOST_CHECK(id->

IsEmbl

());

545

BOOST_CHECK_EQUAL(id->

GetEmbl

().

GetName

(),

string

(

"MTBH37RV"

));

554

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pir||S16356"

)));

555

BOOST_CHECK(id->

IsPir

());

557

BOOST_CHECK_EQUAL(id->

GetPir

().

GetName

(),

string

(

"S16356"

));

566

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"sp|Q7CQJ0|RS22_SALTY"

)));

573

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"tr|Q90RT2|Q90RT2_9HIV1"

)));

576

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"sp|Q7CQJ0.1"

)));

586

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pat|US|RE33188|1"

)));

592  string

(

"RE33188"

));

612  "US"

,

"RE33188"

, 1)));

614  string

(

"RE33188"

));

628

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"ref|NM_000170.1"

)));

635

BOOST_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=?"

));

655

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"gnl|taxon|9606"

)));

666

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"gi|1234"

)));

667

BOOST_CHECK(id->

IsGi

());

668

BOOST_CHECK_EQUAL(id->

GetGi

(), 1234);

675

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"dbj|N00068"

)));

676

BOOST_CHECK(id->

IsDdbj

());

684

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"prf||0806162C"

)));

685

BOOST_CHECK(id->

IsPrf

());

692

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV"

)));

693

BOOST_CHECK(id->

IsPdb

());

694

BOOST_CHECK_EQUAL(id->

GetPdb

().

GetMol

().

Get

(),

string

(

"1GAV"

));

698

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|X"

)));

699

BOOST_CHECK(id->

IsPdb

());

700

BOOST_CHECK_EQUAL(id->

GetPdb

().

GetMol

().

Get

(),

string

(

"1GAV"

));

704

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|XY"

)));

707

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|XX"

)));

710

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|!"

)));

713

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|VB"

)));

716

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"pdb|1GAV|AAA"

)));

725

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"tpg|BK003456"

)));

726

BOOST_CHECK(id->

IsTpg

());

727

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"tpe|BN000123"

)));

728

BOOST_CHECK(id->

IsTpe

());

729

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"tpd|FAA00017"

)));

730

BOOST_CHECK(id->

IsTpd

());

736

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"gpp|GPC_123456789"

)));

743

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(

"nat|AT_123456789"

)));

749  bool

set_as_general =

false

)

754  return new CSeq_id

(dbtag, set_as_general);

758  bool

set_as_general =

false

)

763  return new CSeq_id

(dbtag, set_as_general);

778

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"EMBL"

,

"AL123456.7"

)));

779

BOOST_CHECK(id->

IsEmbl

());

790

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"DDBJ"

,

"N00068"

)));

791

BOOST_CHECK(id->

IsDdbj

());

794

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"GI"

,

"12345"

,

true

)));

799

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"GI"

, 12345,

true

)));

805

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"taxon"

, 9606,

true

)));

809

BOOST_CHECK_NO_THROW(

id

.Reset(

s_NewDbtagId

(

"TRACE_ASSM"

,

"992"

,

true

)));

818

BOOST_CHECK(id->

IsGi

());

819

BOOST_CHECK_EQUAL(id->

GetGi

(), 1234);

834

BOOST_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=?" 884

BOOST_TEST_MESSAGE(

string

(

"Testing round trip for "

) << s);

885

BOOST_CHECK_NO_THROW(

id

.Reset(

new CSeq_id

(s)));

891

BOOST_REQUIRE_EQUAL(ids.size(), 1u);

892

BOOST_CHECK_EQUAL(ids.front()->AsFastaString(), s);

893

BOOST_CHECK(ids.front()->Equals(*

id

));

894

BOOST_CHECK(id->

Match

(*

id

));

898

pos !=

NPOS

&& (s[pos] ==

'|'

|| s[pos] ==

' '

);

902

BOOST_TEST_MESSAGE(

"Testing equality with "

<< ss);

905

BOOST_CHECK(id->

Match

(*id2));

916

BOOST_CHECK_NO_THROW(

id

.SetGiim().SetDb(

"foo"

));

917

BOOST_CHECK_NO_THROW(

id

.SetGiim().SetRelease(

"2.0"

));

918

BOOST_CHECK(

id

.IsGiim());

919

BOOST_CHECK(

id

.GetGiim().IsSetDb());

920

BOOST_CHECK(

id

.GetGiim().IsSetRelease());

921

BOOST_CHECK_NO_THROW(

id

.Set(

"gim|123"

));

922

BOOST_CHECK(

id

.IsGiim());

923

BOOST_CHECK( !

id

.GetGiim().IsSetDb() );

924

BOOST_CHECK( !

id

.GetGiim().IsSetRelease() );

926

BOOST_CHECK_NO_THROW(

id

.SetGenbank().SetRelease(

"135"

));

927

BOOST_CHECK(

id

.IsGenbank());

928

BOOST_CHECK(

id

.GetGenbank().IsSetRelease());

929

BOOST_CHECK_NO_THROW(

id

.Set(

"gb|U12345.1|AMU12345"

));

930

BOOST_CHECK(

id

.IsGenbank());

931

BOOST_CHECK( !

id

.GetGenbank().IsSetRelease() );

933

BOOST_CHECK_NO_THROW(

id

.SetPatent().SetCit().SetDoc_type(

"app"

));

934

BOOST_CHECK(

id

.IsPatent());

935

BOOST_CHECK(

id

.GetPatent().GetCit().IsSetDoc_type());

936

BOOST_CHECK_NO_THROW(

id

.Set(

"pat|US|RE33188|1"

));

937

BOOST_CHECK(

id

.IsPatent());

938

BOOST_CHECK( !

id

.GetPatent().GetCit().IsSetDoc_type() );

940

BOOST_CHECK_NO_THROW(

id

.SetPdb().SetRel().SetToTime(

GetFastLocalTime

()));

941

BOOST_CHECK(

id

.IsPdb());

942

BOOST_CHECK(

id

.GetPdb().IsSetRel());

943

BOOST_CHECK_NO_THROW(

id

.Set(

"pdb|1GAV|X"

));

944

BOOST_CHECK(

id

.IsPdb());

945

BOOST_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"

));

990

mix1->

SetMix

().Set().push_back(loc1);

996

mix2->

SetMix

().Set().push_back(loc2);

998

BOOST_CHECK(loc1->

IsWhole

());

1002

BOOST_CHECK(loc2->

IsEmpty

());

1006

BOOST_CHECK(loc1->

GetId

());

1008

BOOST_CHECK_EQUAL(loc1->

GetId

()->

GetGi

(), 1);

1010

BOOST_CHECK(loc2->

GetId

());

1012

BOOST_CHECK_EQUAL(loc2->

GetId

()->

GetGi

(), 2);

1019

BOOST_CHECK(loc1->

IsEmpty

());

1023

BOOST_CHECK(loc2->

IsEmpty

());

1027

BOOST_CHECK(loc1->

GetId

());

1029

BOOST_CHECK_EQUAL(loc1->

GetId

()->

GetGi

(), 2);

1031

BOOST_CHECK(loc2->

GetId

());

1033

BOOST_CHECK_EQUAL(loc2->

GetId

()->

GetGi

(), 2);

1040

feat1->

SetData

().SetRegion(

"1"

);

1047

feat2->

SetData

().SetRegion(

"2"

);

1050

BOOST_CHECK(loc1->

IsWhole

());

1054

BOOST_CHECK(loc2->

IsEmpty

());

1058

BOOST_CHECK(loc1->

GetId

());

1060

BOOST_CHECK_EQUAL(loc1->

GetId

()->

GetGi

(), 1);

1062

BOOST_CHECK(loc2->

GetId

());

1064

BOOST_CHECK_EQUAL(loc2->

GetId

()->

GetGi

(), 2);

1074

BOOST_CHECK(loc1->

IsEmpty

());

1078

BOOST_CHECK(loc2->

IsEmpty

());

1082

BOOST_CHECK(loc1->

GetId

());

1084

BOOST_CHECK_EQUAL(loc1->

GetId

()->

GetGi

(), 2);

1086

BOOST_CHECK(loc2->

GetId

());

1088

BOOST_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);

1174

BOOST_CHECK_EQUAL(s,

type

);

1179

BOOST_CHECK_EQUAL(s, content);

1184

BOOST_CHECK_EQUAL(s, both);

1186  LOG_POST

(

Info

<<

" fasta string: "

<<

id

.AsFastaString());

1187

BOOST_CHECK_EQUAL(

id

.AsFastaString(), fasta_str);

1199

BOOST_CHECK_EQUAL(s, upper_case);

1208  static const char

*

sc_Ids

=

"\ 1212 Seq-id ::= patent {\ 1216  id number \"2003530853\"\ 1234

BOOST_CHECK_EQUAL(

label

, fasta_seqid);

1237

BOOST_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() ) {

1344

BOOST_CHECK_EQUAL(ids[

i

]->AsFastaString(),

sc_Ids

[

i

]);

1345  if

( ids[

i

]->GetLocal().IsId() ) {

1346  int id

= ids[

i

]->GetLocal().GetId();

1347

BOOST_CHECK(

id

> 0);

1350

BOOST_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() ) {

1360

BOOST_CHECK_EQUAL(ids[

i

]->AsFastaString(),

sc_Ids

[

i

]);

1361  if

( ids[

i

]->GetGeneral().GetTag().IsId() ) {

1362  int id

= ids[

i

]->GetGeneral().GetTag().GetId();

1363

BOOST_CHECK(

id

> 0);

1366

BOOST_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)]);

1380

vector<TRef> sorted_ids = ids;

1381

stable_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

) {

1389

BOOST_CHECK_EQUAL(sorted_ids[

i

]->CompareOrdered(*sorted_ids[

i

]), 0);

1390  for

(

size_t

j = 0; j <

i

; ++j ) {

1391

BOOST_CHECK(sorted_ids[j]->CompareOrdered(*sorted_ids[

i

]) <= 0);

1392

BOOST_CHECK(sorted_ids[

i

]->CompareOrdered(*sorted_ids[j]) >= 0);

1396

BOOST_CHECK_EQUAL(sorted_ids[

i

]->AsFastaString(),

1398

BOOST_CHECK_EQUAL(sorted_ids[

i

]->AsFastaString(),

""

);

1402

TSet ids_set(ids.begin(), ids.end());

1403

BOOST_CHECK(ids_set.size() < sorted_ids.size());

1404  ITERATE

( TSet, it, ids_set ) {

1406

BOOST_CHECK_EQUAL((*it)->CompareOrdered(**it), 0);

1407  ITERATE

( TSet, it2, ids_set ) {

1411

BOOST_CHECK((*it2)->CompareOrdered(**it) < 0);

1412

BOOST_CHECK((*it)->CompareOrdered(**it2) > 0);

1422

vector<CSeq_id_Handle> sorted_idhs;

1423  for

(

auto

&

i

: sorted_ids ) {

1426  for

(

size_t i

= 0;

i

< sorted_idhs.size(); ++

i

) {

1427

BOOST_CHECK_EQUAL(sorted_idhs[

i

].CompareOrdered(sorted_idhs[

i

]), 0);

1428  for

(

size_t

j = 0; j <

i

; ++j ) {

1430

BOOST_CHECK_LE(sorted_idhs[j].CompareOrdered(sorted_idhs[

i

]), 0);

1431

BOOST_CHECK_GE(sorted_idhs[

i

].CompareOrdered(sorted_idhs[j]), 0);

1434

sorted_idhs.clear();

1435  for

(

auto

&

i

: ids ) {

1441  for

(

auto

&

id

: sorted_idhs ) {

1445

BOOST_REQUIRE_EQUAL(sorted_ids.size(), sorted_idhs.size());

1446  for

(

size_t i

= 0;

i

< sorted_idhs.size(); ++

i

) {

1450  for

(

size_t

j = 0; j <

i

; ++j ) {

1457  for

(

size_t i

= 0;

i

< sorted_idhs.size(); ++

i

) {

1458

BOOST_CHECK_EQUAL(sorted_idhs[

i

].CompareOrdered(sorted_idhs[

i

]), 0);

1459  for

(

size_t

j = 0; j <

i

; ++j ) {

1460

BOOST_CHECK(sorted_idhs[j].CompareOrdered(sorted_idhs[

i

]) <= 0);

1461

BOOST_CHECK(sorted_idhs[

i

].CompareOrdered(sorted_idhs[j]) >= 0);

1479  if

(

rnd

.GetRand(0, 10) == 0 ) {

1486  if

( from == to &&

rnd

.GetRand(0, 1) ) {

1487

loc->

SetPnt

().SetId(*

id

);

1488

loc->

SetPnt

().SetPoint(from);

1489  if

(

rnd

.GetRand(0, 1) ) {

1494

loc->

SetInt

().SetId(*

id

);

1495  if

( from > to || (from == to &&

rnd

.GetRand(0, 1)) ) {

1499

loc->

SetInt

().SetFrom(from);

1500

loc->

SetInt

().SetTo(to);

1508  if

( 0 && (

a

.IsNull() ||

b

.IsNull()) ) {

1513  if

( 0 && (

a

.IsNull() ||

b

.IsNull()) ) {

1514

cout <<

" = "

<< diff << endl;

1521  return

(*

this

)(*

a

, *

b

);

1527  if

(0 && (

a

.IsNull() ||

b

.IsNull())) {

1532  if

(0 && (

a

.IsNull() ||

b

.IsNull())) {

1533

cout <<

" = "

<< diff << endl;

1540  return

(*

this

)(*

a

, *

b

);

1549  for

(

int t

= 0;

t

< 1000; ++

t

) {

1550

vector< CRef<CSeq_loc> > locs;

1551  for

(

int i

= 0;

i

< 10; ++

i

) {

1552  size_t

segs =

rnd

.GetRand(1, 10);

1554  if

( segs == 1 &&

rnd

.GetRand(0, 1) ) {

1558  for

(

size_t

j = 0; j < segs; ++j ) {

1562

locs.push_back(loc);

1565  for

(

size_t i

= 0;

i

< locs.size(); ++

i

) {

1572  for

(

size_t

j = 0; j <

i

; ++j ) {

1587  for

(

size_t i

= 0;

i

< locs.size(); ++

i

) {

1594  for

(

size_t

j = 0; j <

i

; ++j) {

1615  if

( it != ids.

begin

() ) {

1626  ITERATE

( vector<CSeq_id_Handle>, it, ids ) {

1627  if

( it != ids.begin() ) {

1637  const

vector<CSeq_id_Handle>& ids,

1645

good_matches = matches == exp_matches;

1648

good_matches =

true

;

1650  if

( !matches.count(*it) ) {

1651

good_matches =

false

;

1656  if

( !exp_matches.count(*it) &&

1657  count

(ids.begin(), ids.end(), *it) ) {

1658

good_matches =

false

;

1663  if

( !good_matches ) {

1669

BOOST_CHECK(good_matches);

1674  const char

*

const

fasta_ids[],

1675  const char

*

const

match_to_ids[],

1676  const char

*

const

weak_match_to_ids[],

1677  bool

strict =

true

)

1680  for

(

size_t

xi = 0; xi < num_ids; ++xi ) {

1683  for

(

size_t

xi = 0; xi <= num_ids; ++xi ) {

1685

vector<CSeq_id_Handle> ids;

1690  for

(

size_t i

= 0;

i

< num_ids; ++

i

) {

1694

strs.

insert

(fasta_ids[

i

]);

1696

ids.push_back(

id

);

1698  for

(

size_t i

= 0;

i

< num_ids; ++

i

) {

1705  ITERATE

( vector<string>, it, ids ) {

1706  if

( !strs.count(*it) ) {

1710

match_to_map[id].

insert

(match_to_id);

1711

matching_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) ) {

1726

weak_match_to_map[id].

insert

(match_to_id);

1727

weak_matching_map[match_to_id].

insert

(

id

);

1730  for

(

size_t i

= 0;

i

< ids.size(); ++

i

) {

1732

ids[

i

].GetMatchingHandles(matches);

1734

exp_matches.

insert

(ids[

i

]);

1737

BOOST_CHECK(ids[

i

].MatchesTo(*it));

1739  for

(

size_t

j = 0; j < ids.size(); ++j ) {

1740  if

( j == xi || matches.count(ids[j]) ) {

1743

BOOST_CHECK(!ids[

i

].MatchesTo(ids[j]));

1746  for

(

size_t i

= 0;

i

< ids.size(); ++

i

) {

1748

ids[

i

].GetReverseMatchingHandles(matches);

1750

exp_matches.

insert

(ids[

i

]);

1753

BOOST_CHECK(it->MatchesTo(ids[

i

]));

1756  for

(

size_t i

= 0;

i

< ids.size(); ++

i

) {

1760

exp_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())

1771

BOOST_CHECK(ids[

i

].MatchesTo(id2));

1774  for

(

size_t i

= 0;

i

< ids.size(); ++

i

) {

1778

exp_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

*

const

fasta_ids[] = {

1805  const char

*

const

match_to_ids[] = {

1813  const char

*

const

weak_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"

,

1822

fasta_ids, match_to_ids, weak_match_to_ids);

1828  const char

*

const

fasta_ids[] = {

1842  const char

*

const

match_to_ids[] = {

1856  const char

*

const

weak_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"

,

1871

fasta_ids, match_to_ids, weak_match_to_ids);

1877  const char

*

const

fasta_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

*

const

match_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

*

const

weak_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"

,

1950

fasta_ids, match_to_ids, weak_match_to_ids,

false

);

1955  string

acc =

"HP56600"

;

1956  for

(

int i

= 0;

i

< 10; ++

i

) {

1958

cout << acc <<

" -> "

<<

type

<<

" = 0x"

<<

hex

<<

type

<< dec << endl;

1959

acc.erase(acc.size()-1);

1963  for

(

int i

= 0;

i

< 10; ++

i

) {

1965

cout << acc <<

" -> "

<<

type

<<

" = 0x"

<<

hex

<<

type

<< dec << endl;

1966

acc.erase(acc.size()-1);

1970  for

(

int i

= 0;

i

< 10; ++

i

) {

1972

cout << acc <<

" -> "

<<

type

<<

" = 0x"

<<

hex

<<

type

<< dec << endl;

1973

acc.erase(acc.size()-1);

1981  LOG_POST

(

"Matching local int<>str ids"

);

1991

BOOST_CHECK(id1->

Match

(*id2));

1992

BOOST_CHECK(id2->

Match

(*id1));

1996

BOOST_CHECK(id1->

Match

(*id2));

1997

BOOST_CHECK(id2->

Match

(*id1));

2001

BOOST_CHECK(!id1->

Match

(*id2));

2002

BOOST_CHECK(!id2->

Match

(*id1));

2006

BOOST_CHECK(!id1->

Match

(*id2));

2007

BOOST_CHECK(!id2->

Match

(*id1));

2011

BOOST_CHECK(!id1->

Match

(*id2));

2012

BOOST_CHECK(!id2->

Match

(*id1));

2016

BOOST_CHECK(id1->

Match

(*id2));

2017

BOOST_CHECK(id2->

Match

(*id1));

2021

BOOST_CHECK(!id1->

Match

(*id2));

2022

BOOST_CHECK(!id2->

Match

(*id1));

2035

BOOST_CHECK(!id1->

Match

(*id2));

2036

BOOST_CHECK(!id2->

Match

(*id1));

2040

BOOST_CHECK(!id1->

Match

(*id2));

2041

BOOST_CHECK(!id2->

Match

(*id1));

2045

BOOST_CHECK(!id1->

Match

(*id2));

2046

BOOST_CHECK(!id2->

Match

(*id1));

2050

BOOST_CHECK(!id1->

Match

(*id2));

2051

BOOST_CHECK(!id2->

Match

(*id1));

2055

BOOST_CHECK(!id1->

Match

(*id2));

2056

BOOST_CHECK(!id2->

Match

(*id1));

2060

BOOST_CHECK(!id1->

Match

(*id2));

2061

BOOST_CHECK(!id2->

Match

(*id1));

2065

BOOST_CHECK(!id1->

Match

(*id2));

2066

BOOST_CHECK(!id2->

Match

(*id1));

2077

BOOST_CHECK(id1->

Match

(*id2));

2078

BOOST_CHECK(id2->

Match

(*id1));

2082

BOOST_CHECK(id1->

Match

(*id2));

2083

BOOST_CHECK(id2->

Match

(*id1));

2087

BOOST_CHECK(!id1->

Match

(*id2));

2088

BOOST_CHECK(!id2->

Match

(*id1));

2092

BOOST_CHECK(!id1->

Match

(*id2));

2093

BOOST_CHECK(!id2->

Match

(*id1));

2097

BOOST_CHECK(!id1->

Match

(*id2));

2098

BOOST_CHECK(!id2->

Match

(*id1));

2102

BOOST_CHECK(id1->

Match

(*id2));

2103

BOOST_CHECK(id2->

Match

(*id1));

2107

BOOST_CHECK(!id1->

Match

(*id2));

2108

BOOST_CHECK(!id2->

Match

(*id1));

2113  for

(

auto

v0 : start_ids ) {

2114  for

(

int

d1 = -2; d1 <= 2; ++d1 ) {

2121

BOOST_REQUIRE_EQUAL(oid1.

GetId8

(), v1);

2122  for

(

int

d2 = -2; d2 <= 2; ++d2 ) {

2126

BOOST_REQUIRE_EQUAL(oid2.

GetId8

(),

v2

);

2128

BOOST_CHECK(id1->

Match

(*id2));

2129

BOOST_CHECK(id2->

Match

(*id1));

2134

BOOST_CHECK(!id1->

Match

(*id2));

2135

BOOST_CHECK(!id2->

Match

(*id1));

2140

BOOST_REQUIRE_EQUAL(oid2.

GetId8

(),

v2

);

2142

BOOST_CHECK(id1->

Match

(*id2));

2143

BOOST_CHECK(id2->

Match

(*id1));

2148

BOOST_CHECK(!id1->

Match

(*id2));

2149

BOOST_CHECK(!id2->

Match

(*id1));

2161  LOG_POST

(

"Testing case preservation"

);

2167

BOOST_CHECK_EQUAL(id1, id2);

2168

BOOST_CHECK_EQUAL(id1.

AsString

(),

"ref|abcdef|"

);

2169

BOOST_CHECK_EQUAL(id2.

AsString

(),

"ref|ABCDeF|"

);

2176

BOOST_CHECK_EQUAL(id1, id2);

2179

BOOST_CHECK_EQUAL(id1.

AsString

(),

"ref|NC_000001|"

);

2180

BOOST_CHECK_EQUAL(id2.

AsString

(),

"ref|nc_000001|"

);

2184

BOOST_CHECK_EQUAL(id3, id4);

2187

BOOST_CHECK_EQUAL(id3.

AsString

(),

"ref|nC_000001.1|"

);

2188

BOOST_CHECK_EQUAL(id4.

AsString

(),

"ref|Nc_000001.1|"

);

2190

BOOST_CHECK(id3 != id1);

2193

BOOST_CHECK_EQUAL(id1.

AsString

(),

"ref|NC_000001|"

);

2194

BOOST_CHECK_EQUAL(id2.

AsString

(),

"ref|nc_000001|"

);

2199

BOOST_CHECK_EQUAL(id1, id2);

2202

BOOST_CHECK_EQUAL(id1.

AsString

(),

"lcl|Test"

);

2203

BOOST_CHECK_EQUAL(id2.

AsString

(),

"lcl|test"

);

2207

BOOST_CHECK_EQUAL(id3, id4);

2210

BOOST_CHECK_EQUAL(id3.

AsString

(),

"lcl|TEST"

);

2211

BOOST_CHECK_EQUAL(id4.

AsString

(),

"lcl|tEsT"

);

2213

BOOST_CHECK_EQUAL(id3, id1);

2216

BOOST_CHECK_EQUAL(id1.

AsString

(),

"lcl|Test"

);

2217

BOOST_CHECK_EQUAL(id2.

AsString

(),

"lcl|test"

);

2222

BOOST_CHECK_EQUAL(id1, id2);

2225

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|SRR"

);

2226

BOOST_CHECK_EQUAL(id2.

AsString

(),

"gnl|SRA|srr"

);

2230

BOOST_CHECK_EQUAL(id3, id4);

2233

BOOST_CHECK_EQUAL(id3.

AsString

(),

"gnl|sra|SRR"

);

2234

BOOST_CHECK_EQUAL(id4.

AsString

(),

"gnl|Sra|Srr"

);

2236

BOOST_CHECK_EQUAL(id3, id1);

2239

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|SRR"

);

2240

BOOST_CHECK_EQUAL(id2.

AsString

(),

"gnl|SRA|srr"

);

2245

BOOST_CHECK_EQUAL(id1, id2);

2248

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|SRR000010.2"

);

2249

BOOST_CHECK_EQUAL(id2.

AsString

(),

"gnl|SRA|srr000010.2"

);

2253

BOOST_CHECK_EQUAL(id3, id4);

2256

BOOST_CHECK_EQUAL(id3.

AsString

(),

"gnl|sra|SRR000011.s"

);

2257

BOOST_CHECK_EQUAL(id4.

AsString

(),

"gnl|Sra|Srr000011.S"

);

2259

BOOST_CHECK(id3 != id1);

2262

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|SRR000010.2"

);

2263

BOOST_CHECK_EQUAL(id2.

AsString

(),

"gnl|SRA|srr000010.2"

);

2268

BOOST_CHECK_EQUAL(id1, id2);

2271

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|1"

);

2272

BOOST_CHECK_EQUAL(id2.

AsString

(),

"gnl|Sra|1"

);

2276

BOOST_CHECK_EQUAL(id3, id4);

2279

BOOST_CHECK_EQUAL(id3.

AsString

(),

"gnl|sra|2"

);

2280

BOOST_CHECK_EQUAL(id4.

AsString

(),

"gnl|Sra|2"

);

2282

BOOST_CHECK(id3 != id1);

2285

BOOST_CHECK_EQUAL(id1.

AsString

(),

"gnl|SRA|1"

);

2286

BOOST_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  string

primary_id_ref;

2331  string

secondary_id_ref;

2332  bool

has_secondary_ids;

2334  LOG_POST

(

"Testing generation of OSLT strings"

);

2338

primary_id_ref = it->second[0];

2339

has_secondary_ids = (it->second.size() == 2);

2340  if

(has_secondary_ids)

2341

secondary_id_ref = it->second[1];

2342

list<string> secondary_ids;

2343  string

primary_id =

id

.ComposeOSLT(&secondary_ids,

2345

BOOST_CHECK_EQUAL(primary_id, primary_id_ref);

2346  size_t

secondary_ids_size = secondary_ids.size();

2347

BOOST_CHECK_EQUAL((secondary_ids_size > 0), has_secondary_ids);

2348  if

(secondary_ids_size && has_secondary_ids)

2349

BOOST_CHECK_EQUAL(secondary_ids.front(), secondary_id_ref);

2364

acc =

"CABIVQ012345678"

;

2381

istringstream

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\"}"

,

2415

vector<CRef<CSeq_id>> id_eq;

2416  for

(

auto str

: str_eq ) {

2419

vector<CRef<CSeq_id>> id_ne;

2420  for

(

auto str

: str_ne ) {

2423

vector<CSeq_id_Handle> idh_eq;

2424  for

(

auto id

: id_eq ) {

2427

vector<CSeq_id_Handle> idh_ne;

2428  for

(

auto id

: id_ne ) {

2431  for

(

auto

& id1 : idh_eq ) {

2432  auto

seq_id1 = id1.GetSeqId();

2433  for

(

auto

& id2 : idh_eq ) {

2434

BOOST_CHECK_EQUAL(id1, id2);

2435  auto

seq_id2 = id2.GetSeqId();

2436  if

( &id1 == &id2 ) {

2443  for

(

auto

& id2 : idh_ne ) {

2444

BOOST_CHECK_NE(id1, id2);

2445  auto

seq_id2 = id2.GetSeqId();

2449  for

(

auto

& id1 : idh_ne ) {

2450  auto

seq_id1 = id1.GetSeqId();

2451  for

(

auto

& id2 : idh_ne ) {

2452  auto

seq_id2 = id2.GetSeqId();

2453  if

( &id1 == &id2 ) {

2457

BOOST_CHECK_NE(id1, id2);

2462  for

(

size_t i

= 0;

i

<

size

(str_eq); ++

i

) {

2463

BOOST_CHECK_NE(idh_eq[

i

].

GetSeqId

(), id_eq[

i

]);

2466  for

(

size_t i

= 0;

i

<

size

(str_ne); ++

i

) {

2467

BOOST_CHECK_NE(idh_ne[

i

].

GetSeqId

(), id_ne[

i

]);

2471

BOOST_CHECK_EQUAL(idh_set_eq.

size

(), 1u);

2474

BOOST_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