Thanks Emily!!! That worked.
Hi,
I need to convert a 23andme file to vcf using bcf. The command is:
bcftools convert --tsv2vcf input.tab.gz -f ref.fa -s SampleName -Ob -o sample.bcf
I have a 23andme.txt file.
What do I use for "input.tab.gz"; can I use the 23andme.txt file or do I need to convert it first?
What do I use for "ref.fa"? Where can I get a ref.fa file for build 37?
Is "SampleName" just the name of the individual in the 23andme file?
I used plink to input the 23andme file and --recode vcf. The problem is that there is no ALT allele if the genotype is homozygous. Is there a way to insert the ALT allele? If not, then the plink solution does not help.
Thanks
2 answers
input.tab.gz is your input from 23AndMe. It's expecting a zipped file, so you may wish to zip it. Just check that your file is in the format on the bcftools page, eg:
rs6139074 20 63244 AA
rs1418258 20 63799 CC
rs6086616 20 68749 TT
rs6039403 20 69094 AG
You can get a reference FASTA for GRCh37 from Ensembl.
The Sample Name is whatever you want to call it. That's what's going to appear in the genotype header in the VCF, so it's up to you.
I was getting a result like this:
Rows total: 963047
Rows skipped: 963047
Missing GTs: 0
Hom RR: 0
Het RA: 0
Hom AA: 0
Het AA: 0
because I was using the fasta file from NCBI (GCF_000001405.25_GRCh37.p13_genomic.fna.gz). The chromosome names in the fasta file don't match those in the 23andMe file, hence every row is skipped. Using the file from Ensembl gave the expected result:
Rows total: 963047
Rows skipped: 1037
Missing GTs: 3937
Hom RR: 495570
Het RA: 278121
Hom AA: 184382
Het AA: 0
If you don't know, here is how to get a VCF from a BCF (binary VCF):
bcftools view sample.bcf > sample.vcf
Log in to answer this question.
Please use the formatting bar (especially the
codeoption) to present your post better. You can use backticks for inline code (`text` becomestext), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.New issue arose:
input.tab.gz is a 23andme.txt file that is version 2 and build 36.
ref.fa is Homo_sapiens.GRCh37.dna.primary_assembly.fa.gz.
So the ref fa is build 37 and the 23andme file is build 36. Where can I get a ref fa file for build 36? I can not find one archived at ENSEMBL.
thanks. Stuart
You can find hg16 human genome build here: https://www.ncbi.nlm.nih.gov/assembly/GCF_000001405.10/
Note that ALL of the solutions here have the same limitation as plink. It’s impossible to report an ALT allele if it simply isn’t in the data; you need an additional SNP database file. It’s only REF alleles that can be reliably filled in without that (with plink, you’d use plink2’s —ref-from-fa flag).
I thought the reply below does not have this problem, but it does. Where can we find the ALT alleles for 23andMe data?
I guess it doesn't really matter, as you only DON'T know the ALT allele when the genotype is REF/REF in the first place.
If you have several samples, you can guess the ref more reliably.