This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Keeping only SNPs

Dear all,

I need help. I have filtered SNP in vcf format, I want to extract only informative sites (SNPs) to FASTA format, How can I do that.

Note I am working on ddRAD data. I want to extract only informative sites to make a tree. Do you have any suggestion? Thanks a lot for your kind help.

Kind Regards Safi

snp

Can you filter the SNPs you want? Extracting the fasta can be done by building a bed file with the desired coordinates (you can use awk for that) and bedtools to extract the fasta regions.

I filtered my snps with vcftools, do you have any example what i can see, thanks a lot for your kind reply

awk '{OFS="\t"; if (!/^#/){print $1,$2-100,$2+100,$1"-"$2"-"$3"-"$4"-"$5}}' $vcf > ${vcf.baseName}.bed
bedtools getfasta -name -fi $genome -bed ${vcf.baseName}.bed > ${vcf.baseName}_seq.fa

Will give you a 100 bp upstream and downstream. Also the name will include the chromosome and coordinates.

thats really great, thanks a lot, can I write to an personal email please (my email address is safiq713@gmail.com)

No.....................

0 answers

No answers yet.

Log in to answer this question.