Skip to content
Snippets Groups Projects
Commit 32349bb4 authored by Thomas Faraut's avatar Thomas Faraut
Browse files

added filter_monomorph and filter_callrate flag added

parent ee3dbee1
No related branches found
No related tags found
No related merge requests found
...@@ -204,7 +204,6 @@ class AnnotateReader(VCFReader): ...@@ -204,7 +204,6 @@ class AnnotateReader(VCFReader):
def getHeader(self): def getHeader(self):
return self.vcf_reader.header return self.vcf_reader.header
def add_annotation_metadata(self): def add_annotation_metadata(self):
self.addInfo("SOURCEID", 1, "String", self.addInfo("SOURCEID", 1, "String",
"The source sv identifier") "The source sv identifier")
...@@ -520,7 +519,8 @@ def add_filter_infos_header(reader): ...@@ -520,7 +519,8 @@ 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(SVSet, reader): def variant_filtration(variants, reader, filter_monomorph=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
- variant sites - variant sites
...@@ -534,15 +534,15 @@ def variant_filtration(SVSet, reader): ...@@ -534,15 +534,15 @@ def variant_filtration(SVSet, reader):
add_callrate_infos_header(reader) add_callrate_infos_header(reader)
add_filter_infos_header(reader) add_filter_infos_header(reader)
for sv in SVSet: for sv in variants:
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)
if sv.call_rate(13) < 0.75: if sv.call_rate(13) < 0.75 and filter_callrate:
sv.filter.add("CALLRATE") sv.filter.add("CALLRATE")
if not sv.polymorph(): if not sv.polymorph() and filter_monomorph:
sv.filter.add("MONOMORPH") sv.filter.add("MONOMORPH")
if 'NONDUPLICATEOVERLAP' in info and info['NONDUPLICATEOVERLAP'] > 0.7: if 'NONDUPLICATEOVERLAP' in info and info['NONDUPLICATEOVERLAP'] > 0.8:
sv.filter.add("OVERLAP") sv.filter.add("OVERLAP")
if "DUPLICATESCORE" in info is not None and info['DUPLICATESCORE'] > -2: if "DUPLICATESCORE" in info is not None and info['DUPLICATESCORE'] > -2:
sv.filter.add("DUPLICATE") sv.filter.add("DUPLICATE")
...@@ -559,7 +559,7 @@ def AB_filtering(variant_set): ...@@ -559,7 +559,7 @@ def AB_filtering(variant_set):
if Heterozygote(s): if Heterozygote(s):
valid_AB_freq.append((s.get('AB')[0] > 0.3)) valid_AB_freq.append((s.get('AB')[0] > 0.3))
if (len(valid_AB_freq) > 0 and if (len(valid_AB_freq) > 0 and
sum(valid_AB_freq) < len(valid_AB_freq) / 2): sum(valid_AB_freq) < len(valid_AB_freq) / 2):
sv.filter.add("ABFREQ") sv.filter.add("ABFREQ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment