SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected end-of-file ERR with PHYLIP graceqy Bioinformatics 3 05-14-2020 01:07 AM
Extract multiple fasta sequences from a fasta file based on sequenes entomology Bioinformatics 38 12-19-2015 06:28 PM
Bootstrapping in Neighbor (Phylip package) nehaverma General 2 03-19-2015 10:10 AM
what is wrong with this phylip-file? (Can't be read by fpars) someperson Bioinformatics 1 07-21-2014 05:15 AM
Tools to generate VCF from two FASTA, or mutant FASTA from Ref FASTA and VCF? jeffseq Bioinformatics 3 05-28-2013 10:59 AM

Reply
 
Thread Tools
Old 06-29-2017, 07:01 AM   #1
ac91
Member
 
Location: porto

Join Date: Aug 2015
Posts: 13
Default phylip to fasta

Hi,

Can anyone provide me a script in python or perl that converts phylip interleaved into fasta? I already found some scripts but it seems that they all work with phylip sequential and not with interleaved.

Thanks a lot!!
ac91 is offline   Reply With Quote
Old 06-29-2017, 10:23 AM   #2
Brian Bushnell
Super Moderator
 
Location: Walnut Creek, CA

Join Date: Jan 2014
Posts: 2,707
Default

What a coincidence, I have a script which does just that in the BBMap package!

Code:
phylip2fasta.sh in=file.phylip out=file.fasta
Brian Bushnell is offline   Reply With Quote
Old 06-29-2017, 10:54 AM   #3
ac91
Member
 
Location: porto

Join Date: Aug 2015
Posts: 13
Default

Thanks so much!

I already saw that there are others useful scripts in bbmap.
ac91 is offline   Reply With Quote
Old 06-30-2017, 01:13 AM   #4
ac91
Member
 
Location: porto

Join Date: Aug 2015
Posts: 13
Default

Quote:
Originally Posted by Brian Bushnell View Post
What a coincidence, I have a script which does just that in the BBMap package!

Code:
phylip2fasta.sh in=file.phylip out=file.fasta
Sorry Brian, but seems that your script does not work well with my files. Can you tell me why?

For example:
file.phy
3 120
seq1 ATGTGTTCAGCTCTAGTCGACAAGTATTTCAACTACCAGGAACCTCCGAATCGACAACTT
seq2 ATGTGTTCGGCTCTTGTAGAGAGACATTTCAGCTTCATAGCGTCTTCG------------
seq3 ATGTGTTCAGCTCTAGTCGACAAATATTTTAACTACCAGGAACCTCCTGATCGACAACAC

CAACTTTCGTTTGAAGACTCCAAAATGGCCTACGACAACGGGTCGGACAGCCAGGGCTCG
------AGGTTTGAAGACTCGAGAATGGCTTACGACAACGGGTCGGACAGCCAGGGTTCG
CAGCTTCAATTTGAGGCCACCAAAATGGCCTACGACAACGGCTCAGATAGCCAAGGCTCC

file.fas
>seq1
ATGTGTTCAGCTCTAGTCGACAAGTATTTCAACTACCAGGAACCTCCGAATCGACAACTT
>seq2
ATGTGTTCGGCTCTTGTAGAGAGACATTTCAGCTTCATAGCGTCTTCG
>seq3
ATGTGTTCAGCTCTAGTCGACAAATATTTTAACTACCAGGAACCTCCTGATCGACAACAC
>CAACTTTCGTTTGAAGACTCCAAAATGGCCTACGACAACGGGTCGGACAGCCAGGGCTCG

>------AGGTTTGAAGACTCGAGAATGGCTTACGACAACGGGTCGGACAGCCAGGGTTCG

>CAGCTTCAATTTGAGGCCACCAAAATGGCCTACGACAACGGCTCAGATAGCCAAGGCTCC
ac91 is offline   Reply With Quote
Old 06-30-2017, 08:05 AM   #5
Brian Bushnell
Super Moderator
 
Location: Walnut Creek, CA

Join Date: Jan 2014
Posts: 2,707
Default

I only had a chance to try it on one file, and it worked fine in that case, but that's not a very robust test... can you send me the file you're using?

What you have posted might be enough to replicate the problem, but to ensure it works correctly in entirety, the full file is probably essential.
Brian Bushnell is offline   Reply With Quote
Old 07-02-2017, 06:53 AM   #6
dgscofield
Member
 
Location: Uppsala, Sweden

Join Date: Nov 2010
Posts: 27
Default

If you haven't already found a solution, I've got a simple script that can interconvert between any of the formats supported in BioPerl's Bio::AlignIO, which you'd need to have installed. For Phylip to Fasta:

Code:
convertAlignment.pl -if phylip -of fasta < file.phy > file.fa
It's available in my bioinfo/scripts repository.
dgscofield is offline   Reply With Quote
Old 07-03-2017, 01:37 AM   #7
ac91
Member
 
Location: porto

Join Date: Aug 2015
Posts: 13
Default

Quote:
Originally Posted by Brian Bushnell View Post
I only had a chance to try it on one file, and it worked fine in that case, but that's not a very robust test... can you send me the file you're using?

What you have posted might be enough to replicate the problem, but to ensure it works correctly in entirety, the full file is probably essential.

Sorry for the late reply.
You can find my files attached, but I changed the fasta and phylip to .txt because is impossible to attach files with that extensions.
Attached Files
File Type: txt others12512.trim.fas.txt (378 Bytes, 0 views)
File Type: txt others12512.trim.phy.txt (403 Bytes, 1 views)
ac91 is offline   Reply With Quote
Reply

Tags
phylip

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO