Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ROCK
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Véronique LEGRAND
ROCK
Commits
8969b03b
Commit
8969b03b
authored
9 years ago
by
Veronique Legrand
Browse files
Options
Downloads
Patches
Plain Diff
did some modif for the calculation of min number of ocurrences for each k-mer (fast path)
parent
2cf1abc1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CountMinSketch.cpp
+1
-18
1 addition, 18 deletions
src/CountMinSketch.cpp
src/CountMinSketch.h
+41
-3
41 additions, 3 deletions
src/CountMinSketch.h
with
42 additions
and
21 deletions
src/CountMinSketch.cpp
+
1
−
18
View file @
8969b03b
...
...
@@ -77,24 +77,7 @@ void CountMinSketch::addKMer(const unsigned long& val1,const unsigned long& val2
}
/*
* Used to determine if a read must be kept or not.
* Depending on the case, threshold is kappa or kappa_prime
* Computes the number of k-mers for which the number of occurrences is below threshold.
* If more than half of the k-mers have a number of occurrences that is less than threshold,
* return true; else, return false.
*/
int
CountMinSketch
::
isRCovBelowThres
(
const
readNumericValues
&
read_val
,
const
int
&
threshold
)
{
int
a
=
0
;
int
b
=
0
;
readNumericValues
::
const_iterator
it
;
for
(
it
=
read_val
.
begin
();
it
!=
read_val
.
end
();
it
++
)
{
unsigned
char
nb_occ
=
getEstimatedNbOcc
(
*
it
);
if
(
nb_occ
<
threshold
)
a
+=
1
;
++
b
;
}
return
(
2
*
a
>
b
);
}
int
CountMinSketch
::
addRead
(
const
readNumericValues
&
read_val
)
{
...
...
This diff is collapsed.
Click to expand it.
src/CountMinSketch.h
+
41
−
3
View file @
8969b03b
...
...
@@ -66,7 +66,43 @@ class CountMinSketch {
// std::map<int,int> getIthArray(int); // utility method provided for testing only.
void
addKMer
(
const
unsigned
long
&
,
const
unsigned
long
&
);
// inline? TODO: see later if it can help us gain time.
int
isRCovBelowThres
(
const
readNumericValues
&
read_val
,
const
int
&
threshold
);
// int isRCovBelowThres(const readNumericValues& read_val, const int& threshold);
/*
* Used to determine if a read must be kept or not.
* Depending on the case, threshold is kappa or kappa_prime
* Computes the number of k-mers for which the number of occurrences is below threshold.
* If more than half of the k-mers have a number of occurrences that is less than threshold,
* return true; else, return false.
*/
inline
int
isRCovBelowThres
(
const
readNumericValues
&
read_val
,
const
int
&
threshold
)
{
int
a
=
0
;
int
b
=
0
;
int
j
;
int
h
;
unsigned
char
min
;
readNumericValues
::
const_iterator
it
;
for
(
it
=
read_val
.
begin
();
it
!=
read_val
.
end
();
it
++
)
{
j
=
lambda
;
min
=
ubytemask
;
while
(
--
j
>=
0
&&
min
>
threshold
)
{
h
=
hash64to32
(
*
it
,
j
);
min
=
cms_lambda_array
[
j
]
[
h
];
(
min
<
threshold
)
?
a
+=
1
:
a
+=
0
;
}
++
b
;
}
return
(
2
*
a
>
b
);
}
/* inline unsigned char CountMinSketch::isKmCoveBelowThres(const unsigned long& val, const int& threshold) {
int h;
unsigned char min;
int j=lambda;
while(--j>=0) {
h=hash64to32(val,j);
min=cms_lambda_array[j] [h];
}
}*/
void
init
(
int
glambda
,
int
gkappa
,
int
gkappa_prime
)
{
lambda
=
glambda
;
...
...
@@ -104,13 +140,15 @@ public:
free
(
cms_lambda_array
);
}
// keep that just for unit testing purpose
inline
unsigned
char
getEstimatedNbOcc
(
const
unsigned
long
&
val
)
{
int
j
,
h
;
// unsigned short min=ushortmask;
unsigned
char
min
=
ubytemask
;
for
(
j
=
0
;
j
<
lambda
;
j
++
)
{
j
=
lambda
;
while
(
--
j
>=
0
&&
min
>
kappa
)
{
h
=
hash64to32
(
val
,
j
);
if
(
cms_lambda_array
[
j
]
[
h
]
<
min
)
min
=
cms_lambda_array
[
j
]
[
h
];
min
=
cms_lambda_array
[
j
]
[
h
];
}
return
min
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment