freeseek / gtc2vcf

Tools to convert Illumina IDAT/BPM/EGT/GTC and Affymetrix CEL/CHP files to VCF
MIT License
143 stars 24 forks source link

ALLELE_A and ALLELE_B encoding in the VCF? #68

Open rajwanir opened 5 months ago

rajwanir commented 5 months ago

Hi @freeseek ,

What does 0 and 1 represent for ALLELE_A and ALLELE_B in the VCF INFO?

It seems like the Picard tools GtcToVcf implementation write alleles themselves in the Allele A and Alllele B place?https://github.com/search?q=repo%3Abroadinstitute%2Fpicard%20getAlleleA&type=code

I wanted to convert the VCF to adpc.bin throught the Picard tools to run through VerifyIDintensity (https://github.com/gjun/verifyIDintensity) for contamination checks and noted some inconsistency/incompatiblity. Do you have any thoughts?

Thanks.

freeseek commented 5 months ago

Yeah, ALLELE_A and ALLELE_B are integer rather than string variables for two important reasons:

rajwanir commented 5 months ago

Thanks Giulio. Makes sense.

Do you have any suggestions on any straightforward way of filling in the ALLELE_A/ALLELE_B INFO tags back to possibly REF/ALT for it be compatible with the Picard tools? Essentially I might need to transform the VCF to adpc.bin to do contamination checks with VerifyIDintensity. I am looking at the bcftools +fill tags but seems like it might just fill back the 0 and 1 encoding.

freeseek commented 5 months ago

I see. Maybe I will rewrite VerifyIDintensity to work with VCFs as this seems a very simple but valuable piece of software. Where do you get the ABF allele frequencies to run VerifyIDintensity?

rajwanir commented 5 months ago

That would be an ideal solution. I did forked VerifyIDintensity and see if I could edit it to accept text input instead of the binarized adpc.bin but then paused. :smiley:

  1. Essentially it only needs the the normalized intensities, gentrain score and genotype (format here: https://github.com/broadinstitute/picard/blob/c8b2c06b29b22d4bf1bf4270788d3a3e206a8183/src/main/java/picard/arrays/illumina/IlluminaAdpcFileWriter.java). This could be easily pulled with a simple bcftools query command bcftools query -f '[%X\t%Y\t%NORMX\t%NORMY\t%GenTrain_Score\t%GT\n]'
  2. Adding a switch in VerifyIDintensity to accept text input is straightforward.
  3. However,
    • VerifyIDintensity code seems to streaming the file and pulling sample info one by one. The expected format is (sample1-snp1) .. (sample1-snpN) - (sample2-snp1) .. (sample2-snpN). On the other hand, the typical output from the bcftools query is (sample1-snp1) - (sample2-snp1) .. (sample1-snpN) .. (sample2-snpN). This is fixable by looping over sample individually and then concatenating at the end.
    • Since it's internal functions pull/streams specific values based on position in the file. Either, the line width has to be consistent so all values will have to under go sprintf preprocessing or will need write TSV parser and ensure values are pulled correctly to all it's internal functions.

Needless to say a direct VCF input would be a cleaner solution.

ABF allele frequencies is typically pulled form 1000genomes project. It's a text file can be prepared separately.

Thanks.