0
$\begingroup$

I have a VCF file that is of the following format:

##fileformat=VCFv4.1
##fileDate=20210329-231145
##AnalysisPipelineName=NGS5
##AnalysisPipelineVersion=V5.2.1
##AnalysisConfigurationName=NGS5_Exome
##AnalysisConfigurationVersion=5.2.1
##NGSPanelName=SureSelect_ExomeV7_plus_720G
##NGSPanelVersion=V1.0
##BatchID=WES_032721_A
##Lane=Lane1
##reference=hg38
##PathogenicSilentFile=Pathogenic_Silent.20200730.vcf
##FlowcellName=210327_A01233_0050_AHYFJHDSXY
##VariantDefDateTime=20210323-070701
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=VF,Number=1,Type=Float,Description="Variant Frequency">
##FORMAT=<ID=AD,Number=.,Type=Integer,Description="Allele Depth">
##FORMAT=<ID=SB,Number=1,Type=String,Description="Strand Bias with read numbers (Fw/Rv)">
##FORMAT=<ID=SA,Number=4,Type=Integer,Description="Number of 1) forward ref alleles; 2) reverse ref; 3) forward non-ref; 4) reverse non-ref alleles, used in variant calling">
##FORMAT=<ID=SP,Number=1,Type=Float,Description="Phred of Chi-square p-value for strand bias">
##FORMAT=<ID=SO,Number=1,Type=String,Description="abs(log10( (RefFw*AltRv)/(RefRv*AltFw) )) for strand bias">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
##INFO=<ID=TI,Number=.,Type=String,Description="Transcript ID">
##INFO=<ID=GI,Number=.,Type=String,Description="Gene ID">
##INFO=<ID=LO,Number=.,Type=String,Description="Genetic location">
##INFO=<ID=FC,Number=.,Type=String,Description="Functional Consequence">
##INFO=<ID=PC,Number=.,Type=String,Description="Protein level change">
##INFO=<ID=DC,Number=.,Type=String,Description="DNA level change">
##INFO=<ID=EXON,Number=.,Type=String,Description="Exon number">
##INFO=<ID=CI,Number=.,Type=String,Description="Clinical impact">
##INFO=<ID=dbSNP,Number=.,Type=String,Description="dbSNP version">
##INFO=<ID=1KG,Number=0,Type=String,Description="Existing in the 1000 Genome phase 3 data">
##FILTER=<ID=R8,Description="IndelRepeatLength is greater than 8">
##FILTER=<ID=R8.1,Description="IndelRepeatLength of a monomer is greater than 8">
##FILTER=<ID=R8.2,Description="IndelRepeatLength of a dimer is greater than 8">
##FILTER=<ID=sb,Description="Variant strand bias high">
##FILTER=<ID=sb.s,Description="Variant strand bias significantly high (only for SNV)">
##FILTER=<ID=rs,Description="Variant with rs (dbSNP) number in a non-core gene">
##FILTER=<ID=FP,Description="Possibly false positives due to high similarity to off-target regions">
##FILTER=<ID=NC,Description="Noncoding INDELs on non-core genes">
##FILTER=<ID=lowDP,Description="low depth variant">
##FILTER=<ID=Benign,Description="Benign variant">
##contig=<ID=chrM,length=16569>
##contig=<ID=chr1,length=248956422>
##contig=<ID=chr2,length=242193529>
##contig=<ID=chr3,length=198295559>
##contig=<ID=chr4,length=190214555>
##contig=<ID=chr5,length=181538259>
##contig=<ID=chr6,length=170805979>
##contig=<ID=chr7,length=159345973>
##contig=<ID=chr8,length=145138636>
##contig=<ID=chr9,length=138394717>
##contig=<ID=chr10,length=133797422>
##contig=<ID=chr11,length=135086622>
##contig=<ID=chr12,length=133275309>
##contig=<ID=chr13,length=114364328>
##contig=<ID=chr14,length=107043718>
##contig=<ID=chr15,length=101991189>
##contig=<ID=chr16,length=90338345>
##contig=<ID=chr17,length=83257441>
##contig=<ID=chr18,length=80373285>
##contig=<ID=chr19,length=58617616>
##contig=<ID=chr20,length=64444167>
##contig=<ID=chr21,length=46709983>
##contig=<ID=chr22,length=50818468>
##contig=<ID=chrX,length=156040895>
##contig=<ID=chrY,length=57227415>
##contig=<ID=chrUn_GL000195v1,length=182896>
##contig=<ID=chrUn_GL000213v1,length=164239>
##contig=<ID=chrUn_GL000214v1,length=137718>
##contig=<ID=chrUn_GL000216v2,length=176608>
##contig=<ID=chrUn_GL000218v1,length=161147>
##contig=<ID=chrUn_GL000219v1,length=179198>
##contig=<ID=chrUn_GL000220v1,length=161802>
##contig=<ID=chrUn_GL000224v1,length=179693>
##contig=<ID=chrUn_GL000226v1,length=15008>
##contig=<ID=chrUn_KI270302v1,length=2274>
##contig=<ID=chrUn_KI270303v1,length=1942>
##contig=<ID=chrUn_KI270304v1,length=2165>
##contig=<ID=chrUn_KI270305v1,length=1472>
##contig=<ID=chrUn_KI270310v1,length=1201>
##contig=<ID=chrUn_KI270311v1,length=12399>
##contig=<ID=chrUn_KI270312v1,length=998>
##contig=<ID=chrUn_KI270315v1,length=2276>
##contig=<ID=chrUn_KI270316v1,length=1444>
##contig=<ID=chrUn_KI270317v1,length=37690>
##contig=<ID=chrUn_KI270320v1,length=4416>
##contig=<ID=chrUn_KI270322v1,length=21476>
##contig=<ID=chrUn_KI270329v1,length=1040>
##contig=<ID=chrUn_KI270330v1,length=1652>
##contig=<ID=chrUn_KI270333v1,length=2699>
##contig=<ID=chrUn_KI270334v1,length=1368>
##contig=<ID=chrUn_KI270335v1,length=1048>
##contig=<ID=chrUn_KI270336v1,length=1026>
##contig=<ID=chrUn_KI270337v1,length=1121>
##contig=<ID=chrUn_KI270338v1,length=1428>
##contig=<ID=chrUn_KI270340v1,length=1428>
##contig=<ID=chrUn_KI270362v1,length=3530>
##contig=<ID=chrUn_KI270363v1,length=1803>
##contig=<ID=chrUn_KI270364v1,length=2855>
##contig=<ID=chrUn_KI270366v1,length=8320>
##contig=<ID=chrUn_KI270371v1,length=2805>
##contig=<ID=chrUn_KI270372v1,length=1650>
##contig=<ID=chrUn_KI270373v1,length=1451>
##contig=<ID=chrUn_KI270374v1,length=2656>
##contig=<ID=chrUn_KI270375v1,length=2378>
##contig=<ID=chrUn_KI270376v1,length=1136>
##contig=<ID=chrUn_KI270378v1,length=1048>
##contig=<ID=chrUn_KI270379v1,length=1045>
##contig=<ID=chrUn_KI270381v1,length=1930>
##contig=<ID=chrUn_KI270382v1,length=4215>
##contig=<ID=chrUn_KI270383v1,length=1750>
##contig=<ID=chrUn_KI270384v1,length=1658>
##contig=<ID=chrUn_KI270385v1,length=990>
##contig=<ID=chrUn_KI270386v1,length=1788>
##contig=<ID=chrUn_KI270387v1,length=1537>
##contig=<ID=chrUn_KI270388v1,length=1216>
##contig=<ID=chrUn_KI270389v1,length=1298>
##contig=<ID=chrUn_KI270390v1,length=2387>
##contig=<ID=chrUn_KI270391v1,length=1484>
##contig=<ID=chrUn_KI270392v1,length=971>
##contig=<ID=chrUn_KI270393v1,length=1308>
##contig=<ID=chrUn_KI270394v1,length=970>
##contig=<ID=chrUn_KI270395v1,length=1143>
##contig=<ID=chrUn_KI270396v1,length=1880>
##contig=<ID=chrUn_KI270411v1,length=2646>
##contig=<ID=chrUn_KI270412v1,length=1179>
##contig=<ID=chrUn_KI270414v1,length=2489>
##contig=<ID=chrUn_KI270417v1,length=2043>
##contig=<ID=chrUn_KI270418v1,length=2145>
##contig=<ID=chrUn_KI270419v1,length=1029>
##contig=<ID=chrUn_KI270420v1,length=2321>
##contig=<ID=chrUn_KI270422v1,length=1445>
##contig=<ID=chrUn_KI270423v1,length=981>
##contig=<ID=chrUn_KI270424v1,length=2140>
##contig=<ID=chrUn_KI270425v1,length=1884>
##contig=<ID=chrUn_KI270429v1,length=1361>
##contig=<ID=chrUn_KI270435v1,length=92983>
##contig=<ID=chrUn_KI270438v1,length=112505>
##contig=<ID=chrUn_KI270442v1,length=392061>
##contig=<ID=chrUn_KI270448v1,length=7992>
##contig=<ID=chrUn_KI270465v1,length=1774>
##contig=<ID=chrUn_KI270466v1,length=1233>
##contig=<ID=chrUn_KI270467v1,length=3920>
##contig=<ID=chrUn_KI270468v1,length=4055>
##contig=<ID=chrUn_KI270507v1,length=5353>
##contig=<ID=chrUn_KI270508v1,length=1951>
##contig=<ID=chrUn_KI270509v1,length=2318>
##contig=<ID=chrUn_KI270510v1,length=2415>
##contig=<ID=chrUn_KI270511v1,length=8127>
##contig=<ID=chrUn_KI270512v1,length=22689>
##contig=<ID=chrUn_KI270515v1,length=6361>
##contig=<ID=chrUn_KI270516v1,length=1300>
##contig=<ID=chrUn_KI270517v1,length=3253>
##contig=<ID=chrUn_KI270518v1,length=2186>
##contig=<ID=chrUn_KI270519v1,length=138126>
##contig=<ID=chrUn_KI270521v1,length=7642>
##contig=<ID=chrUn_KI270522v1,length=5674>
##contig=<ID=chrUn_KI270528v1,length=2983>
##contig=<ID=chrUn_KI270529v1,length=1899>
##contig=<ID=chrUn_KI270530v1,length=2168>
##contig=<ID=chrUn_KI270538v1,length=91309>
##contig=<ID=chrUn_KI270539v1,length=993>
##contig=<ID=chrUn_KI270544v1,length=1202>
##contig=<ID=chrUn_KI270548v1,length=1599>
##contig=<ID=chrUn_KI270579v1,length=31033>
##contig=<ID=chrUn_KI270580v1,length=1553>
##contig=<ID=chrUn_KI270581v1,length=7046>
##contig=<ID=chrUn_KI270582v1,length=6504>
##contig=<ID=chrUn_KI270583v1,length=1400>
##contig=<ID=chrUn_KI270584v1,length=4513>
##contig=<ID=chrUn_KI270587v1,length=2969>
##contig=<ID=chrUn_KI270588v1,length=6158>
##contig=<ID=chrUn_KI270589v1,length=44474>
##contig=<ID=chrUn_KI270590v1,length=4685>
##contig=<ID=chrUn_KI270591v1,length=5796>
##contig=<ID=chrUn_KI270593v1,length=3041>
##contig=<ID=chrUn_KI270741v1,length=157432>
##contig=<ID=chrUn_KI270742v1,length=186739>
##contig=<ID=chrUn_KI270743v1,length=210658>
##contig=<ID=chrUn_KI270744v1,length=168472>
##contig=<ID=chrUn_KI270745v1,length=41891>
##contig=<ID=chrUn_KI270746v1,length=66486>
##contig=<ID=chrUn_KI270747v1,length=198735>
##contig=<ID=chrUn_KI270748v1,length=93321>
##contig=<ID=chrUn_KI270749v1,length=158759>
##contig=<ID=chrUn_KI270750v1,length=148850>
##contig=<ID=chrUn_KI270751v1,length=150742>
##contig=<ID=chrUn_KI270752v1,length=27745>
##contig=<ID=chrUn_KI270753v1,length=62944>
##contig=<ID=chrUn_KI270754v1,length=40191>
##contig=<ID=chrUn_KI270755v1,length=36723>
##contig=<ID=chrUn_KI270756v1,length=79590>
##contig=<ID=chrUn_KI270757v1,length=71251>
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  TN21-116928
chr1    6197766 rs2294714   T   C   0.0 rs  DP=1931;TI=NM_000983.3;GI=RPL22;FC=Silent;DC=c.13-10A>G;LO=INTRON;EXON=2    GT:VF:AD:SB:SA:SP:SO    0/1:0.483:999,932:883/1048:451/548,432/500:2:0.0
chr1    7677739 rs3011926   A   G   0.0 rs  DP=851;TI=NM_015215.3;GI=CAMTA1;FC=Silent;DC=c.2914+6A>G;LO=INTRON;EXON=11  GT:VF:AD:SB:SA:SP:SO    1/1:0.999:1,850:309/542:0/1,309/541:0:INF
chr1    9724365 rs11121484  C   T   0.0 rs  DP=1664;TI=NM_005026.4;GI=PIK3CD;FC=Synonymous;PC=Y936=;DC=c.2808C>T;LO=EXON;EXON=22    GT:VF:AD:SB:SA:SP:SO    0/1:0.455:907,757:842/822:448/459,394/363:6:0.0
chr1    10258594    rs12402052  C   G   0.0 rs  DP=1400;TI=NM_015074.3;GI=KIF1B;FC=Synonymous;PC=A95=;DC=c.285C>G;LO=EXON;EXON=4    GT:VF:AD:SB:SA:SP:SO    0/1:0.462:751,647:678/722:375/376,302/345:6:0.1
chr1    10295776    rs3753037   C   T   0.0 rs  DP=1050;TI=NM_015074.3;GI=KIF1B;FC=Silent;DC=c.1639+10C>T;LO=INTRON;EXON=17 GT:VF:AD:SB:SA:SP:SO    0/1:0.477:549,501:395/655:211/338,184/317:2:0.0
chr1    10375266    rs11121552  C   A   0.0 rs  DP=1487;TI=NM_015074.3;GI=KIF1B;FC=Synonymous;PC=T1721=;DC=c.5163C>A;LO=EXON;EXON=46    GT:VF:AD:SB:SA:SP:SO    0/1:0.484:767,719:870/617:443/324,427/292:3:0.0
chr1    11121270    rs11121691  C   T   0.0 .   DP=1092;TI=NM_004958.3;GI=MTOR;FC=Synonymous;PC=L2303=;DC=c.6909G>A;LO=EXON;EXON=49 GT:VF:AD:SB:SA:SP:SO    0/1:0.483:565,527:664/428:346/219,318/209:1:0.0
chr1    11130589    rs2275527   G   A   0.0 .   DP=1048;TI=NM_004958.3;GI=MTOR;FC=Synonymous;PC=S1851=;DC=c.5553C>T;LO=EXON;EXON=39 GT:VF:AD:SB:SA:SP:SO    0/1:0.509:515,533:572/476:275/240,297/236:3:0.0
chr1    11145001    rs1057079   C   T   0.0 .   DP=1392;TI=NM_004958.3;GI=MTOR;FC=Synonymous;PC=A1577=;DC=c.4731G>A;LO=EXON;EXON=33 GT:VF:AD:SB:SA:SP:SO    0/1:0.511:681,711:703/689:352/329,351/360:4:0.0
chr1    11228701    rs1064261   G   A   0.0 .   DP=1859;TI=NM_004958.3;GI=MTOR;FC=Synonymous;PC=N999=;DC=c.2997C>T;LO=EXON;EXON=19  GT:VF:AD:SB:SA:SP:SO    0/1:0.490:948,911:1059/800:536/412,523/388:2:0.0
chr1    11241657    rs1135172   A   G   0.0 .   DP=1643;TI=NM_004958.3;GI=MTOR;FC=Synonymous;PC=D479=;DC=c.1437T>C;LO=EXON;EXON=10  GT:VF:AD:SB:SA:SP:SO    0/1:0.512:801,842:793/850:376/425,417/425:5:0.0

Unfortunately, when I try to utilize the following Python code to validate my VCF file:

import pysam

def validate_vcf(vcf_file_path):
    try:
        # Open the VCF file
        vcf_file = pysam.VariantFile(vcf_file_path)

        # Iterate through the records to check if they can be read
        for record in vcf_file:
            pass

        print("VCF file is valid.")
    except Exception as e:
        print(f"Error validating VCF file: {str(e)}")

# Path to the VCF file you want to validate
vcf_file_path = "path/to/yourfile.vcf"

validate_vcf(vcf_file_path)

I receive the following error:

[W::bcf_hrec_check] Invalid tag name: "1KG"
[E::vcf_parse_format] Invalid character '/' in 'SA' FORMAT field at chr1:6197766

Does anyone know what I can do to fix this?

$\endgroup$
1
  • $\begingroup$ It looks like the validator is working, in that it's producing messages about validation. Why do you need this validator? What are you trying to use the VCF file for? $\endgroup$
    – gringer
    Commented Aug 15, 2023 at 0:09

1 Answer 1

1
$\begingroup$
  1. Given issues I've had in various programming languages that use numbers at the start of a variable, the tag issue might be related to it starting with a numeric value. Is it possible to change that from 1KG to something like ph3_1KG?

  2. According to the information in the VCF header, the SA field should have 4 values:

    ##FORMAT=<ID=SA,Number=4,Type=Integer,Description="Number of 1) forward ref alleles; 2) reverse ref; 3) forward non-ref; 4) reverse non-ref alleles, used in variant calling">
    

    While that location does have four numerical values in the actual data for that variant location, it seems like the validation code isn't expecting the forward and reverse alleles to be separated by /:

    #CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  TN21-116928
    chr1    6197766 rs2294714   T   C   0.0 rs  DP=1931;TI=NM_000983.3;GI=RPL22;FC=Silent;DC=c.13-10A>G;LO=INTRON;EXON=2    GT:VF:AD:SB:SA:SP:SO    0/1:0.483:999,932:883/1048:451/548,432/500:2:0.0
                                                                                                                                     ^^                                     ^^^^^^^^^^^^^^^
    

Whether or not these errors are actually important will depend on the program that this VCF file is used for.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.