freeseek / score

Tools to work with GWAS-VCF summary statistics files
MIT License
94 stars 6 forks source link

Liftover drop-tags finds no matching tags #6

Open meyerkm opened 3 months ago

meyerkm commented 3 months ago

Run command: bcftools +liftover -Oz -o testvcf_output.vcf.gz testvcf_input.vcf.gz -- -s source_fasta.fa -f reference.fa -c chainfile.chain.gz --reject testvcf.rejected.vcf.gz

Error #1:

INFO/AF is handled by AF rule
Number of elements in the VCF record AF should be 1 but 2 found
Use --drop-tags INFO/AF to skip this error

Which arrises in the case of needing to swap alleles. All files do have two values for the INFO/AF field , i.e. AF=0.5,0.3 Attempted fix: bcftools +liftover -Oz -o testvcf_output.vcf.gz testvcf_input.vcf.gz -- -s source_fasta.fa -f reference.fa -c chainfile.chain.gz --reject testvcf.rejected.vcf.gz --drop-tags [INFO/AF]

Error#2: No matching tag [INFO/AF]

As a check, generally querying that tag in the VCF does work : bcftools query -f '%INFO/AF' testvcf_input.vcf.gz

Maybe there is some trick to identifying the drop-tags? I have tried various inputs/string combinations for the drop-tags option without any luck.

freeseek commented 3 months ago

The correct syntax should be --drop-tags INFO/AF. But it is a bit worrisome that you have two 2 INFO/AF elements where 1 is expected. The INFO/AF field should be a Number=A field, that is, a field with one number for each alternate allele. This is mandated by the VCF specification. How do you interpret and INFO/AF field as AF=0.5,0.3 for a variant with one alternate allele?

meyerkm commented 3 months ago

Thanks for the indication, unfortunately with that syntax I still get the error from above, as if it doesn't recognize that the flag was even set.

Run command : bcftools +liftover -Oz -o testvcf_output.vcf.gz testvcf_input.vcf.gz -- -s source_fasta.fa -f reference.fa -c chainfile.chain.gz --reject testvcf.rejected.vcf.gz --drop-tags INFO/AF

Error :

INFO/AF is handled by AF rule
WARNING: bcftools version mismatch .. bcftools at 1.18, the plugin "liftover" at 1.19
Number of elements in the VCF record AF should be 1 but 2 found
Use --drop-tags INFO/AF to skip this error
freeseek commented 3 months ago

Try again using the development version from here and see if fixes the issue

jjfarrell commented 3 months ago

If the site is multi-allelic (2 alternate alleles), wouldn't there be a corresponding two AF values. Does running bcftools norm -m -any eliminate the error when running liftover?

On Wed, Mar 27, 2024 at 4:44 AM Giulio Genovese @.***> wrote:

Try again using the development version from here http://software.broadinstitute.org/software/score and see if fixes the issue

— Reply to this email directly, view it on GitHub https://github.com/freeseek/score/issues/6#issuecomment-2022222851, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAO6WDIN2MRCVEUTD66T6NTY2KBFZAVCNFSM6AAAAABFJGDDXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRSGIZDEOBVGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- John J. Farrell, Ph.D. Biomedical Genetics-Evans 218 Boston University Medical School 72 East Concord Street Boston, MA

ph: 617-358-3562 (New Number)

freeseek commented 3 months ago

Yes, if the site has two alternate alleles then INFO/AF should have two values but the problem for @meyerkm is likely a site with one alternate allele and two values from the provided explanation. A site with two alternate alleles and two INFO/AF values will work just as intended with BCFtools/liftover while BCFtools/norm will also throw an error when trying to split a multi-allelic site where the Number=A INFO field has an incorrect number of values

meyerkm commented 3 months ago

Correct @freeseek , yes I have one alternate allele but two values in the INFO/AF field. I have an AF value from two samples. I was hoping this --drop-tags flag would be able to allow things to carry-on irrespective of this detail. I am going to remove the secondary AF value that isn't the control, thus I won't have to utilize the --drop-tags.

But I can of course test the develop version you posted above, as having the drop-tags functionality work in a catch-all way may otherwise be useful!

meyerkm commented 3 months ago

The develop version you have listed above does work for those SWAP cases with the --drop-tags!

Same run command, as above, but with the development version of liftover: bcftools +liftover -Oz -o testvcf_output.vcf.gz testvcf_input.vcf.gz -- -s source_fasta.fa -f reference.fa -c chainfile.chain.gz --reject testvcf.rejected.vcf.gz --drop-tags INFO/AF

Output:

INFO/AF is handled by DROP rule
WARNING: bcftools version mismatch .. bcftools at 1.18, the plugin "liftover" at 1.19
Lines   total/swapped/reference added/rejected: 493/3/0/0