Skip to content
Snippets Groups Projects
Commit f9e082d7 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Set type of variants in uppercase

parent 39f1b589
No related branches found
No related tags found
No related merge requests found
......@@ -890,7 +890,7 @@ def add_jupyter_header(records: dict, groups: list, type_v: str, jupyter_file: s
jupy_f.write(json.dumps(jupy, indent=4))
def init(output, vcf_files, true_vcf, rules, filtered_vcfs=None, type_v="del", overlap_cutoff=0.5,
def init(output, vcf_files, true_vcf, rules, filtered_vcfs=None, type_v="DEL", overlap_cutoff=0.5,
left_precision=sys.maxsize, right_precision=sys.maxsize, no_xls=False, haploid=False):
if not os.path.exists(output):
......
......@@ -7,7 +7,7 @@ sys.path.insert(0, os.path.join(prg_path, "svlib"))
from svreader.vcfwrapper import VCFReader
ALLOW_VARIANTS = ['del', 'inv']
ALLOW_VARIANTS = ['DEL', 'INV']
def passed_variant(record):
......@@ -19,7 +19,7 @@ def passed_variant(record):
return record.filter is None or len(record.filter) == 0 or "PASS" in record.filter
def readvariants(vcffile: str, type_v, variants: dict=None, dofilter: bool=False, all_variants: dict=None):
def readvariants(vcffile: str, type_v:str, variants: dict=None, dofilter: bool=False, all_variants: dict=None):
"""
Read variants from a VCF file
:param vcffile: input vcf file
......@@ -31,12 +31,12 @@ def readvariants(vcffile: str, type_v, variants: dict=None, dofilter: bool=False
"""
if variants is None:
variants = {}
if type_v.lower() not in ALLOW_VARIANTS:
if type_v.upper() not in ALLOW_VARIANTS:
raise ValueError("Invalid variant type: %s" % type_v)
vcfin = VCFReader(vcffile)
for r in vcfin:
if r.sv_type.lower() == type_v:
if r.sv_type.upper() == type_v:
if not dofilter or passed_variant(r):
variants[r.id] = r
if dofilter and all_variants is not None:
......
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