From ba0770c42e6410d98e4fe4eaa15144ae812d8b1c Mon Sep 17 00:00:00 2001 From: tibvdm Date: Tue, 16 Apr 2024 01:12:30 +0200 Subject: [PATCH] test --- app/controllers/mpa/pept2data_controller.rb | 13 ++----------- app/views/mpa/pept2data/pept2data.json.jbuilder | 11 +++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/controllers/mpa/pept2data_controller.rb b/app/controllers/mpa/pept2data_controller.rb index 11b2606..a65cc27 100644 --- a/app/controllers/mpa/pept2data_controller.rb +++ b/app/controllers/mpa/pept2data_controller.rb @@ -11,13 +11,10 @@ def pept2data # Request the suffix array search service search_results = search(peptides, @equate_il) + @response = search_results["result"] + taxa = [] search_results["result"].each do |result| - @response[result["sequence"]] = { - sequence: result["sequence"], - lca: result["lca"], - fa: result["fa"] - } taxa.append(result["lca"]) end @@ -26,12 +23,6 @@ def pept2data @lineages[lineage.taxon_id] = lineage.to_a_idx end - @response.each do |_, value| - @lineages["test"] = value - value["lineage_id"] = value["lca"] - value["lineage"] = @lineages[value["lca"].to_i] - end - # proteins = Set.new # search_results["result"].each do |result| # proteins.merge(result['uniprot_accessions']) diff --git a/app/views/mpa/pept2data/pept2data.json.jbuilder b/app/views/mpa/pept2data/pept2data.json.jbuilder index 4b578d9..159ad9a 100644 --- a/app/views/mpa/pept2data/pept2data.json.jbuilder +++ b/app/views/mpa/pept2data/pept2data.json.jbuilder @@ -1,2 +1,9 @@ -json.peptides(@response) -json.lineages(@lineages) +json.peptides @response do |peptide| + json.sequence peptide['sequence'] + json.lca peptide['lca'] + json.lineage @lineages[peptide['lca'].to_i] + json.fa do + json.counts peptide['fa']['num'] + json.data peptide['fa']['data'] + end +end