How to get msa output in fasta format
2
0
Entering edit mode
cav3gh • 0
@cav3gh-15680
Last seen 5.6 years ago

My current code is :

mySequences <- readAAStringSet("batch_1.fa")

myFirstAlignment <- msaClustalOmega(mySequences)

msaPrettyPrint(myFirstAlignment, output=c("pdf", "tex", "dvi", "asis"))

msaPrettyPrint says that its first writes to a fasta file but does not include that as an output option, is there anyway to get that fasta file?  I am trying to use phangorn to create phylogenetic trees in downstream analysis.

 

 

 

 

msa msaprettyprint() • 4.0k views
ADD COMMENT
2
Entering edit mode
Mike Smith ★ 6.6k
@mike-smith
Last seen 2 hours ago
EMBL Heidelberg

You can use the argument alFile = /path/to/a/file.fasta to specify the location of the generated alignment file e.g.

msaPrettyPrint(myFirstAlignment, output=c("pdf", "tex", "dvi", "asis"), alFile = "/tmp/alignment.fasta")

Note that it has to have the file extension .fasta otherwise it throws an error.

ADD COMMENT
0
Entering edit mode
UBod ▴ 300
@ubodenhofer-5425
Last seen 6 months ago
University of Applied Sciences Upper Au…

If you do not want to make the extra way via the msaPrettyPrint() function, you can also directly write to a FASTA file in the following way (which is actually what msaPrettyPrint() does internally; suppose 'aln' is an object containing a multiple alignment):

writeXStringSet(as(unmasked(aln), "XStringSet"), file="aln.fasta")
ADD COMMENT

Login before adding your answer.

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