How To Convert (Aligned) Text File Into An Alignment File?
2
2
Entering edit mode
12.2 years ago
Pals ★ 1.3k

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

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

ADD REPLY
3
Entering edit mode
12.2 years ago

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

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 REPLY
0
Entering edit mode

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 REPLY
3
Entering edit mode
12.2 years ago

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 COMMENT

Login before adding your answer.

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