Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
svlib
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
SVdetection
svlib
Commits
cc29fe60
Commit
cc29fe60
authored
5 years ago
by
Thomas Faraut
Browse files
Options
Downloads
Patches
Plain Diff
more pep8 compliance
parent
32349bb4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
svreader/annotation.py
+11
-9
11 additions, 9 deletions
svreader/annotation.py
with
11 additions
and
9 deletions
svreader/annotation.py
+
11
−
9
View file @
cc29fe60
...
@@ -178,7 +178,7 @@ class AnnotateRecord(VCFRecord):
...
@@ -178,7 +178,7 @@ class AnnotateRecord(VCFRecord):
filters
=
[
f
for
f
in
record
.
filter
]
filters
=
[
f
for
f
in
record
.
filter
]
# We make the assumption when a "." is present no other filter
# We make the assumption when a "." is present no other filter
# are present
# are present
if
len
(
filters
)
==
0
or
"
.
"
in
filters
:
if
not
filters
or
"
.
"
in
filters
:
record
.
filter
.
clear
()
record
.
filter
.
clear
()
record
.
filter
.
add
(
"
PASS
"
)
record
.
filter
.
add
(
"
PASS
"
)
...
@@ -416,7 +416,9 @@ def add_redundancy_infos_header(reader):
...
@@ -416,7 +416,9 @@ def add_redundancy_infos_header(reader):
def
redundancy_annotator
(
SVSet
,
reader
,
def
redundancy_annotator
(
SVSet
,
reader
,
duplicatescore_threshold
=-
2
,
genotyper
=
"
svtyper
"
):
overlap_cutoff
,
duplicatescore_threshold
=-
2
,
genotyper
=
"
svtyper
"
):
"""
Annotating duplicate candidates based on the genotype likelihoods
"""
Annotating duplicate candidates based on the genotype likelihoods
- genotype likelihoods can be provided by svtyper or genomestrip
- genotype likelihoods can be provided by svtyper or genomestrip
"""
"""
...
@@ -430,7 +432,7 @@ def redundancy_annotator(SVSet, reader,
...
@@ -430,7 +432,7 @@ def redundancy_annotator(SVSet, reader,
pybed_variants
=
vcf_to_pybed
(
SVSet
)
pybed_variants
=
vcf_to_pybed
(
SVSet
)
self_overlap
=
pybed_variants
.
intersect
(
pybed_variants
,
self_overlap
=
pybed_variants
.
intersect
(
pybed_variants
,
f
=
0.5
,
r
=
True
,
wo
=
True
)
f
=
overlap_cutoff
,
r
=
True
,
wo
=
True
)
seen
=
defaultdict
(
tuple
)
seen
=
defaultdict
(
tuple
)
duplicates
=
defaultdict
(
list
)
duplicates
=
defaultdict
(
list
)
...
@@ -519,7 +521,7 @@ def add_filter_infos_header(reader):
...
@@ -519,7 +521,7 @@ def add_filter_infos_header(reader):
reader
.
addFilter
(
"
ABFREQ
"
,
"
AB frequency <0.3 for >50% heterosamples
"
)
reader
.
addFilter
(
"
ABFREQ
"
,
"
AB frequency <0.3 for >50% heterosamples
"
)
def
variant_filtration
(
variant
s
,
reader
,
filter_monomorph
=
False
,
def
variant_filtration
(
variant
_set
,
reader
,
filter_monomorph
=
False
,
filter_callrate
=
False
):
filter_callrate
=
False
):
"""
Filtering the candidate CNVs according to the following criteria
"""
Filtering the candidate CNVs according to the following criteria
- non duplicate sites
- non duplicate sites
...
@@ -534,7 +536,7 @@ def variant_filtration(variants, reader, filter_monomorph=False,
...
@@ -534,7 +536,7 @@ def variant_filtration(variants, reader, filter_monomorph=False,
add_callrate_infos_header
(
reader
)
add_callrate_infos_header
(
reader
)
add_filter_infos_header
(
reader
)
add_filter_infos_header
(
reader
)
for
sv
in
variant
s
:
for
sv
in
variant
_set
:
info
=
sv
.
record
.
info
info
=
sv
.
record
.
info
sv
.
record
.
info
[
'
CALLRATE
'
]
=
sv
.
call_rate
(
13
)
sv
.
record
.
info
[
'
CALLRATE
'
]
=
sv
.
call_rate
(
13
)
sv
.
record
.
info
[
'
VARIANTCALLRATE
'
]
=
sv
.
variant_call_rate
(
13
)
sv
.
record
.
info
[
'
VARIANTCALLRATE
'
]
=
sv
.
variant_call_rate
(
13
)
...
@@ -563,14 +565,14 @@ def AB_filtering(variant_set):
...
@@ -563,14 +565,14 @@ def AB_filtering(variant_set):
sv
.
filter
.
add
(
"
ABFREQ
"
)
sv
.
filter
.
add
(
"
ABFREQ
"
)
def
get_connected_duplicates
(
SVS
et
):
def
get_connected_duplicates
(
variant_s
et
):
"""
"""
Construct connected components of duplicates and rename the variants
Construct connected components of duplicates and rename the variants
"""
"""
undirected
=
Graph
()
undirected
=
Graph
()
variant_dict
=
defaultdict
()
variant_dict
=
defaultdict
()
representatives
=
defaultdict
()
representatives
=
defaultdict
()
for
s
in
SVS
et
:
for
s
in
variant_s
et
:
variant_dict
[
s
.
id
]
=
s
variant_dict
[
s
.
id
]
=
s
if
"
DUPLICATE
"
in
s
.
filter
:
if
"
DUPLICATE
"
in
s
.
filter
:
for
dupli_repr
in
s
.
record
.
info
[
"
DUPLICATEOF
"
]:
for
dupli_repr
in
s
.
record
.
info
[
"
DUPLICATEOF
"
]:
...
@@ -604,8 +606,8 @@ def get_tool_name(sv_ident):
...
@@ -604,8 +606,8 @@ def get_tool_name(sv_ident):
return
sv_ident
.
split
(
"
_
"
)[
0
]
return
sv_ident
.
split
(
"
_
"
)[
0
]
def
set_supporting_tools
(
SVS
et
):
def
set_supporting_tools
(
variant_s
et
):
for
sv
in
SVS
et
:
for
sv
in
variant_s
et
:
tools
=
{
get_tool_name
(
sv
.
id
)}
tools
=
{
get_tool_name
(
sv
.
id
)}
if
"
DUPLICATES
"
in
sv
.
record
.
info
:
if
"
DUPLICATES
"
in
sv
.
record
.
info
:
duplicates
=
sv
.
record
.
info
[
'
DUPLICATES
'
]
duplicates
=
sv
.
record
.
info
[
'
DUPLICATES
'
]
...
...
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