52 #include "../local_blastdb_adapter.hpp"
66 #define NCBI_BOOST_NO_AUTO_TEST_MAIN
83 BOOST_REQUIRE_EQUAL(
"BLASTDB_ntNucleotide", loader_name);
123 reference_L.push_back(556);
127 reference_L.push_back(437);
131 reference_L.push_back(1512);
135 reference_L.push_back(2367);
139 reference_L.push_back(540);
143 reference_L.push_back(1759);
147 reference_L.push_back(1758);
151 reference_L.push_back(1758);
155 reference_L.push_back(422);
159 reference_L.push_back(410);
163 BOOST_REQUIRE_EQUAL(idhs.size(), reference_L.size());
164 BOOST_REQUIRE_EQUAL(idhs.size(), reference_T.size());
165 BOOST_REQUIRE_EQUAL(idhs.size(), reference_TI.size());
171 BOOST_REQUIRE_EQUAL(idhs.size(), test_L.size());
172 BOOST_REQUIRE_EQUAL(idhs.size(), test_T.size());
173 BOOST_REQUIRE_EQUAL(idhs.size(), test_TI.size());
175 BOOST_CHECK_EQUAL_COLLECTIONS(test_L.begin(), test_L.end(),
176 reference_L.begin(), reference_L.end());
177 BOOST_CHECK_EQUAL_COLLECTIONS(test_TI.begin(), test_TI.end(),
178 reference_TI.begin(), reference_TI.end());
179 BOOST_CHECK_EQUAL_COLLECTIONS(test_T.begin(), test_T.end(),
180 reference_T.begin(), reference_T.end());
186 string dbname(
"refseq_genomic");
190 BOOST_REQUIRE_EQUAL(
"BLASTDB_refseq_genomicNucleotide", loader_name);
198 BOOST_REQUIRE(handle1);
216 BOOST_REQUIRE_EQUAL(
"BLASTDB_nrProtein", loader_name);
224 BOOST_REQUIRE(handle1);
234 BOOST_REQUIRE(!handle2);
240 BOOST_REQUIRE(handle3);
247 if((*iter)->IsTitle()) {
248 defline += (*iter)->GetTitle();
253 BOOST_REQUIRE(defline.find(
"metal ABC transporter") == 0);
265 BOOST_REQUIRE_EQUAL(
"BLASTDB_nrProtein", loader_name);
271 const size_t kExpectedLength(536);
274 CSeq_id seqid1(
"NP_001308920");
276 BOOST_REQUIRE(handle1);
278 BOOST_CHECK_EQUAL(kExpectedTaxid, scope.
GetTaxId(seqid1));
282 BOOST_REQUIRE(bioseq1.
NotNull());
284 BOOST_CHECK_EQUAL(kExpectedTaxid, bioseq1->
GetTaxId());
286 CSeq_id monkey_id(
"XP_001165763");
288 BOOST_REQUIRE(monkey_handle);
308 for(
int i=0;
i < 100;
i++) {
311 TSeqPos from =
r.GetRand(0, length_0 -100);
312 TSeqPos to =
r.GetRand(from, length_0);
316 TSeqPos from =
r.GetRand(0, length_1 -100);
317 TSeqPos to =
r.GetRand(from, length_1);
330 string dbname(
"data/testdb");
331 typedef vector< CRef<CLocalAdapterThread> > TTesterThreads;
332 const TSeqPos kNumThreads = 48;
333 TTesterThreads the_threads(kNumThreads);
338 BOOST_REQUIRE(the_threads[
i].NotEmpty());
347 (*thread)->Join(
reinterpret_cast<void**
>(&
result));
348 BOOST_REQUIRE_EQUAL(0L,
result);
352 the_threads[
i].Reset();
361 string dbname(
"data/testdb");
362 const string s1(
"GTTTTCAATAAT");
363 const string s2(
"ACCGTTTCACAAGTAGGGCGTAGCGCATTTGCAG");
364 const string s3(
"AATTGGCTGTTTTTGAACTACTGTA");
365 const string s4(
"AGATTAATTATCATTTGCAG");
374 BOOST_REQUIRE_EQUAL(t1, s1);
382 BOOST_REQUIRE_EQUAL(t2, s2);
389 BOOST_REQUIRE_EQUAL(t3, s3);
396 BOOST_REQUIRE_EQUAL(t4, s4);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Data loader implementation that uses the blast databases.
TTaxId GetTaxId() const
Determine the tax-id for this bioseq.
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, const string &dbname="nr", const EDbType dbtype=eUnknown, bool use_fixed_size_slices=true, CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
@ eNucleotide
nucleotide database
@ eProtein
protein database
virtual void * Main()
Derived (user-created) class must provide a real thread function.
CLocalAdapterThread(CRef< CSeqDB > seq_db)
This class allows retrieval of sequence data from locally installed BLAST databases via CSeqDB.
virtual int GetSeqLength(int oid)
@inheritDoc
virtual CRef< CSeq_data > GetSequence(int oid, int begin=0, int end=0)
@inheritDoc
static SIZE_TYPE Convert(const CTempString &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst, TCoding dst_coding)
unsigned int TSeqPos
Type for sequence locations and lengths.
#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.
SStrictId_Tax::TId TTaxId
Taxon id type.
const TPrim & Get(void) const
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
TLoader * GetLoader(void) const
Get pointer to the loader.
void AddDataLoader(const string &loader_name, TPriority pri=kPriority_Default)
Add data loader by name.
vector< TTaxId > TTaxIds
Get taxonomy ids of sequences Return -1 for sequences that aren't found Return 0 for sequences that d...
vector< TSeqPos > TSequenceLengths
Get lengths of sequences Return kInvalidSeqPos for sequences that aren't found.
TTaxId GetTaxId(const CSeq_id &id, TGetFlags flags=0)
Get taxonomy id of bioseq Return -1 if sequence is not found Return 0 if sequence doesn't have taxono...
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TSequenceTypes GetSequenceTypes(const TSeq_id_Handles &idhs, TGetFlags flags=0)
CSeq_inst::TMol GetSequenceType(const CSeq_id &id, TGetFlags flags=0)
Get molecular type of sequence (protein/dna/rna) Return CSeq_inst::eMol_not_set if sequence is not fo...
vector< CSeq_inst::TMol > TSequenceTypes
Get molecular types of sequences (protein/dna/rna) Return CSeq_inst::eMol_not_set for sequences that ...
TSequenceLengths GetSequenceLengths(const TSeq_id_Handles &idhs, TGetFlags flags=0)
TTaxIds GetTaxIds(const TSeq_id_Handles &idhs, TGetFlags flags=0)
vector< CSeq_id_Handle > TSeq_id_Handles
Bulk retrieval methods Common argument typedef - vector of requested ids.
@ kPriority_NotSet
Deprecated: use kPriority_Default instead.
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
bool State_NoData(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
const TInst & GetInst(void) const
bool NotNull(void) const THROWS_NONE
Check if pointer is not null – same effect as NotEmpty().
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
@ e_Other
for historical reasons, 'other' = 'refseq'
@ e_Gi
GenInfo Integrated Database.
list< CRef< CSeqdesc > > Tdata
const TInst & GetInst(void) const
Get the Inst member data.
const Tdata & Get(void) const
Get the member data.
TLength GetLength(void) const
Get the Length member data.
bool IsSetDescr(void) const
descriptors Check if a value has been assigned to Descr data member.
const TNcbi4na & GetNcbi4na(void) const
Get the variant data.
const TDescr & GetDescr(void) const
Get the Descr member data.
@ eMol_na
just a nucleic acid
char * dbname(DBPROCESS *dbproc)
Get name of current database.
BOOST_AUTO_TEST_CASE(LocalFetchNucleotideBioseq)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Utility stuff for more convenient using of Boost.Test library.