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
d6a8d0e5
Commit
d6a8d0e5
authored
5 years ago
by
van den Berg
Browse files
Options
Downloads
Patches
Plain Diff
Extract genotypes to support conflicting ALT calls
parent
8786b514
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!6
Merge testing into master
,
!5
Merge new testing code into devel
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vtools/evaluate.py
+18
-5
18 additions, 5 deletions
vtools/evaluate.py
with
18 additions
and
5 deletions
vtools/evaluate.py
+
18
−
5
View file @
d6a8d0e5
...
...
@@ -12,16 +12,17 @@ from types import SimpleNamespace
from
cyvcf2
import
VCF
def
parse_variants
(
call
:
List
[
any
],
pos
:
List
[
any
],
results
:
Dict
[
str
,
int
]):
def
parse_variants
(
ref
:
str
,
call
:
List
[
str
],
pos
:
List
[
str
],
results
:
Dict
[
str
,
int
]):
"""
Parse the variants and add to results
"""
call_variant
=
sorted
(
call
[
0
:
2
]
)
pos_variant
=
sorted
(
pos
[
0
:
2
]
)
call_variant
=
sorted
(
call
)
pos_variant
=
sorted
(
pos
)
# The types of concordant calls are counted separately
if
call_variant
==
pos_variant
:
# These variants are homozygous reference
if
call_variant
==
[
0
,
0
]
:
if
call_variant
[
0
]
==
call_variant
[
1
]
and
call_variant
[
0
]
==
ref
:
results
[
'
alleles_hom_ref_concordant
'
]
+=
2
# These variants are heterozygous, since they have different calls
elif
call_variant
[
0
]
!=
call_variant
[
1
]:
...
...
@@ -182,8 +183,20 @@ def site_concordancy(call_vcf: VCF,
if
pos
[
2
]
or
cal
[
2
]:
raise
NotImplementedError
(
'
Phased variants are not supported
'
)
# Get the genotyped bases. There is a deprecationWarning when using
# gt_bases directly so we go via the alleles and the gt call
pos_alleles
=
[
pos_record
.
REF
]
+
pos_record
.
ALT
cal_alleles
=
[
call_record
.
REF
]
+
call_record
.
ALT
# The third item in pos is a boolean indicating phasing
pos_gt
=
[
pos_alleles
[
x
]
for
x
in
pos
[:
2
]]
cal_gt
=
[
cal_alleles
[
x
]
for
x
in
cal
[:
2
]]
# Parse the genotypes and add the results into d
parse_variants
(
pos
,
cal
,
d
)
# We also need to know the reference call to determine if variants
# are hom ref. For this, we take the positive vcf REF call to be
# the truth
parse_variants
(
pos_record
.
REF
,
pos_gt
,
cal_gt
,
d
)
# The current variant is discordant
if
d
[
'
alleles_discordant
'
]
>
discordant_count
:
...
...
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