in reply to Perl regular expression for amino acid sequence
If you already have spaces in your sequences, you'd have to use some other character.# break up three character repeats, inserting spaces while ($seq{$k} =~ s/([QGYN])\1\1/$1$1 $1$1/g) { } while ($seq{$k} =~ m/([QGYN]{3,6})/g) { print "Match: $1 at ", pos($seq{$k}) - length($1)-2*(substr($seq{$k}, 0, pos($seq{$k})) =~ tr/ / /), + "\n"; }
Updated: Changed 5 to 6. I thought the original had a "5", but it was just the tiny fonts on my monitor.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl regular expression for amino acid sequence
by ikegami (Patriarch) on Dec 01, 2004 at 21:21 UTC |