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
742207bf
Commit
742207bf
authored
Jul 16, 2019
by
Philippe Veber
Browse files
Alistat.nucleotide_fasta_gc: compute inter sequence variance
parent
58668233
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
lib/alistats.ml
lib/alistats.ml
+9
-1
No files found.
lib/alistats.ml
View file @
742207bf
...
...
@@ -16,6 +16,11 @@ let strings_from_fasta fa =
|
Error
`Fasta_parser_error
_
->
failwith
"parsing error"
|
Error
`Msg
msg
->
failwith
msg
type
gc_stat
=
{
gc_mean
:
float
;
gc_variance_among_sequences
:
float
;
}
let
nucleotide_fasta_gc
?
thirdpos
:
(
tp
=
false
)
fa
=
let
seqs
=
strings_from_fasta
fa
in
let
gc_counts
=
Array
.
map
seqs
~
f
:
(
fun
seq
->
...
...
@@ -24,8 +29,11 @@ let nucleotide_fasta_gc ?thirdpos:(tp=false) fa =
float
len
,
float
sum
)
in
let
gc_freqs
=
Array
.
map
gc_counts
~
f
:
(
fun
(
len
,
k
)
->
k
/.
len
)
in
let
gc_variance_among_sequences
=
Owl
.
Stats
.
var
gc_freqs
in
let
total_len
=
Array
.
fold
gc_counts
~
init
:
0
.
~
f
:
(
fun
acc
(
n
,_
)
->
acc
+.
n
)
in
Array
.
fold
gc_counts
~
init
:
0
.
~
f
:
(
fun
acc
(
_
,
k
)
->
acc
+.
k
/.
total_len
)
let
gc_mean
=
Array
.
fold
gc_counts
~
init
:
0
.
~
f
:
(
fun
acc
(
_
,
k
)
->
acc
+.
k
/.
total_len
)
in
{
gc_mean
;
gc_variance_among_sequences
}
let
main
~
alignment
()
=
match
Alignment
.
from_fasta
alignment
with
...
...
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