From: Logan Capaldo Date: 2007-07-19T19:35:54+09:00 Subject: Re: identify and extract positions from a string - how to? ------=_Part_56415_8776238.1184841357386 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/19/07, Marc Hoeppner wrote: > > Hi, > > I am not quite sure about how to approach the following problem: > > I have a long (long long long) string of letters, a genomic sequence > (600k characters+). > Now, what I want to do is to extract certain parts of this string, based > on the position. > So for example lets say I want all characters from position 2340 to > 5436. > > A quick pointer in the right direction would be much appreciated. I have > a vague idea that it could perhaps be done with count? Like "puts string > where string.count("actg")=2340 until string.count("actg")=5436"... ? > Not sure tho, and probably there are better ways. string[2340..5436] Cheers, > > Marc > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_56415_8776238.1184841357386--