Question: Switch ref/alt alleles vcf file
0
gravatar for mdstep
11 weeks ago by
mdstep0
mdstep0 wrote:

My model system uses a reference genome from a population that is likely highly derived. I have whole genome sequencing data from two other pops, one (we can call PopB) is likely derived from the other (PopA), and both sets of reads were aligned to the reference. In short I want to take a set of polymorphisms that are fixed/nearly fixed in PopA (that are absent in the reference) and flip which allele is considered the reference in both sets of data. Multiple tests I want to do require the identification ancestral state/assumes ref=ancestral which is not the case in about 15% of the variants. I was able to simply make a list of Chromosome/positions that I want to flip the ref/alt definitions but I don't know of a way to use this list to actually flip them. I'd appreciate any help.

sequencing snp vcf • 184 views
ADD COMMENTlink written 11 weeks ago by mdstep0

Sorry, I didn't specify, it's all in VCF format.

ADD REPLYlink written 11 weeks ago by mdstep0

Hello mdstep,

if you have already a list of positions and REF/ALT alleles you want to switch, you could try something like this:

  1. The list must be one of the support types by bcftools annotate and must contain an ID
  2. Use this list and bcftools annotate to fill the ID column in the vcf file, you want to switch REF/ALT
  3. Use bcftools +fixref file.bcf -Ob -o out.bcf -- -i List_of_1.vcf.gz to switch REF/ALT based on the ID

fin swimmer

ADD REPLYlink written 11 weeks ago by finswimmer13k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1025 users visited in the last hour