From: George George Date: 2009-10-15T20:12:37+09:00 Subject: Re: matching against a zillion patterns > I'm not sure though about the sanity aspect of this. George, can you > disclose more details about the nature of your matching? Maybe > there's a better and / or more efficient solution. > > Kind regards > > robert Thank you so much for all the replies and suggestions! Robert, let me disclose some more information about the nature of the problem. Actually I have Protein sequences (strings of variable length composed of a 20 letter alphabet) for example "CAARGNDLYSKNIG" can be considered as a protein sequence. basically it's just a string. In my case each of the strings that i have may fall into 2 distinct classes or groups depending on whether they match a collection of about 400 distict patterns in the first instance or another 200 or so patterns in the second instance. I do not have information on which is the most common pattern. To know which of the two groups that each of my sequences fall into, i resulted in to writing the code that i had presented ealier but realised that it may be inferior, inefficient or buggy and would like to improve it. I hope this helps to define the problem. In a nutshell; Given a set of strings A, each of which may belong to a group and where a group is characterised by a huge set of patterns(to be matched against), create a method that classifies each of the strings depending on which pattern the string contains. Thank you. -- Posted via http://www.ruby-forum.com/.