This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Replace SB flag by PASS in my VCF file

My BAM files only have R1 reads and no strand bias should be assigned in my VCF files when calling variants with PISCES. However, PISCES flag SB in the annotation and occasionally (I don't know how) some variants are called with the SB flag in the INFO column.

I have discussed this issue with the main PISCES developer

https://github.com/tamsen/Pisces/issues/20

I deleted the SB annotation with bcftools. I have realised recently that I applied a filter to take PASS variants so this wrongly filters out SB variants that are not real SB variants, they are PASS (if only SB flag is in the INFO column).

So now the problem is that I need to replace SB by PASS. I was guessing that this should be a common task and that some well-known tool will handle this but I cannot see a way to do this in a simple way.

Do you know how can I identify variants with only the SB flag and replace this with PASS? There may be some variants with more than one flag (e.g. SB,q30) These should be ignored, I only care about SB variants because there are real PASS variants for me.

Do you know a way of doing this?

vcf

it's not clear whether the SB is in INFO, FORMAT or FILTER. Please provide an example.

yes, it is not clear, Sorry. It is in FILTER not in INFO. Apologies. See example

 #CHROM POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  1109026781
chr17   43074430    .   CTT C   100 PASS    DP=1795 GT:GQ:AD:DP:VF:NL:SB    0/1:100:913,882:1795:0.491:20:-100.0000
chr17   43074486    .   C   A   94  SB  DP=1794 GT:GQ:AD:DP:VF:NL:SB    0/1:94:1743,50:1794:0.028:20:-0.3829

1 answer

awk -F '\t' '($0 ~ /^#/ || $7!="SB") {print;next} {OFS="\t";$7="PASS";print;}'  input.vcf

I will try tomorrow and give you feedback, a big thanks more likely as usual.

Log in to answer this question.