test_pin.cpp
来自「ncbi源码」· C++ 代码 · 共 1,309 行 · 第 1/3 页
CPP
1,309 行
} cout << dec << "\n"; nt.RetSequence(& buf); } if (1) { int length = nt.GetAmbigSeq(oid, & buf, kSeqDBNuclNcbiNA8); int y = (length > 16) ? 16 : length; for(int x = 0; x < y; x++) { if ((x & 3) == 0) cout << " "; if (unsigned(buf[x]) < 0x10) cout << "0"; cout << hex << (unsigned(buf[x]) & 0xFF) << " "; } cout << dec << "\n"; nt.RetSequence(& buf); } if (1) { int length = nt.GetAmbigSeq(oid, & buf, kSeqDBNuclBlastNA8); int y = (length > 16) ? 16 : length; for(int x = 0; x < y; x++) { if ((x & 3) == 0) cout << " "; if (unsigned(buf[x]) < 0x10) cout << "0"; cout << hex << (unsigned(buf[x]) & 0xFF) << " "; } cout << dec << "\n\n"; nt.RetSequence(& buf); } oid++; } return 0; } else desc += " [-memtest]"; if (s == "-getambig") { CSeqDB nt(/*dbpath,*/ "nt", 'n', 0, 0, false); Uint4 oid = 0; for(int i = 0; i<100; i++) { const char * buf(0); if (! nt.CheckOrFindOID(oid)) break; cout << "-----------------" << endl; { int length = nt.GetSequence(oid, & buf); cout << "NT OID = " << oid << ", length is " << length << endl; int y = (length > 16) ? 16 : length; for(int x = 0; x < y; x++) { if ((x & 3) == 0) cout << " "; if (unsigned(buf[x]) < 0x10) cout << "0"; cout << hex << (unsigned(buf[x]) & 0xFF) << " "; } cout << dec << "\n"; nt.RetSequence(& buf); } { int length = nt.GetAmbigSeq(oid, & buf, kSeqDBNuclNcbiNA8); int y = (length > 16) ? 16 : length; for(int x = 0; x < y; x++) { if ((x & 3) == 0) cout << " "; if (unsigned(buf[x]) < 0x10) cout << "0"; cout << hex << (unsigned(buf[x]) & 0xFF) << " "; } cout << dec << "\n"; nt.RetSequence(& buf); } { int length = nt.GetAmbigSeq(oid, & buf, kSeqDBNuclBlastNA8); int y = (length > 16) ? 16 : length; for(int x = 0; x < y; x++) { if ((x & 3) == 0) cout << " "; if (unsigned(buf[x]) < 0x10) cout << "0"; cout << hex << (unsigned(buf[x]) & 0xFF) << " "; } cout << dec << "\n\n"; nt.RetSequence(& buf); } oid++; } return 0; } else desc += " [-getambig]"; if (s == "-iter2") { { CSeqDB phil(/*dbpath,*/ "swissprot pataa", 'p'); { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<20; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; ++skywalk; } } { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<20; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; CRef<CBioseq> bioseq = phil.GetBioseq(skywalk.GetOID()); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; ++skywalk; } } } { CSeqDB phil(/*dbpath,*/ "pataa swissprot", 'p'); { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<20; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; ++skywalk; } } { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<20; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; CRef<CBioseq> bioseq = phil.GetBioseq(skywalk.GetOID()); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; ++skywalk; } } } return 0; } else desc += " [-iter2]"; if (s == "-iter") { CSeqDB phil(/*dbpath,*/ "swissprot pdb", 'p'); { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<200; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; ++skywalk; } } if (0) { for(int i = 0; i<200; i++) { cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; CRef<CBioseq> bioseq = phil.GetBioseq(i); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; } } { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<200; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; CRef<CBioseq> bioseq = phil.GetBioseq(skywalk.GetOID()); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; ++skywalk; } } if (0) { for(int i = 0; i<200; i++) { cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; } } return 0; } else desc += " [-iter]"; if (s == "-iterpdb") { CSeqDB phil(/*dbpath,*/ "pdb", 'p'); { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<200; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; ++skywalk; } } if (0) { for(int i = 0; i<100; i++) { cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; CRef<CBioseq> bioseq = phil.GetBioseq(i); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; } } return 0; } else desc += " [-iterpdb]"; if (s == "-itersp") { CSeqDB phil(/*dbpath,*/ "swissprot", 'p'); { CSeqDBIter skywalk = phil.Begin(); for(int i = 0; i<200; i++) { cout << "### Seq [" << skywalk.GetOID() << "] length = " << skywalk.GetLength() << endl; ++skywalk; } } if (0) { for(int i = 0; i<100; i++) { cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; CRef<CBioseq> bioseq = phil.GetBioseq(i); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; } } return 0; } else desc += " [-itersp]"; if (s == "-spcount") { CSeqDB phil(/*dbpath,*/ "swissprot", 'p'); double besht = 100.0; double woist = 0.0; double totul = 0.0; for(int i = 0; i<10; i++) { CSeqDBIter skywalk = phil.Begin(); double spt1 = dbl_time(); Uint8 mylen = 0; while(skywalk) { int this_oid = 0; //int this_len = 0; //mylen += (this_len = phil.GetSeqLength( this_oid = skywalk.GetOID() )); this_oid = skywalk.GetOID(); ++ skywalk; mylen ++; //cout << this_oid << " is length " << this_len << endl; } double spt2 = dbl_time(); double rezzy = spt2 - spt1; cout << "mylen " << mylen << " spt2 - spt1 = " << rezzy << endl; if (rezzy > woist) woist = rezzy; if (rezzy < besht) besht = rezzy; totul += rezzy; } totul -= (besht + woist); cout << "Average = " << (totul/8.0) << endl; return 0; } else desc += " [-spcount]"; if (s == "-swiss") { CSeqDB phil(/*dbpath,*/ "swissprot", 'p'); { Uint8 tlen = 0; Uint4 numb = 0; CSeqDBIter skywalk = phil.Begin(); { int i = 276; cout << "this_oid = " << i << " length = " << 0 << endl; cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; CRef<CBioseq> bioseq = phil.GetBioseq(i); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; } while(skywalk) { int this_oid = 0; int this_len = 0; numb ++; tlen += (this_len = phil.GetSeqLength( this_oid = skywalk.GetOID() )); ++ skywalk; cout << this_oid << endl; if (numb > 145680) { int i = this_oid; cout << "this_oid = " << this_oid << " length = " << this_len << endl; cout << "\n### Seq [" << i << "] length = " << phil.GetSeqLength(i) << "\n" << endl; CRef<CBioseq> bioseq = phil.GetBioseq(i); auto_ptr<CObjectOStream> outpstr(CObjectOStream::Open(eSerial_AsnText, cout)); *outpstr << *bioseq; } } cout << "\n### Total swissprot length [" << tlen << "] numb = " << numb << "\n" << endl; } return 0; } else desc += " [-swiss]"; if (s == "-lib") { CSeqDB phil(/*dbpath,*/ "nt nt month est", 'n'); phil.GetSeqLength(123); phil.GetSeqLengthApprox(123); phil.GetHdr(123); phil.GetBioseq(123); const char * buffer = 0; phil.GetSequence(123, & buffer); phil.RetSequence(& buffer); cout << "\nSeq type: " << phil.GetSeqType(); cout << "\nTitle: " << phil.GetTitle(); cout << "\nDate: " << phil.GetDate(); cout << "\nNumSeqs: " << phil.GetNumSeqs(); cout << "\nTotalLength: " << phil.GetTotalLength(); cout << "\nMax Length: " << phil.GetMaxLength() << endl; cout << endl; return 0; } else desc += " [-lib]"; if (s == "-summary") { CSeqDB phil(/*dbpath,*/ "month", 'n'); cout << "dbpath: " << dbpath << endl; cout << "title: " << phil.GetTitle() << endl; cout << "nseqs: " << phil.GetNumSeqs() << endl; cout << "tleng: " << phil.GetTotalLength() << endl; return 0; } else desc += " [-summary]"; // if (s == "-alias") {// string dbname = "pdb"; // if (! args.empty()) {// dbname = args.front();// args.pop_front(); // }// string ending = "pal";// if (! args.empty()) {// ending = args.front();// args.pop_front(); // } // ncbi::CSeqDBAliasNode phil(/*dbpath,*/ dbname, ending[0]); // vector<string> vols; // phil.GetVolumeNames(vols); // for(Uint4 i = 0; i<vols.size(); i++) {// cout << "[" << i << "] "// << vols[i] << endl;// } // return 0;// } else desc += " [-alias]"; if (s == "-len3") { string dbname1("nr"); string dbname2("pataa"); string dbname3(dbname1 + " " + dbname2);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?