Maintenance
+ Fixed a calculation error in RD in `to_vcf.call_reference_depth`
+ Previously, only the Cs tags that matched the reference were considered, resulting in a match (adding 1 to RD) for sequences like deletions (e.g., `=T, -c, -c`).
+ Changed the policy to add 1 to RD if the sequence corresponding to `v.ref` exists in the CS tags.
+ Due to the change in `cstag.consensus.normalize_read_lengths` in v1.0.1, where insufficient read lengths are now padded with `None` instead of `N`, a bug arose in `to_vcf.call_reference_depth` where it referred to `None`. This has been fixed.
python
import cstag
cs_tags = [
'=A*cg=G+aa=T-ac=G',
'*cg=G+aa=T-ac=G',
'=G-t=ACG'
]
chroms = ['chr1', 'chr1', 'chr1']
positions = [10, 11, 12]
print(cstag.to_vcf(cs_tags, chroms, positions))
before
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kuno/miniconda3/lib/python3.10/site-packages/cstag/to_vcf.py", line 340, in to_vcf
return process_cs_tags(cs_tags, chroms, positions)
File "/home/kuno/miniconda3/lib/python3.10/site-packages/cstag/to_vcf.py", line 285, in process_cs_tags
reference_depth = call_reference_depth(variant_annotations, cs_tags_list, positions_list)
File "/home/kuno/miniconda3/lib/python3.10/site-packages/cstag/to_vcf.py", line 202, in call_reference_depth
if cs[i][0] in ACGT:
TypeError: 'NoneType' object is not subscriptable
after
fileformat=VCFv4.2
INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
INFO=<ID=RD,Number=1,Type=Integer,Description="Depth of Ref allele">
INFO=<ID=AD,Number=1,Type=Integer,Description="Depth of Alt allele">
INFO=<ID=VAF,Number=1,Type=Float,Description="Variant allele fractions (AD/DP)">
CHROM POS ID REF ALT QUAL FILTER INFO
chr1 11 . C G . . DP=2;RD=0;AD=2;VAF=1.0
chr1 12 . GT G . . DP=2;RD=1;AD=1;VAF=0.5
chr1 12 . G GAA . . DP=3;RD=1;AD=2;VAF=0.667
chr1 13 . TAC T . . DP=2;RD=0;AD=2;VAF=1.0