{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":939,"title":"DNA Pattern Match:  Performance  Metric - Speed","description":"The Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\r\n\r\nAt \u003chttp://imacst.com/issues/volume-3issue-1/ IMACST\u003e the paper \u003chttp://imacst.com/web_documents/1202002.pdf An Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003e claimed an astounding time improvement from  9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\r\n\r\nMatlab can achieve matching a six pattern set of L=6 in \u003c15 msec (i5/16GB). This is merely a 99.8% time reduction.\r\n\r\n\r\n*Challenge Description:*\r\nDNA is made of letters ACGT, \u003chttp://en.wikipedia.org/wiki/DNA wiki DNA\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\r\n\r\n*Input:* [DNA, DNA_ID, Patterns]\r\n\r\n* DNA is a 1.8M long uint8 row vector of values 0 thru 3.\r\n* DNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\r\n* Patterns is an Nx6 uint8 array where each row corresponds to a search pattern.\r\n\r\n*Output:* Locations\r\n\r\nLocations of all start indices that match any of the patterns\r\n\r\n*Scoring:* Average Time (msec) for a block of L=6 patterns\r\n\r\nExample:\r\n\r\n* DNA= [0 1 2 3 3 2 1 0 1 2 3 3]\r\n* Pattern = [2 3 3 2 1 0]\r\n* Locations = [3]\r\n\r\n*Hints:*\r\n\r\n* Vectorization (Base 4 to Base 10 of 6 character words)\r\n* Bitshift/Reshape to create all words\r\n* Logical Indexing\r\n \r\n\r\nComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza","description_html":"\u003cp\u003eThe Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\u003c/p\u003e\u003cp\u003eAt \u003ca href=\"http://imacst.com/issues/volume-3issue-1/\"\u003eIMACST\u003c/a\u003e the paper \u003ca href=\"http://imacst.com/web_documents/1202002.pdf\"\u003eAn Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003c/a\u003e claimed an astounding time improvement from  9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\u003c/p\u003e\u003cp\u003eMatlab can achieve matching a six pattern set of L=6 in \u0026lt;15 msec (i5/16GB). This is merely a 99.8% time reduction.\u003c/p\u003e\u003cp\u003e\u003cb\u003eChallenge Description:\u003c/b\u003e\r\nDNA is made of letters ACGT, \u003ca href=\"http://en.wikipedia.org/wiki/DNA\"\u003ewiki DNA\u003c/a\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [DNA, DNA_ID, Patterns]\u003c/p\u003e\u003cul\u003e\u003cli\u003eDNA is a 1.8M long uint8 row vector of values 0 thru 3.\u003c/li\u003e\u003cli\u003eDNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\u003c/li\u003e\u003cli\u003ePatterns is an Nx6 uint8 array where each row corresponds to a search pattern.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Locations\u003c/p\u003e\u003cp\u003eLocations of all start indices that match any of the patterns\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Average Time (msec) for a block of L=6 patterns\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cul\u003e\u003cli\u003eDNA= [0 1 2 3 3 2 1 0 1 2 3 3]\u003c/li\u003e\u003cli\u003ePattern = [2 3 3 2 1 0]\u003c/li\u003e\u003cli\u003eLocations = [3]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eHints:\u003c/b\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eVectorization (Base 4 to Base 10 of 6 character words)\u003c/li\u003e\u003cli\u003eBitshift/Reshape to create all words\u003c/li\u003e\u003cli\u003eLogical Indexing\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza\u003c/p\u003e","function_template":"function Locations = find_DNA(DNA, DNA_ID, Patterns)\r\n persistent DNA_ID_loaded  % add other DNA created variables\r\n Locations=[];\r\n if isempty(DNA_ID_loaded) || DNA_ID~=DNA_ID_loaded\r\n  % Perform initialization actions on DNA vector - optional\r\n  DNA_ID_loaded=DNA_ID;\r\n  \r\n end % DNA_ID Processing\r\n\r\n\r\n\r\n \r\nend\r\n\r\n\r\n\r\n\r\n","test_suite":"%%\r\nfeval(@assignin,'caller','score',0);\r\n%%\r\n% Functionality Section\r\nPass=1;\r\nw=6;\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=1;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nif isempty(Locations),Pass=0;end\r\nif max(size(Locations))\u003c1024,Pass=0;end\r\nfor i=1:size(Locations,1)\r\n      Pass=Pass \u0026\u0026 ismember(DNA(Locations(i,end):Locations(i,end)+w-1),Patterns,'rows');\r\n    end\r\n\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,24,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:12,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=2;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nif isempty(Locations),Pass=0;end\r\nif max(size(Locations))\u003c1024,Pass=0;end\r\nfor i=1:size(Locations,1)\r\n      Pass=Pass \u0026\u0026 ismember(DNA(Locations(i,end):Locations(i,end)+w-1),Patterns,'rows');\r\n    end\r\n\r\n\r\nassert(isequal(Pass,1))\r\n%%\r\n% Timing Section\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=1;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt1=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 1 Time = %i msec\\n',floor(dt1))\r\n\r\n\r\nPatterns=randi(4,24,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:12,:); % Take first 12 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt2=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 2 Time = %i msec\\n',floor(dt2))\r\n\r\n\r\n% New DNA Set\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=2;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt3=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 3 Time = %i msec\\n',floor(dt3))\r\n\r\n\r\nfeval(@assignin,'caller','score',min(400,floor(double(dt1+dt2+dt3)/30)));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2012-09-10T03:41:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-10T00:09:00.000Z","updated_at":"2025-11-21T09:02:33.000Z","published_at":"2012-09-10T03:40:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://imacst.com/issues/volume-3issue-1/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eIMACST\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e the paper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://imacst.com/web_documents/1202002.pdf\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAn Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e claimed an astounding time improvement from 9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMatlab can achieve matching a six pattern set of L=6 in \u0026lt;15 msec (i5/16GB). This is merely a 99.8% time reduction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eChallenge Description:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e DNA is made of letters ACGT,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/DNA\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewiki DNA\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [DNA, DNA_ID, Patterns]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA is a 1.8M long uint8 row vector of values 0 thru 3.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePatterns is an Nx6 uint8 array where each row corresponds to a search pattern.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Locations\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLocations of all start indices that match any of the patterns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Average Time (msec) for a block of L=6 patterns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA= [0 1 2 3 3 2 1 0 1 2 3 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePattern = [2 3 3 2 1 0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLocations = [3]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVectorization (Base 4 to Base 10 of 6 character words)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBitshift/Reshape to create all words\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLogical Indexing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":939,"title":"DNA Pattern Match:  Performance  Metric - Speed","description":"The Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\r\n\r\nAt \u003chttp://imacst.com/issues/volume-3issue-1/ IMACST\u003e the paper \u003chttp://imacst.com/web_documents/1202002.pdf An Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003e claimed an astounding time improvement from  9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\r\n\r\nMatlab can achieve matching a six pattern set of L=6 in \u003c15 msec (i5/16GB). This is merely a 99.8% time reduction.\r\n\r\n\r\n*Challenge Description:*\r\nDNA is made of letters ACGT, \u003chttp://en.wikipedia.org/wiki/DNA wiki DNA\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\r\n\r\n*Input:* [DNA, DNA_ID, Patterns]\r\n\r\n* DNA is a 1.8M long uint8 row vector of values 0 thru 3.\r\n* DNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\r\n* Patterns is an Nx6 uint8 array where each row corresponds to a search pattern.\r\n\r\n*Output:* Locations\r\n\r\nLocations of all start indices that match any of the patterns\r\n\r\n*Scoring:* Average Time (msec) for a block of L=6 patterns\r\n\r\nExample:\r\n\r\n* DNA= [0 1 2 3 3 2 1 0 1 2 3 3]\r\n* Pattern = [2 3 3 2 1 0]\r\n* Locations = [3]\r\n\r\n*Hints:*\r\n\r\n* Vectorization (Base 4 to Base 10 of 6 character words)\r\n* Bitshift/Reshape to create all words\r\n* Logical Indexing\r\n \r\n\r\nComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza","description_html":"\u003cp\u003eThe Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\u003c/p\u003e\u003cp\u003eAt \u003ca href=\"http://imacst.com/issues/volume-3issue-1/\"\u003eIMACST\u003c/a\u003e the paper \u003ca href=\"http://imacst.com/web_documents/1202002.pdf\"\u003eAn Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003c/a\u003e claimed an astounding time improvement from  9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\u003c/p\u003e\u003cp\u003eMatlab can achieve matching a six pattern set of L=6 in \u0026lt;15 msec (i5/16GB). This is merely a 99.8% time reduction.\u003c/p\u003e\u003cp\u003e\u003cb\u003eChallenge Description:\u003c/b\u003e\r\nDNA is made of letters ACGT, \u003ca href=\"http://en.wikipedia.org/wiki/DNA\"\u003ewiki DNA\u003c/a\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [DNA, DNA_ID, Patterns]\u003c/p\u003e\u003cul\u003e\u003cli\u003eDNA is a 1.8M long uint8 row vector of values 0 thru 3.\u003c/li\u003e\u003cli\u003eDNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\u003c/li\u003e\u003cli\u003ePatterns is an Nx6 uint8 array where each row corresponds to a search pattern.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Locations\u003c/p\u003e\u003cp\u003eLocations of all start indices that match any of the patterns\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Average Time (msec) for a block of L=6 patterns\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cul\u003e\u003cli\u003eDNA= [0 1 2 3 3 2 1 0 1 2 3 3]\u003c/li\u003e\u003cli\u003ePattern = [2 3 3 2 1 0]\u003c/li\u003e\u003cli\u003eLocations = [3]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eHints:\u003c/b\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eVectorization (Base 4 to Base 10 of 6 character words)\u003c/li\u003e\u003cli\u003eBitshift/Reshape to create all words\u003c/li\u003e\u003cli\u003eLogical Indexing\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza\u003c/p\u003e","function_template":"function Locations = find_DNA(DNA, DNA_ID, Patterns)\r\n persistent DNA_ID_loaded  % add other DNA created variables\r\n Locations=[];\r\n if isempty(DNA_ID_loaded) || DNA_ID~=DNA_ID_loaded\r\n  % Perform initialization actions on DNA vector - optional\r\n  DNA_ID_loaded=DNA_ID;\r\n  \r\n end % DNA_ID Processing\r\n\r\n\r\n\r\n \r\nend\r\n\r\n\r\n\r\n\r\n","test_suite":"%%\r\nfeval(@assignin,'caller','score',0);\r\n%%\r\n% Functionality Section\r\nPass=1;\r\nw=6;\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=1;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nif isempty(Locations),Pass=0;end\r\nif max(size(Locations))\u003c1024,Pass=0;end\r\nfor i=1:size(Locations,1)\r\n      Pass=Pass \u0026\u0026 ismember(DNA(Locations(i,end):Locations(i,end)+w-1),Patterns,'rows');\r\n    end\r\n\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,24,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:12,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=2;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nif isempty(Locations),Pass=0;end\r\nif max(size(Locations))\u003c1024,Pass=0;end\r\nfor i=1:size(Locations,1)\r\n      Pass=Pass \u0026\u0026 ismember(DNA(Locations(i,end):Locations(i,end)+w-1),Patterns,'rows');\r\n    end\r\n\r\n\r\nassert(isequal(Pass,1))\r\n%%\r\n% Timing Section\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=1;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt1=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 1 Time = %i msec\\n',floor(dt1))\r\n\r\n\r\nPatterns=randi(4,24,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:12,:); % Take first 12 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt2=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 2 Time = %i msec\\n',floor(dt2))\r\n\r\n\r\n% New DNA Set\r\nDNA=randi(4,1,1800000,'uint8')-1;\r\nPatterns=randi(4,12,6,'uint8')-1; % Create more than needed\r\nPatterns=unique(Patterns,'rows','stable'); % Elim dupes but maintain random\r\nPatterns=Patterns(1:6,:); % Take first 6 random vectors\r\nPatterns=unique(Patterns,'rows'); % Place in order for easier debugging\r\n\r\nDNA_ID=2;\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\nLocations = find_DNA(DNA, DNA_ID, Patterns);\r\n\r\nt0=clock;\r\nfor i=1:10\r\n Locations = find_DNA(DNA, DNA_ID, Patterns);\r\nend\r\ndt3=etime(clock,t0)*1000; % msec conversion\r\nfprintf('Your Set 3 Time = %i msec\\n',floor(dt3))\r\n\r\n\r\nfeval(@assignin,'caller','score',min(400,floor(double(dt1+dt2+dt3)/30)));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2012-09-10T03:41:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-10T00:09:00.000Z","updated_at":"2025-11-21T09:02:33.000Z","published_at":"2012-09-10T03:40:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenge is to Rapidly find matches of DNA sequences, Length=6, in a 1,800,000 long DNA file.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAt\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://imacst.com/issues/volume-3issue-1/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eIMACST\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e the paper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://imacst.com/web_documents/1202002.pdf\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAn Intelligent and Efficient Matching Algorithm to Finding a DNA Pattern\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e claimed an astounding time improvement from 9.94 seconds to 7.84 seconds, 21% time reduction, to match six segments of length 6 in a 1.8M long DNA file. Basic probability asserts 1.8M/4^6 * 6 = 2637 matches. The paper's test case produced 2346 matches. The method employed used text processing in C++. The paper's L=25 and L=50 cases will be later challenges.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMatlab can achieve matching a six pattern set of L=6 in \u0026lt;15 msec (i5/16GB). This is merely a 99.8% time reduction.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eChallenge Description:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e DNA is made of letters ACGT,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/DNA\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewiki DNA\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which for the purposes of this Matlab Cody Challenge are given values 0 thru 3. (ACGT= 0123)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [DNA, DNA_ID, Patterns]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA is a 1.8M long uint8 row vector of values 0 thru 3.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA_ID identifies the DNA segment being processed. Multiple calls using the same DNA_ID will be performed. The first call of a DNA_ID is not timed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePatterns is an Nx6 uint8 array where each row corresponds to a search pattern.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Locations\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLocations of all start indices that match any of the patterns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Average Time (msec) for a block of L=6 patterns\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDNA= [0 1 2 3 3 2 1 0 1 2 3 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePattern = [2 3 3 2 1 0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLocations = [3]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVectorization (Base 4 to Base 10 of 6 character words)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBitshift/Reshape to create all words\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLogical Indexing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eComing soon: Genome DNA sequencing of PhagePhix174 and Haempphilus Influenza\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"fast_find\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"fast_find\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"fast_find\"","","\"","fast_find","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f3034a8a5a0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f3034a8a500\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f3034a89a60\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f3034a8aa00\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f3034a8a960\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f3034a8a6e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f3034a8a640\u003e":"tag:\"fast_find\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f3034a8a640\u003e":"tag:\"fast_find\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"fast_find\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"fast_find\"","","\"","fast_find","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f3034a8a5a0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f3034a8a500\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f3034a89a60\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f3034a8aa00\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f3034a8a960\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f3034a8a6e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f3034a8a640\u003e":"tag:\"fast_find\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f3034a8a640\u003e":"tag:\"fast_find\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":939,"difficulty_rating":"medium"}]}}