Skip to content

Commit 550cc1d

Browse files
committed
Update for changes in AF rest API
1 parent 49414ff commit 550cc1d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/alphafold.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,16 @@ function alphafoldfiles(msa::AnnotatedMultipleSequenceAlignment, dirname=pwd();
7171
end
7272

7373
"""
74-
url = query_alphafold_latest(uniprotXname)
74+
url = query_alphafold_latest(uniprotXname; format="cif")
7575
7676
Query the [AlphaFold](https://alphafold.com/) API for the latest structure of `uniprotXname`.
77+
`format` should be "cif", "pdb", or "bcif".
7778
"""
78-
function query_alphafold_latest(uniprotXname)
79-
resp = HTTP.get("https://alphafold.com/api/prediction/$uniprotXname"; status_exception = false)
79+
function query_alphafold_latest(uniprotXname; format="cif")
80+
resp = HTTP.get("https://alphafold.com/api/prediction/$uniprotXname?key=AIzaSyCeurAJz7ZGjPQUtEaerUkBZ3TaBkXrY94", ["Accept" => "application/json"]; status_exception = false)
8081
if resp.status == 200
8182
j = JSON3.read(String(resp.body))[1]
82-
return j["pdbUrl"]
83+
return j["$(format)Url"]
8384
end
8485
return nothing
8586
end

src/naming_conventions.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ function query_uniprot_accession(id)
9797
read(iogz, String)
9898
end
9999
j = JSON3.read(uncompr_body)
100-
return j["results"][1]["primaryAccession"]
100+
results = j["results"]
101+
isempty(results) && return nothing
102+
return results[1]["primaryAccession"]
101103
end
102104
end
103105
return nothing

0 commit comments

Comments
 (0)