in reply to manipulating alignment data
use strict; use warnings; my $first = <DATA>; chomp $first; my $template = ''; while (<DATA>) { chomp; $template |= $first ^ $_; } for (split //, $template) { print ord == 0 ? '.' : 'X'; } print "\n"; __DATA__ ATCG--ATCG-ATCG ATGC--ATCG-ATCG ATGC-A-TCG-ATCG ATGC--ATCG-ATCG ATCG--ATCG-AACG
The output produces a dot for each column where all rows have the same character, and an X for those where there are at least two different characters:
..XX.XX.....X..
If that's not what you want, please make your description more verbose, and include the expected output for your example input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: manipulating alignment data
by jwkrahn (Abbot) on Mar 28, 2012 at 21:05 UTC | |
|
Re^2: manipulating alignment data
by AWallBuilder (Beadle) on Mar 28, 2012 at 11:55 UTC | |
by moritz (Cardinal) on Mar 28, 2012 at 12:23 UTC |