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
b151b5db
Commit
b151b5db
authored
5 years ago
by
van den Berg
Browse files
Options
Downloads
Patches
Plain Diff
Write discordant variants to valid vcf file
parent
c76505da
No related branches found
No related tags found
2 merge requests
!6
Merge testing into master
,
!5
Merge new testing code into devel
Pipeline
#2856
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vtools/cli.py
+15
-6
15 additions, 6 deletions
vtools/cli.py
with
15 additions
and
6 deletions
vtools/cli.py
+
15
−
6
View file @
b151b5db
...
@@ -9,6 +9,7 @@ vtools.cli
...
@@ -9,6 +9,7 @@ vtools.cli
import
json
import
json
import
click
import
click
from
cyvcf2
import
VCF
,
Writer
from
cyvcf2
import
VCF
,
Writer
import
gzip
from
.evaluate
import
site_concordancy
from
.evaluate
import
site_concordancy
from
.filter
import
FilterParams
,
FilterClass
,
Filterer
from
.filter
import
FilterParams
,
FilterClass
,
Filterer
...
@@ -33,7 +34,7 @@ from .gcoverage import RefRecord, region_coverages
...
@@ -33,7 +34,7 @@ from .gcoverage import RefRecord, region_coverages
required
=
True
)
required
=
True
)
@click.option
(
"
-s
"
,
"
--stats
"
,
type
=
click
.
Path
(
writable
=
True
),
@click.option
(
"
-s
"
,
"
--stats
"
,
type
=
click
.
Path
(
writable
=
True
),
help
=
"
Path to output stats json file
"
)
help
=
"
Path to output stats json file
"
)
@click.option
(
"
-d
c
"
,
"
--discordant
"
,
type
=
click
.
Path
(
writable
=
True
),
@click.option
(
"
-d
vcf
"
,
"
--discordant
-vcf
"
,
type
=
click
.
Path
(
writable
=
True
),
help
=
"
Path to output discordant VCF file
"
,
help
=
"
Path to output discordant VCF file
"
,
required
=
False
)
required
=
False
)
@click.option
(
"
-mq
"
,
"
--min-qual
"
,
type
=
float
,
@click.option
(
"
-mq
"
,
"
--min-qual
"
,
type
=
float
,
...
@@ -41,7 +42,7 @@ from .gcoverage import RefRecord, region_coverages
...
@@ -41,7 +42,7 @@ from .gcoverage import RefRecord, region_coverages
@click.option
(
"
-md
"
,
"
--min-depth
"
,
type
=
float
,
@click.option
(
"
-md
"
,
"
--min-depth
"
,
type
=
float
,
help
=
"
Minimum depth of variants to consider
"
,
default
=
0
)
help
=
"
Minimum depth of variants to consider
"
,
default
=
0
)
def
evaluate_cli
(
call_vcf
,
positive_vcf
,
call_samples
,
positive_samples
,
def
evaluate_cli
(
call_vcf
,
positive_vcf
,
call_samples
,
positive_samples
,
min_qual
,
min_depth
,
stats
,
discordant
):
min_qual
,
min_depth
,
stats
,
discordant
_vcf
):
c_vcf
=
VCF
(
call_vcf
,
gts012
=
True
)
c_vcf
=
VCF
(
call_vcf
,
gts012
=
True
)
p_vcf
=
VCF
(
positive_vcf
,
gts012
=
True
)
p_vcf
=
VCF
(
positive_vcf
,
gts012
=
True
)
st
,
disc
=
site_concordancy
(
c_vcf
,
p_vcf
,
call_samples
,
st
,
disc
=
site_concordancy
(
c_vcf
,
p_vcf
,
call_samples
,
...
@@ -53,11 +54,19 @@ def evaluate_cli(call_vcf, positive_vcf, call_samples, positive_samples,
...
@@ -53,11 +54,19 @@ def evaluate_cli(call_vcf, positive_vcf, call_samples, positive_samples,
with
click
.
open_file
(
stats
,
'
w
'
)
as
fout
:
with
click
.
open_file
(
stats
,
'
w
'
)
as
fout
:
print
(
json
.
dumps
(
st
),
file
=
fout
)
print
(
json
.
dumps
(
st
),
file
=
fout
)
# If specified, write the discordant variants
# If there were discordand records, and a discordant-vcf should be written
if
discordant
:
if
len
(
disc
)
>
0
and
discordant_vcf
:
with
click
.
open_file
(
discordant
,
'
w
'
)
as
fout
:
with
click
.
open_file
(
discordant_vcf
,
'
w
'
)
as
fout
:
# First, we write the vcf header
with
gzip
.
open
(
call_vcf
,
'
rt
'
)
as
fin
:
for
line
in
fin
:
if
line
.
startswith
(
'
#
'
):
fout
.
write
(
line
)
else
:
break
# Then we write the vcf records that were discordant
for
record
in
disc
:
for
record
in
disc
:
print
(
record
,
file
=
fout
,
end
=
''
)
fout
.
write
(
str
(
record
)
)
@click.command
()
@click.command
()
...
...
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