Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
tibvdm committed Apr 15, 2024
1 parent d126f0c commit ba0770c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 2 additions & 11 deletions app/controllers/mpa/pept2data_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'])
Expand Down
11 changes: 9 additions & 2 deletions app/views/mpa/pept2data/pept2data.json.jbuilder
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ba0770c

Please sign in to comment.