Yes, according with the error message there is no genotype in my vcf. However I checked my file using your suggestion and there is genotype on it.
Hi everyone,
I have a vcf-file and I'm trying to convert my vcf file into 012 genotype matrix using the following code:
vcftools --vcf myfile.vcf --012 --out out_file
I didn't have problems when I run this code before, however now the following error message appears:
Error: Require Genotypes in VCF file in order to output as 0/1/2 matrix.
I've tried increasing the number of temporary files allowed by the operating system used (e.g. ulimit -n 1000), but still didn't work.
Could someone help me? Thanks.
3 answers
there is no genotype in your vcf.
check with
grep CHROM -m1 input.vcf
what was the output of the command please.
The output of the command showed me only the following columns: #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT ID1 ID2 ID3 ... IDn Where: ID1, ID2, ID3 until IDn are the samples' ID.
Hello finswimmer,
These are the first seven lines of my file:
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT ID1* ID2* ID3* ID4* ID5*
chr1 POS1 ID1 A G . . . GT 0/0 0/1 0/0 0/0 0/1
chr1 POS2 ID2 T C . . . GT 0/1 0/1 0/0 0/0 0/0
chr1 POS3 ID3 G A . . . GT 0/0 0/1 0/1 0/0 0/1
chr1 POS4 ID4 G C . . . GT 0/1 0/0 0/1 0/0 0/1
chr1 POS5 ID5 A G . . . GT 0/1 0/0 0/0 1/1 1/1
chr1 POS6 ID6 A G . . . GT 0/0 0/1 0/1 0/0 0/1
Where: ID (1..6) are the SNPs' ID and ID*(1..5) are the Samples' ID.
Hello again,
just a guess: Maybe the * in the sample names makes some problems here. Remove them from the names and try again.
fin swimmer
i have solve the problem. 我刚刚就遇到了这个问题,并且成功解决了。 当我在比对的时候加上-R参数(bwa mem -M -t 16 -R '@RG\tID:E1\tPL:illumina\tLB:library\tSM:E1' ./ref/ref.fasta ./fqdata/SRR21936710_1.fastq fqdata/SRR21936710_2.fastq > align_bam/E1.sam),当我进行到vcftools --vcf时,就会出现该错误(vcftools Error: Require Genotypes in VCF file in order to output as 0/1/2 matrix) 然而,如果我将-R参数去除,这时候进行到vcftools --vcf时,就能够成功识别到geno type,完成后面的矩阵转化
Translated using Google Translate:
I have solved the problem. I just encountered this problem and solved it successfully. When I add the
-Rparameter when comparing (bwa mem -M -t 16 -R '@RG\tID:E1\tPL:illumina\tLB:library\tSM:E1' ./ref/ref.fasta . /fqdata/SRR21936710_1.fastq fqdata/SRR21936710_2.fastq > align_bam/E1.sam), when I proceed tovcftools --vcf, this error will appear (vcftools Error: Require Genotypes in VCF file in order to output as 0/ 1/2 matrix) However, if I remove the-Rparameter and proceed tovcftools --vcf, I can successfully identify the genotype and complete the subsequent matrix conversion.
I'm late to the party, but I was able to fix this issue by replacing the spaces between column names in the header line (beginning with #CHROM) with tabs. The hint was that vcftools was telling me that it expected #CHROM to be the "First Header entry", but the First Header entry was a list of every single column name, including all my sample names. It was treating the whole line as a single header string, as there were no tabs to delimit the columns. I used a simple find-and-replace in Notepad++ to manually replace the spaces with tabs, and was able to perform my desired analyses with vcftools afterward.
For what it's worth, I also removed unusual characters from my sample names before this (in my case, "/"). I'm unsure if that was also necessary.
Log in to answer this question.