How to get msa output in fasta format
2
0
Entering edit mode
cav3gh • 0
@cav3gh-15680
Last seen 5.1 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() • 3.5k views
ADD COMMENT
2
Entering edit mode
Mike Smith ★ 6.5k
@mike-smith
Last seen 1 hour 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 ▴ 290
@ubodenhofer-5425
Last seen 4 days 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: 1050 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