in reply to Re: substrings that consist of repeating characters
in thread substrings that consist of repeating characters
Oh ... we got a one-liner :)
DB<56> $_ = "AAATTTAGTTCTTAAGGCTGACATCGGTTTACGTCAGCGTTACCCCCCAAGTTAT +TGGGGACTTT"; DB<57> $threshold = 3; DB<58> x sort { length($b) <=> length($a) } grep { length >= $thresh +old } /(A+|C+|G+|T+)/g 0 'CCCCCC' 1 'GGGG' 2 'AAA' 3 'TTT' 4 'TTT' 5 'TTT' DB<59>
and for the original problem
DB<59> x sort { length($b) <=> length($a) } /(AA+|CC+|GG+|TT+)/g 0 'CCCCCC' 1 'GGGG' 2 'AAA' 3 'TTT' 4 'TTT' 5 'TTT' 6 'TT' 7 'TT' 8 'AA' 9 'GG' 10 'GG' 11 'TT' 12 'AA' 13 'TT' 14 'TT' DB<60>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|