.resize(sequence.length());
74 for(
size_t i=0;
i< sequence.length();
i++) {
77bioseq->
SetInst().SetLength((
unsigned int)sequence.length());
80bioseq->
SetId().clear();
86 template<
classTKmerCounts>
97counts.Reset(seqloc, *scope);
105 const stringseq1 =
"AAAAAAAAA";
106 const stringseq2 =
"BBBBBBBBBB";
109 for(
int i=3;
i< 6;
i++) {
110 for(
intj=15;j <= 20;j++) {
120BOOST_CHECK_EQUAL(counts.
GetNumCounts(), seq1.length()
138 const stringseq_x =
"AXAXAXAXAXAXAX";
139 const stringseq_xonly =
"XXXXXXXXXXXXX";
143 for(
int i=3;
i< 6;
i++) {
151BOOST_CHECK_EQUAL((
int)counts_xonly.
GetNumCounts(), 0);
154 const stringseq_short =
"ABC";
193 const intkKmerLen = 4;
198vector< CRef<CSeq_loc> > seqs;
199vector<CSparseKmerCounts> counts_vect;
200TKMethods::TDistMatrix dmat;
203BOOST_REQUIRE_EQUAL(status, 0);
204BOOST_REQUIRE(seqs.size() > 0);
205BOOST_REQUIRE(!scope.
Empty());
208BOOST_CHECK_THROW(TKMethods::ComputeCounts(vector<
CRef<CSeq_loc>>(),
209*scope, counts_vect),
219TKMethods::ComputeCounts(seqs, *scope, counts_vect);
220BOOST_REQUIRE_EQUAL(counts_vect.size(), seqs.size());
222TKMethods::ComputeDistMatrix(counts_vect,
223TKMethods::eFractionCommonKmersGlobal, dmat);
225BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
226BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
228TKMethods::ComputeDistMatrix(counts_vect,
229TKMethods::eFractionCommonKmersLocal, dmat);
231BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
232BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
238TKMethods::ComputeCounts(seqs, *scope, counts_vect);
239BOOST_REQUIRE_EQUAL(counts_vect.size(), seqs.size());
241TKMethods::ComputeDistMatrix(counts_vect,
242TKMethods::eFractionCommonKmersGlobal, dmat);
244BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
245BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
247TKMethods::ComputeDistMatrix(counts_vect,
248TKMethods::eFractionCommonKmersLocal, dmat);
250BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
251BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
256TKMethods::ComputeCounts(seqs, *scope, counts_vect);
257BOOST_REQUIRE_EQUAL(counts_vect.size(), seqs.size());
259TKMethods::ComputeDistMatrix(counts_vect,
260TKMethods::eFractionCommonKmersGlobal, dmat);
262BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
263BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
265TKMethods::ComputeDistMatrix(counts_vect,
266TKMethods::eFractionCommonKmersLocal, dmat);
268BOOST_REQUIRE_EQUAL(dmat.GetRows(), seqs.size());
269BOOST_CHECK_CLOSE(dmat(0, 1), 0.0, 1e-6);
static const int kAlphabetSize
The aligner internally works only with the ncbistdaa alphabet.
BOOST_AUTO_TEST_SUITE_END() static int s_GetSegmentFlags(const CBioseq &bioseq)
Exception class for Kmer counts.
Kmer counts for alignment free sequence similarity computation implemented as a sparse vector.
static unsigned int GetKmerLength(void)
Get default kmer length.
static void SetUseCompressed(bool use_comp)
Set default option for using compressed alphabet.
static void SetAlphabetSize(unsigned size)
Set Default alphabet size.
unsigned int GetNumCounts(void) const
Get number of all k-mers found in the sequence.
static unsigned int CountCommonKmers(const CSparseKmerCounts &v1, const CSparseKmerCounts &v2, bool repetitions=true)
Copmute number of common kmers between two count vectors.
static void SetKmerLength(unsigned len)
Set default k-mer length.
static vector< Uint1 > & SetTransTable(void)
Set default compressed alphabet letter translation table.
Interface for computing and manipulating k-mer counts vectors that allows for different implementatio...
int ReadFastaQueries(const string &filename, vector< CRef< objects::CSeq_loc > > &seqs, CRef< objects::CScope > &scope, bool parse_deflines, objects::CSeqIdGenerator *id_generator)
const Uint1 AMINOACID_TO_NCBISTDAA[]
Translates between ncbieaa and ncbistdaa.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
CBioseq_Handle AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
bool Empty(void) const THROWS_NONE
Check if CRef is empty â not pointing to any object, which means having a null value.
virtual void SetParams()
Called at the beginning of Run, before creating thread pool.
TId & SetId(void)
Assign a value to Id data member.
void SetInst(TInst &value)
Assign a value to Inst data member.
TNcbistdaa & SetNcbistdaa(void)
Select the variant.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
BOOST_AUTO_TEST_CASE(TestSparseKmerCounts)
static CRef< CBioseq > s_CreateBioseq(const string &sequence, int id)
static void s_CreateKmerCounts(const string &seq, TKmerCounts &counts)
BOOST_AUTO_TEST_SUITE(psiblast_iteration)
Utility stuff for more convenient using of Boost.Test library.
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