diff --git a/app/controllers/private_api/proteins_controller.rb b/app/controllers/private_api/proteins_controller.rb index 5cdead1..e602ebd 100644 --- a/app/controllers/private_api/proteins_controller.rb +++ b/app/controllers/private_api/proteins_controller.rb @@ -32,11 +32,15 @@ def proteins @proteins = UniprotEntry .includes(:taxon) .where(uniprot_accession_number: search_result["uniprot_accessions"]) - .map do |protein| { + .map do |protein| + annotations = protein.fa.split(";") + { uniprot_accession_number: protein.uniprot_accession_number, name: protein.name, organism: protein.taxon_id, - test: protein.fa.split(";") + ec_numbers: annotations.filter { |a| a.start_with? "EC" }, + go_terms: annotations.filter { |a| a.start_with? "GO" }, + interpro_entries: annotations.filter { |a| a.start_with? "IPR" } } end diff --git a/app/views/private_api/proteins/proteins.json.jbuilder b/app/views/private_api/proteins/proteins.json.jbuilder index 927be00..e50cb04 100644 --- a/app/views/private_api/proteins/proteins.json.jbuilder +++ b/app/views/private_api/proteins/proteins.json.jbuilder @@ -15,5 +15,7 @@ json.proteins @proteins do |protein| json.uniprotAccessionId protein[:uniprot_accession_number] json.name protein[:name] json.organism protein[:organism] - json.test protein[:test] + json.ecNumbers protein[:ec_numbers] + json.goTerms protein[:go_terms] + json.interproEntries protein[:interpro_entries] end