in reply to Perl regular expression for amino acid sequence
#! perl -slw use strict; my $s = 'XXQQGGYYNNQGYNNNNQNGGNGGNGGGQQQNNN'; print $s; print ' ' x( pos( $s ) - length( $1) ), $1 while $s =~ m[ ( ## Capture to $1 (?: ## A group ([QGYN]) ## of these characters (?!\2{2}) ## repeated no more than twice in successi +on ){3,6} ## 3 to 6 characters in length ? ## Remove for greedy matching. ) ]xg; ## Condensed and greedy print $s; print ' ' x( pos( $s ) - length( $1) ), $1 while $s =~ m[( (?: ([QGYN]) (?!\2{2}) ){3,6} ) ]xg; __END__ [20:37:58.32] P:\test>temp XXQQGGYYNNQGYNNNNQNGGNGGNGGGQQQNNN QQG GYY NNQ NNQ NGG NGG XXQQGGYYNNQGYNNNNQNGGNGGNGGGQQQNNN QQGGYY NNQGY NNQNGG NGGN
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl regular expression for amino acid sequence
by ikegami (Patriarch) on Dec 01, 2004 at 21:04 UTC | |
by BrowserUk (Patriarch) on Dec 01, 2004 at 21:33 UTC | |
by Roy Johnson (Monsignor) on Dec 02, 2004 at 02:03 UTC | |
by BrowserUk (Patriarch) on Dec 02, 2004 at 02:19 UTC | |
by seaver (Pilgrim) on Dec 02, 2004 at 15:59 UTC | |
by Roy Johnson (Monsignor) on Dec 02, 2004 at 16:23 UTC |