Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
eb3f23a1
Commit
eb3f23a1
authored
Nov 19, 2020
by
Philippe Veber
Browse files
new tk/Multinomial module
parent
5ea7464a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
lib/tk/multinomial.ml
lib/tk/multinomial.ml
+30
-0
No files found.
lib/tk/multinomial.ml
0 → 100644
View file @
eb3f23a1
open
Core_kernel
open
Phylogenetics
let
site_loop
tree
alignment
f
=
let
leaves
=
Convergence_tree
.
leaves
tree
|>
List
.
map
~
f
:
(
fun
(
n
,
cond
)
->
match
Alignment
.
find_sequence
alignment
n
with
|
None
->
failwithf
"Could not find %s in alignment"
n
()
|
Some
seq
->
seq
,
cond
)
in
let
seqs0
,
seqs1
=
List
.
partition_map
leaves
~
f
:
Either
.(
function
|
(
aa
,
`Ancestral
)
->
First
aa
|
(
aa
,
`Convergent
)
->
Second
aa
)
in
let
counts
seqs
i
=
Amino_acid
.
Table
.
init
(
fun
aa
->
let
aa
=
Amino_acid
.
to_char
aa
in
List
.
count
seqs
~
f
:
(
fun
s
->
Char
.
equal
s
.
[
i
]
aa
)
)
in
let
site
i
=
let
c0
=
(
counts
seqs0
i
:>
int
array
)
in
let
c1
=
(
counts
seqs1
i
:>
int
array
)
in
f
c0
c1
in
let
n
=
Alignment
.
ncols
alignment
in
List
.
init
n
~
f
:
site
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