Multiple Sequence Alignment
3
2
Entering edit mode
13.3 years ago
Sanju ▴ 90

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 • 12k views
ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

@neilfws what clarification you need?

ADD REPLY
5
Entering edit mode
13.3 years ago
Pasta ★ 1.3k

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')
ADD COMMENT
0
Entering edit mode

@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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
13.3 years ago

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'.

ADD COMMENT
1
Entering edit mode
13.0 years ago
User ▴ 10

"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!

ADD COMMENT

Login before adding your answer.

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