Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,712
Issues
1,712
List
Boards
Labels
Service Desk
Milestones
Merge Requests
87
Merge Requests
87
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
91c41992
Commit
91c41992
authored
Apr 01, 2015
by
Mikaël Salson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kmerstore: Compute index load with the number of kmers inserted
parent
9b02d34a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
algo/core/kmerstore.h
algo/core/kmerstore.h
+31
-3
No files found.
algo/core/kmerstore.h
View file @
91c41992
...
...
@@ -42,6 +42,7 @@ protected:
int
k
;
// weight of the seed
int
s
;
// span of the seed (s >= k)
string
seed
;
size_t
nb_kmers_inserted
;
public:
...
...
@@ -78,6 +79,11 @@ public:
*/
virtual
T
&
get
(
seqtype
&
word
)
=
0
;
/**
* @return the percentage of kmers that are set in the index
*/
float
getIndexLoad
()
const
;
/**
* @return the value of k
*/
...
...
@@ -133,6 +139,9 @@ public:
vector
<
T
>
getResults
(
const
seqtype
&
seq
,
bool
no_revcomp
=
false
);
T
&
get
(
seqtype
&
word
);
T
&
operator
[](
seqtype
&
word
);
private:
void
init
();
};
template
<
class
T
>
...
...
@@ -206,14 +215,25 @@ void IKmerStore<T>::insert(const seqtype &sequence,
kmer
=
rc_kmer
;
}
}
this
->
get
(
kmer
)
+=
T
(
label
,
strand
);
T
&
this_kmer
=
this
->
get
(
kmer
);
if
(
this_kmer
.
isNull
())
{
nb_kmers_inserted
++
;
}
this_kmer
+=
T
(
label
,
strand
);
if
(
revcomp_indexed
&&
!
T
::
hasRevcompSymetry
())
{
seqtype
rc_kmer
=
revcomp
(
kmer
);
this
->
get
(
rc_kmer
)
+=
T
(
label
,
-
1
);
T
&
this_rc_kmer
=
this
->
get
(
rc_kmer
);
if
(
this_rc_kmer
.
isNull
())
nb_kmers_inserted
++
;
this_rc_kmer
+=
T
(
label
,
-
1
);
}
}
}
template
<
class
T
>
float
IKmerStore
<
T
>::
getIndexLoad
()
const
{
return
nb_kmers_inserted
*
1.
/
(
1
<<
(
2
*
k
));
}
template
<
class
T
>
int
IKmerStore
<
T
>::
getK
()
const
{
...
...
@@ -303,6 +323,7 @@ MapKmerStore<T>::MapKmerStore(string seed, bool revcomp){
this
->
k
=
k
;
this
->
s
=
seed
.
size
();
this
->
revcomp_indexed
=
revcomp
;
init
();
}
template
<
class
T
>
...
...
@@ -311,6 +332,12 @@ MapKmerStore<T>::MapKmerStore(int k, bool revcomp){
this
->
k
=
k
;
this
->
s
=
k
;
this
->
revcomp_indexed
=
revcomp
;
init
();
}
template
<
class
T
>
void
MapKmerStore
<
T
>::
init
()
{
this
->
nb_kmers_inserted
=
0
;
}
template
<
class
T
>
...
...
@@ -352,6 +379,7 @@ ArrayKmerStore<T>::ArrayKmerStore(string seed, bool revcomp){
template
<
class
T
>
void
ArrayKmerStore
<
T
>::
init
()
{
this
->
nb_kmers_inserted
=
0
;
if
((
size_t
)(
this
->
k
<<
1
)
>=
sizeof
(
int
)
*
8
)
throw
std
::
bad_alloc
();
store
=
new
T
[(
unsigned
int
)
1
<<
(
this
->
k
<<
1
)];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment