diff --git a/server/lib/genome/importers/api_importers/go/api_client.rb b/server/lib/genome/importers/api_importers/go/api_client.rb index 39284b36..a2bb91da 100644 --- a/server/lib/genome/importers/api_importers/go/api_client.rb +++ b/server/lib/genome/importers/api_importers/go/api_client.rb @@ -22,7 +22,7 @@ def make_get_request(uri) end def gene_lookup_base_url(id) - "https://api.geneontology.org/api/bioentity/function/%22GO:#{id}%22" + "https://api.geneontology.org/api/bioentity/function/GO:#{id}" end def params(start, rows) diff --git a/server/lib/genome/importers/api_importers/go/importer.rb b/server/lib/genome/importers/api_importers/go/importer.rb index 0d7f6b24..a1377986 100644 --- a/server/lib/genome/importers/api_importers/go/importer.rb +++ b/server/lib/genome/importers/api_importers/go/importer.rb @@ -36,13 +36,13 @@ def create_gene_claims categories.each do |category, go_id| start = 0 rows = 500 - genes = api_client.genes_for_go_id(go_id, start, rows) - while genes.count.positive? do + loop do + genes = api_client.genes_for_go_id(go_id, start, rows) genes.each do |gene| create_gene_claim_for_entry(gene, category) if gene['taxon_label'] == 'Homo sapiens' end + break if genes.count < rows start += rows - genes = api_client.genes_for_go_id(go_id, start, rows) end end end