This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Multiple Sequence Alignment

How to import clustalw output(.aln file) to R? My sequences are in fasta format.I used the following code

> library(seqinr)
> myseqs <- read.alignment("seqs.fasta", format = "fasta")

I got an error like this

Error in read.alignment("seqs.fasta", format = "fasta") : 


File seqs.fasta is not readable

I am using windows7 operating system. How to save clustalw output in windows and how can I import this aligned file in to R?

r multiple clustalw alignment

You need to clarify this question, as pointed out in the answer from pasta. If you want to import .aln, why are you trying to read .fasta?

also are the R script and the input file in the same working directory? else try putting the complete path to the input file

@neilfws what clarification you need?

3 answers

You want to import an *.aln file but you use a Fasta file ?

If you do want to import a *.ALN file then:

MyAln <- read.alignment(file = system.file("Seqs.aln", package = "seqinr"), format= 'clustal')

@pasta I tried your code. But same error is getting . I run clustalw from embl-ebi . I got the alignment. But I don't know how to save this alignment file in to my system. I clicked on "download alignment file". But file is saving as .clustalw extension.How to change this extension to .aln. I think , then only I can import *.aln file to R.

ALN and Clustalw formats are the same they just decided to get people confused :) So just rename your file "MySeqs.clustalw" to "MySeqs.aln" and then run the command I posted above

i tried the above command but it is giving the following error

Error in read.alignment(file = system.file("b.aln", package = "seqinr"),  : 
  File  is not readable

i even tried to change the permission n all but nothing is working out

Try with the full (absolute) path to the file.

Error in read.alignment(file = system.file("/home/example.aln", : File is not readable even after giving absolute path same error is coming

This is just a formatting problem. Clustalw on EMBL-EBI gives you an output in .clustalw format, but 'seqinr' only reads alignments in .fasta format.

You should convert your .clustalw to a .fasta format, with a conversion tool. There are so many conversion tools available out there, I just randomly googled this one:

http://sequenceconversion.bugaco.com/converter/biology/sequences/clustal_to_fasta.php

Then you should read your .fasta file just fine within 'seqinr'.

"ALN and Clustalw formats are the same they just decided to get people confused :) So just rename your file "MySeqs.clustalw" to "MySeqs.aln" and then run the command I posted above"

Thanks!!! I had this problem for some time. It works!

Log in to answer this question.