Question: Make fasta file from SNPs in two vcf files
0
gravatar for sun.nation
3.9 years ago by
sun.nation120
United States
sun.nation120 wrote:

Hello,

I have two vcf files with SNPs compared to same reference.

Vcf1:

Position SNP

1             A

3             T

6             G

8             C

Vcf2:

2            C

6            A

8            T

10          T

There are 6 different positions, I want to make fasta files for both vcf files. N for no data.

>Vcf1

ANTGCN

>Vcf2

NCNATT

Is there any helpful tools or scripts?

Thanks in advance

SS 

 

 

phylogenetic snp forum fasta vcf • 2.4k views
ADD COMMENTlink modified 3.9 years ago by bastianxpfeifer50 • written 3.9 years ago by sun.nation120
1
gravatar for Brice Sarver
3.9 years ago by
Brice Sarver2.6k
United States
Brice Sarver2.6k wrote:

If you have a true VCF, vcf-tab-to-fasta.pl is one of the easiest ways to convert to a fasta sequence. You convert to a tab-delimited format first, then run the perl script. You can also convert to fasta with invariant reference bases using GATK's FastaAlternateReferenceMaker.

ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by Brice Sarver2.6k

Thanks Brice, This worked good.

I was wondering if I can filter based on missing data. eg if 50% sample has missing SNP in a particular position- remove that position.

ADD REPLYlink written 3.9 years ago by sun.nation120
1
gravatar for bastianxpfeifer
3.9 years ago by
Germany
bastianxpfeifer50 wrote:

Whats about the R package PopGenome,

readData(, format="VCF")

region.as.fasta(...,type=1)

Best,

Bastian

 

ADD COMMENTlink written 3.9 years ago by bastianxpfeifer50
0
gravatar for Matt Shirley
3.9 years ago by
Matt Shirley8.9k
Cambridge, MA
Matt Shirley8.9k wrote:

You can use the pyfaidx package for this. The VCF files should be tabix indexed:

ADD COMMENTlink written 3.9 years ago by Matt Shirley8.9k

I was not able to figure out how to use the script. I know less about python. Can this be used with UNIX commands after installing? Please let me know, I will try.

Thanks

ADD REPLYlink written 3.9 years ago by sun.nation120

No, if you're looking for something that is ready to run you're better off with brice's solution. Glad you found something that works!

ADD REPLYlink written 3.9 years ago by Matt Shirley8.9k
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: 1524 users visited in the last hour