diff --git a/app/controllers/mpa/pept2data_controller.rb b/app/controllers/mpa/pept2data_controller.rb index 07b464c..29c2546 100644 --- a/app/controllers/mpa/pept2data_controller.rb +++ b/app/controllers/mpa/pept2data_controller.rb @@ -14,11 +14,11 @@ def pept2data end # Request the suffix array search service - search_results = search(peptides, equate_il) + @response = search(peptides, equate_il).uniq # Collect all lca's to look up the lineages taxa = [] - search_results["result"].each do |result| + @response.each do |result| taxa.append(result["lca"]) end @@ -26,7 +26,5 @@ def pept2data Lineage.find(taxa).each do |lineage| @lineages[lineage.taxon_id] = lineage.to_a_idx end - - @response = search_results["result"] end end diff --git a/app/helpers/suffix_array_helper.rb b/app/helpers/suffix_array_helper.rb index 002f618..29406f3 100644 --- a/app/helpers/suffix_array_helper.rb +++ b/app/helpers/suffix_array_helper.rb @@ -17,6 +17,6 @@ def search(peptides, equate_il) end # Parse the response from the suffix array search service - JSON.parse(response.body) + JSON.parse(response.body)["result"] end end