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
793934aa
Commit
793934aa
authored
Apr 06, 2015
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/kmerstore.h, core/segment.cpp: move getProbabilityAtLeastOrAbove to IKmerStore
parent
100c27ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
algo/core/kmerstore.h
algo/core/kmerstore.h
+28
-0
algo/core/segment.cpp
algo/core/segment.cpp
+2
-15
No files found.
algo/core/kmerstore.h
View file @
793934aa
...
...
@@ -6,6 +6,7 @@
#include <list>
#include <stdexcept>
#include <stdint.h>
#include <math.h>
#include "fasta.h"
#include "tools.h"
...
...
@@ -84,6 +85,11 @@ public:
*/
float
getIndexLoad
()
const
;
/**
* @return probability that the number of kmers is 'at_least' or more in a sequence of length 'length'
*/
double
getProbabilityAtLeastOrAbove
(
int
at_least
,
int
length
)
const
;
/**
* @return the value of k
*/
...
...
@@ -235,6 +241,28 @@ float IKmerStore<T>::getIndexLoad() const {
return
nb_kmers_inserted
*
1.
/
(
1
<<
(
2
*
k
));
}
template
<
class
T
>
double
IKmerStore
<
T
>::
getProbabilityAtLeastOrAbove
(
int
at_least
,
int
length
)
const
{
// n: number of kmers in the sequence
int
n
=
length
-
getS
()
+
1
;
float
index_load
=
getIndexLoad
()
;
double
proba
=
0
;
double
probability_having_system
=
pow
(
index_load
,
at_least
);
double
probability_not_having_system
=
pow
(
1
-
index_load
,
n
-
at_least
);
for
(
int
i
=
at_least
;
i
<=
n
;
i
++
)
{
proba
+=
nChoosek
(
n
,
i
)
*
probability_having_system
*
probability_not_having_system
;
probability_having_system
*=
index_load
;
probability_not_having_system
/=
(
1
-
index_load
);
}
return
proba
;
}
template
<
class
T
>
int
IKmerStore
<
T
>::
getK
()
const
{
return
k
;
...
...
algo/core/segment.cpp
View file @
793934aa
...
...
@@ -27,7 +27,6 @@
#include "affectanalyser.h"
#include <sstream>
#include <string>
#include <math.h>
Segmenter
::~
Segmenter
()
{}
...
...
@@ -366,20 +365,8 @@ KmerMultiSegmenter::KmerMultiSegmenter(Sequence seq, MultiGermline *multigermlin
double
KmerSegmenter
::
getProbabilityAtLeastOrAbove
(
int
at_least
)
const
{
// n: number of kmers in the sequence
int
n
=
getSequence
().
sequence
.
size
()
-
getKmerAffectAnalyser
()
->
getIndex
().
getS
()
+
1
;
float
index_load
=
getKmerAffectAnalyser
()
->
getIndex
().
getIndexLoad
()
;
double
proba
=
0
;
double
probability_having_system
=
pow
(
index_load
,
at_least
);
double
probability_not_having_system
=
pow
(
1
-
index_load
,
n
-
at_least
);
for
(
int
i
=
at_least
;
i
<=
n
;
i
++
)
{
proba
+=
nChoosek
(
n
,
i
)
*
probability_having_system
*
probability_not_having_system
;
probability_having_system
*=
index_load
;
probability_not_having_system
/=
(
1
-
index_load
);
}
return
proba
;
return
getKmerAffectAnalyser
()
->
getIndex
().
getProbabilityAtLeastOrAbove
(
at_least
,
getSequence
().
sequence
.
size
());
}
double
KmerMultiSegmenter
::
getNbExpected
()
const
{
...
...
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