bcftools stats not counting samples
1
0
Entering edit mode
10 weeks ago
alba • 0

Hello.

I'm trying to view substitutions specific to sample-names from my vcf. I have ran

bcftools stats --samples '-' file1.vcf.gz file2.vcf.gz > both_vcf.gz.stats

as well as

plot-vcfstats --sample-names both_vcf.gz.stats -p output_dir/

The stats look like the following:

Figure 1

Figure 2

Figure 3

I would like to obtain a plot from plot-vcfstats that gives the substitution types per sample-name, but instead i get 1) it looks like it is not able to count the variants on a sample-specific level as shown in Figure 3; and 2) the substitution plot from vcfstats gives only the info from Figure 1.

Any help to understand what's going on is greatly appreciated, thank you!

bcftools Variant-Calling • 529 views
ADD COMMENT
2
Entering edit mode
10 weeks ago

one can get a table SAMPLE,SUBST,COUNT by running a loop over the samples:

$ bcftools query -l in.vcf.gz | while read SN; do bcftools view --samples ${SN} -O u in.vcf.gz | bcftools view -O u -i 'AC[*]>0' | bcftools stats - | awk -vSN=${SN} '$1=="ST" {printf("%s\t%s\t%s\n",SN,$3,$4);}'  ; done 
ADD COMMENT
0
Entering edit mode

Thank you very much! That works but I'm wondering, is there any way plot-vcfstats can read that table? As it is not a file directly generated by bcftools stats, it doesn't recognize it.

ADD REPLY
0
Entering edit mode

it could be a simple plot using R...

ADD REPLY
0
Entering edit mode

yep! i just did it with matplotlib, i thought maybe there was a way of doing it quicker with the bcftools options. Thank you very much!

ADD REPLY
1
Entering edit mode

Don't forget to follow up on your threads. If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work. If an answer was not really helpful or did not work, provide detailed feedback so others know not to use that answer.

Upvote|Bookmark|Accept

ADD REPLY

Login before adding your answer.

Traffic: 1614 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6