Question: How To Convert (Aligned) Text File Into An Alignment File?
2
gravatar for Pals
7.5 years ago by
Pals1.3k
Finland
Pals1.3k wrote:

I have a text file that have sequences (including gaps and excluding headers) making matrix size 738x708. I want to read that file as an alignment. How can that be made possible?

And Yes, the text file is an alignment in itself.

Thanks!

alignment text • 2.8k views
ADD COMMENTlink modified 7.5 years ago by Alastair Kerr5.2k • written 7.5 years ago by Pals1.3k
3

I'd say the text file /is/ an alignment. Perhaps you could be more specific?

ADD REPLYlink written 7.5 years ago by Ketil4.0k
3
gravatar for Larry_Parnell
7.5 years ago by
Larry_Parnell16k
Boston, MA USA
Larry_Parnell16k wrote:

One solution is to write a simple script to parse the alignment you have in text format. The complexity of that script of course depends on what you wish to extract from the alignment. Counting numbers of different residues/gaps per column is rather simple, for example. Other analyses could be more complex. Do you want to build an HMM? There are tools for this where you'd have to do little to no editing of your alignment other than paring it to what constitutes a (conserved) domain.

ADD COMMENTlink written 7.5 years ago by Larry_Parnell16k

The story behind the text file is that I used original alignment file to generate positional corrrelation after employing cut-off value. The length of the alignment decreased from 1600 to 708. I extracted the data from MATLAB workspace and saved as text file. Now, I want to get consensus out the new version of the alignment. Its very unlikely that I would be able to write script and would highly prefer to know programs or techniques.

ADD REPLYlink written 7.5 years ago by Pals1.3k

The new alignment was generated from the parent alignment after truncating with certain cut-off value in MATLAB. I just want the new alignment to be used for general studies such as looking at the conserved sites and degree of conservation in an alignment editor.

ADD REPLYlink written 7.5 years ago by Pals1.3k
3
gravatar for Alastair Kerr
7.5 years ago by
Alastair Kerr5.2k
The University of Edinburgh, UK
Alastair Kerr5.2k wrote:

Assuming that the text file looks like this

ATGG..
ATGA..
AATT..

The simplest solution would be to turn the matrix into a fasta file by adding ">$id\n" in front of every row, where $id is a unique identifier. Example of a perl one liner.

perl -ne '$id++; print ">$id\n$_"' filename

Most alignment programs/editors (e.g.JalView) can use fasta based alignments

ADD COMMENTlink modified 7.5 years ago • written 7.5 years ago by Alastair Kerr5.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1461 users visited in the last hour