Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
schwede
openstructure
Commits
c7e86f51
Commit
c7e86f51
authored
9 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
proper check of indices in getter and setter of frequencies in HMMColumn
parent
8b484de7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/seq/base/src/hmm.cc
+16
-0
16 additions, 0 deletions
modules/seq/base/src/hmm.cc
modules/seq/base/src/hmm.hh
+2
-6
2 additions, 6 deletions
modules/seq/base/src/hmm.hh
with
18 additions
and
6 deletions
modules/seq/base/src/hmm.cc
+
16
−
0
View file @
c7e86f51
...
...
@@ -60,6 +60,22 @@ Real HMMColumn::GetEntropy() const {
return
entropy
;
}
Real
HMMColumn
::
GetFreq
(
char
ch
)
const
{
int
idx
=
this
->
GetIndex
(
ch
);
if
(
idx
==
-
1
){
throw
std
::
runtime_error
(
"Invalid One Letter Code observed when getting frequency in HMMColumn!"
);
}
return
freq_
[
idx
];
}
void
HMMColumn
::
SetFreq
(
char
ch
,
Real
freq
){
int
idx
=
this
->
GetIndex
(
ch
);
if
(
idx
==
-
1
){
throw
std
::
runtime_error
(
"Invalid One Letter Code observed when setting frequency in HMMColumn!"
);
}
freq_
[
idx
]
=
freq
;
}
HMMPtr
HMM
::
Load
(
const
std
::
string
&
filename
)
{
HMMPtr
hmm
(
new
HMM
);
boost
::
iostreams
::
filtering_stream
<
boost
::
iostreams
::
input
>
in
;
...
...
This diff is collapsed.
Click to expand it.
modules/seq/base/src/hmm.hh
+
2
−
6
View file @
c7e86f51
...
...
@@ -59,13 +59,9 @@ class HMMColumn {
Real
GetNEffDel
()
const
{
return
n_eff_del_
;
}
Real
GetFreq
(
char
ch
)
const
{
return
freq_
[
this
->
GetIndex
(
ch
)];
}
Real
GetFreq
(
char
ch
)
const
;
void
SetFreq
(
char
ch
,
Real
freq
)
{
freq_
[
this
->
GetIndex
(
ch
)]
=
freq
;
}
void
SetFreq
(
char
ch
,
Real
freq
);
bool
operator
==
(
const
HMMColumn
&
rhs
)
const
{
return
!
memcmp
(
freq_
,
rhs
.
freq_
,
sizeof
(
freq_
))
&&
...
...
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