Question About Coloring Alignment File
5
0
Entering edit mode
11.3 years ago
Cacau ▴ 520

Does anyone know how to color some selected columns in an alignment file? For example, how to color column 10, 11, 20 green and column 30 blue? Is there any software available? I do not want to do it by PS. Thanks a lot!

alignment • 4.8k views
ADD COMMENT
4
Entering edit mode
11.3 years ago
arnstrm ★ 1.9k

If you use nano, you can create .nanorc file in your home directory with the syntax colors in it. For example, I've created clustaw colors for proteins sequences (alignment)

syntax "clustalw" "\.clw$" "\.aln$"
color brightblue "[AILMFWV]"
color brightred "[RK]"
color brightgreen "[NQ]"
color white "[C]"
color magenta "[ED]"
color red "[G]"
color cyan "[HY]"
color brightyellow "[P]"
color green "[ST]"

and the alignment will appear as follows (must have clw or aln extensions):

alignment

ADD COMMENT
0
Entering edit mode

+1 for the .nanorc hack !

ADD REPLY
0
Entering edit mode

Very nice! Thanks a lot!

ADD REPLY
2
Entering edit mode
11.3 years ago
gordon.wells ▴ 30

In Jalview http://www.jalview.org/, set colour to "None" and then create a sequence feature for each of the columns, with whichever colour you like for each. Sequence features can also be non-contiguous and you can save them to an easy to edit text file.

ADD COMMENT
1
Entering edit mode
11.3 years ago

Your question is unclear. You don't specify the format of ouput/input (do you want html ? an image ?)

However, here is a awk script to colorize the n-th column of a text file; It uses the ANSI escape codes. Here the 20th column is red.

 curl -s "http://www.tcoffee.org/Courses/Exercises/saragosa_pb_2010/practicals/practical_2/ex.1.19/file/clustalw.msa" | \
   awk -v COL=20 '{printf("%s\x1b[31m%s\x1b[0m%s\n",substr($0,1,int(COL)-1),substr($0,int(COL),1),substr($0,int(COL)+1));}'

http://imgur.com/dDiqlWD

ADD COMMENT
0
Entering edit mode

Thanks a lot for the awk script! The question was not very clear. I was wondering an image of my alignment in which some columns were colored as what I wanted.

ADD REPLY
0
Entering edit mode
11.3 years ago
Hamish ★ 3.3k

Probably the best place to start would be any of the alignment editing and/or visualisation tools available (see List of alignment visualization software), while you will likely have to go through a few of these to find one which does exactly what you want, they beat building a custom solution for this kind of thing.

If you already have a favourite alignment editor or visualisation tool, but you can't figure out how to make it do this, you might want to contact the authors so they can either tell you how to get it to do it, or add this to their requested feature list.

ADD COMMENT
0
Entering edit mode
8.5 years ago
Suzanne ▴ 100

Jalview will let you do this. Select the column on interest as a group, then colour that group. This can be done by right clicking mouse inside the column to bring up the context menu, then select >> 'selection' >> 'edit new group' >> 'Colour group' and select colour option. Make sure 'Show Sequences Features' option is toggled off in View menu as feature colours appear about residue colours. And check the 'Apply Colour to all groups' in Colour menu is ok. This video may help you at 1min 22s with colouring groups. You may need to assign your own colour 'user defined' colour scheme though.

ADD COMMENT

Login before adding your answer.

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