Skip to content

Commit

Permalink
use pyvcf to add SHIFT3_ADJUSTED header to vardict vcf
Browse files Browse the repository at this point in the history
  • Loading branch information
ionox0 committed Sep 13, 2021
1 parent eab1ceb commit 65814b4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cwl_tools/basicfiltering/filter_vardict.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import logging
import argparse

from vcf.parser import _Info as VcfInfo, _Format as VcfFormat
from vcf.parser import _Info as VcfInfo, _Format as VcfFormat, _vcf_metadata_parser as VcfMetadataParser

from python_tools import cmo_util

Expand Down Expand Up @@ -96,6 +96,11 @@ def run_std_filter(args):
vcf_reader.infos['set'] = VcfInfo('set', '.', 'String', 'The variant callers that reported this event', 'mskcc/basicfiltering', 'v0.2.1')
vcf_reader.formats['DP'] = VcfFormat('DP', '1', 'Integer', 'Total read depth at this site')
vcf_reader.formats['AD'] = VcfFormat('AD', 'R', 'Integer', 'Allelic depths for the ref and alt alleles in the order listed')
# Manually add the new SHIFT3_ADJUSTED header to the reader, which will then be passed to the writer
shift3_line = "##INFO=<ID=SHIFT3_ADJUSTED,Number=1,Type=Integer,Description=\"No. of bases to be shifted to 3 prime for deletions due to alternative alignment for complex variants\">"
meta_parser = VcfMetadataParser()
key, val = meta_parser.read_info(shift3_line)
vcf_reader.infos[key] = val

allsamples = list(vcf_reader.samples)

Expand Down

2 comments on commit 65814b4

@andurill
Copy link
Collaborator

@andurill andurill commented on 65814b4 Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ionox0 Thanks for figuring out how to add the "SHIFT3_ADJUSTED" to INFO fields of the vcf header! I just couldn't figure that out. If I may suggest, I think the description should be something along the lines of "No. of bases to be shifted to 5 prime for complex variants to get the preferred left alignment for proper genotyping".

@ionox0
Copy link
Member Author

@ionox0 ionox0 commented on 65814b4 Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've changed the comment to say just that

Please sign in to comment.