Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Klinische Genetica
capture-lumc
vtools
Commits
a3319f09
Commit
a3319f09
authored
6 years ago
by
Santcroos
Browse files
Options
Downloads
Patches
Plain Diff
Use logarithmic mean.
parent
896ae2ed
No related branches found
No related tags found
1 merge request
!1
Use logarithmic mean.
Pipeline
#2493
passed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vtools/gcoverage.py
+9
-1
9 additions, 1 deletion
vtools/gcoverage.py
with
9 additions
and
1 deletion
vtools/gcoverage.py
+
9
−
1
View file @
a3319f09
...
...
@@ -7,6 +7,7 @@ vtools.gcoverage
:license: MIT
"""
import
math
import
cyvcf2
import
numpy
as
np
...
...
@@ -58,6 +59,13 @@ def gq_for_gvcf_record(record: cyvcf2.Variant, maxlen: int = 15000) -> List[int]
return
[
gq
]
*
maxlen
# Credit:
# https://gigabaseorgigabyte.wordpress.com/2017/06/26/averaging-basecall-quality-scores-the-right-way/
# https://git.lumc.nl/klinische-genetica/capture-lumc/vtools/issues/3
def
qualmean
(
quals
):
return
-
10
*
math
.
log
(
sum
([
10
**
(
q
/-
10
)
for
q
in
quals
])
/
len
(
quals
),
10
)
class
CovStats
(
object
):
def
__init__
(
self
,
records
):
self
.
records
=
records
...
...
@@ -100,7 +108,7 @@ class CovStats(object):
@property
def
mean_gq
(
self
)
->
float
:
return
np
.
mean
(
self
.
gq_qualities
)
return
qual
mean
(
self
.
gq_qualities
)
def
percent_atleast_dp
(
self
,
atleast
)
->
Optional
[
float
]:
if
len
(
self
.
coverages
)
==
0
:
...
...
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