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!
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!
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):
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.
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));}'
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.
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.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
+1 for the .nanorc hack !
Very nice! Thanks a lot!