Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bmDCA
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Jerry Dinan
bmDCA
Commits
70e6afa1
Commit
70e6afa1
authored
4 years ago
by
sudorook
Browse files
Options
Downloads
Patches
Plain Diff
compute relative entropy at each position
parent
e56f6080
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/msa_stats.cpp
+6
-4
6 additions, 4 deletions
src/msa_stats.cpp
src/msa_stats.hpp
+1
-0
1 addition, 0 deletions
src/msa_stats.hpp
with
7 additions
and
4 deletions
src/msa_stats.cpp
+
6
−
4
View file @
70e6afa1
...
...
@@ -20,6 +20,7 @@ MSAStats::MSAStats(MSA msa)
frequency_1p
=
arma
::
Mat
<
double
>
(
Q
,
N
,
arma
::
fill
::
zeros
);
frequency_2p
=
arma
::
field
<
arma
::
Mat
<
double
>>
(
N
,
N
);
rel_entropy_1p
=
arma
::
Mat
<
double
>
(
Q
,
N
,
arma
::
fill
::
zeros
);
rel_entropy_grad_1p
=
arma
::
Mat
<
double
>
(
Q
,
N
,
arma
::
fill
::
zeros
);
aa_background_frequencies
=
arma
::
Col
<
double
>
(
Q
,
arma
::
fill
::
ones
);
...
...
@@ -85,13 +86,14 @@ MSAStats::MSAStats(MSA msa)
// entropy gradient for each position.
arma
::
Mat
<
double
>
tmp
=
frequency_1p
*
(
1.
-
pseudocount
);
tmp
.
each_col
()
+=
pseudocount
*
aa_background_frequencies
;
double
pos_freq
;
double
background_freq
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
for
(
int
aa
=
0
;
aa
<
Q
;
aa
++
)
{
pos_freq
=
tmp
(
aa
,
i
);
background_freq
=
aa_background_frequencies
(
aa
);
double
pos_freq
=
tmp
(
aa
,
i
);
double
background_freq
=
aa_background_frequencies
(
aa
);
if
(
pos_freq
<
1.
&&
pos_freq
>
0.
)
{
rel_entropy_1p
(
aa
,
i
)
=
pos_freq
*
log
(
pos_freq
/
background_freq
)
+
(
1
-
pos_freq
)
*
log
((
1
-
pos_freq
)
/
(
1
-
background_freq
));
rel_entropy_grad_1p
(
aa
,
i
)
=
log
((
pos_freq
*
(
1.
-
background_freq
))
/
((
1.
-
pos_freq
)
*
background_freq
));
}
...
...
This diff is collapsed.
Click to expand it.
src/msa_stats.hpp
+
1
−
0
View file @
70e6afa1
...
...
@@ -23,6 +23,7 @@ public:
arma
::
Mat
<
double
>
frequency_1p
;
arma
::
field
<
arma
::
Mat
<
double
>>
frequency_2p
;
arma
::
Mat
<
double
>
rel_entropy_grad_1p
;
arma
::
Mat
<
double
>
rel_entropy_1p
;
private:
double
pseudocount
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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