Question: How to extractreference allele from fasta file
1
gravatar for xinhui.wang
4.3 years ago by
xinhui.wang170
Netherlands
xinhui.wang170 wrote:

I am runnig vcftools to get ped file from a list of vcf files. I would like to know the reference allele for thse 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 infromation for each SNP?

Thanks and with best regards,

Xinhui

snp tool • 1.7k views
ADD COMMENTlink modified 4.3 years ago by Pierre Lindenbaum121k • written 4.3 years ago by xinhui.wang170
1
gravatar for Pierre Lindenbaum
4.3 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum121k wrote:

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

ADD COMMENTlink written 4.3 years ago by Pierre Lindenbaum121k

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 REPLYlink written 4.3 years ago by xinhui.wang170
1

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 REPLYlink written 4.3 years ago by Pierre Lindenbaum121k

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 hlep me a little more with that? Sorry I am not familiar with linux.

With best regards,

Xinhui

ADD REPLYlink written 4.3 years ago by xinhui.wang170
1
(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 REPLYlink written 4.3 years ago by Pierre Lindenbaum121k
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: 928 users visited in the last hour