extract sample DP values from VCF
I want to extract only sample DP values (the second value in the example below) from my cvf file, this is my genotype annotation
0/0:7:7,0:7:244:0:0:0,-2.10721,-20.8228
0/1:3:3,1:2:74:1:37:-2.76372,0,-3.15643
0/0:9:9,0:9:321:0:0:0,-2.70927,-19.2273
0/0:11:11,0:11:407:0:0:0,-3.31133,-36.8199
How can I do that? can I do that with vcf tools? I would appreciate any suggestion!
• 4,897 views
•
link
3 answers
vcftools --geno-depth; You can have a try.
• 0 views
•
link
if you want you can use R (in my opinion it is the best solution) or bash script, for the second option you have to select the column with that field and the following command will extract the DP:
perl -F: -w 'print $F[1]'
• 0 views
•
link
cat file.vcf | awk -F ":" '/1/ {print $2}' > DP.values.from.vcf.file
• 1 views
•
link
Log in to answer this question.
Alright, this is my code /data/programs/vcftools_0.1.13/bin/vcftools --vcf my_file.vcf --geno-depth --recode --out results1.vcf
bu I get an error message: Error: Only one output function may be called.
any suggestion for this problem?
Please use
ADD COMMENTto reply to earlier answers, as such this thread remains logically structured and easy to follow.The Error says that you may not use
--geno-depthand--recodeat the same time. Try using one after other.are you able to use R? I did the same with R script