How to extractreference allele from fasta file
1
1
Entering edit mode
9.1 years ago
xinhui.wang ▴ 550

I am running vcftools to get ped file from a list of vcf files. I would like to know the reference allele for these snps and I already download the fa file from http://www.ensembl.org/info/data/ftp/index.html

However, is there some tool with which I could extract the allele information for each SNP?

Thanks and with best regards,
Xinhui

SNP • 3.5k views
ADD COMMENT
1
Entering edit mode
9.1 years ago

Index the reference and search each position with samtools faidx http://www.htslib.org/doc/samtools-1.1.html

ADD COMMENT
0
Entering edit mode

Dear Pierre, Thanks. However, i had a huge list of SNP''s in my vcf file. do you mind to show me one command hoe to index the reference and search each positon and samtools faidx is a little diffcult for me. Thanks and with best regards, Xinhui

ADD REPLY
1
Entering edit mode

something like this:

samtools faix ref.fa

grep -v "#" in.vcf | wk '{printf("%s:%s-%s\n",$1,$2,$2);}' | while read P; do samtools faix ref.fa ${P} ; done
ADD REPLY
0
Entering edit mode

Dear Pierre,

Thanks and it worked very well. However, the output is on screen and I would like to output results to a txt file. Could you help me a little more with that? Sorry I am not familiar with linux.

With best regards,

Xinhui

ADD REPLY
1
Entering edit mode
(grep -v "#" in.vcf | wk '{printf("%s:%s-%s\n",$1,$2,$2);}' | while read P; do samtools faix ref.fa ${P} ; done) > out.txt
ADD REPLY

Login before adding your answer.

Traffic: 1413 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