Skip to content

Commit aa0c849

Browse files
authored
Merge pull request #5 from MurrellGroup/consistent-order
fix: consistent ordering
2 parents 781d2ee + d6891c3 commit aa0c849

File tree

4 files changed

+31
-274
lines changed

4 files changed

+31
-274
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PyBoltz"
22
uuid = "0bca4874-a2b8-4dca-bc03-d2d86e344f1f"
33
authors = ["Anton Oresten and Aron Stålmarck"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[deps]
77
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
@@ -27,16 +27,16 @@ CondaPkg = "0.2"
2727
ProteinChains = "0.7"
2828
PythonCall = "0.9"
2929
Scratch = "1"
30-
TMscore_jll = "1.0.0"
30+
TMscore = "0.1.0"
3131
YAML = "0.4"
3232
julia = "1.10"
3333

3434
[extras]
3535
BioAlignments = "00701ae9-d1dc-5365-b64a-a3a3ebf5695e"
3636
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
3737
BioStructures = "de9282ab-8554-53be-b2d6-f6c222edabfc"
38-
TMscore_jll = "1d8dad79-2f3d-554c-bf22-543753cb6ff4"
38+
TMscore = "6e960f36-814a-4ceb-8c87-6ab5da0e9bff"
3939
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4040

4141
[targets]
42-
test = ["Test", "BioAlignments", "BioSequences", "BioStructures", "TMscore_jll"]
42+
test = ["Test", "BioAlignments", "BioSequences", "BioStructures", "TMscore"]

ext/BioStructuresExt.jl

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,37 @@ function PyBoltz.predict(input, ::Type{MolecularStructure}; options...)
1919
options...)
2020
prediction_paths = readdir(joinpath(out_dir, only(readdir(out_dir)), "predictions"); join=true)
2121
prediction_names = basename.(prediction_paths)
22-
structures = MolecularStructure[]
23-
perm, structure_names = if all(name -> startswith(name, PyBoltz.PYBOLTZ_INPUT_INDEX_PREFIX), prediction_names)
24-
indices = Int[]
25-
structure_names = String[]
22+
23+
local results
24+
if all(name -> startswith(name, PyBoltz.PYBOLTZ_INPUT_INDEX_PREFIX), prediction_names)
25+
# output vector needs to match input vector (with possible missing values)
26+
@assert input isa AbstractVector{PyBoltz.Schema.MolecularInput}
27+
results = Union{MolecularStructure,Missing}[fill(missing, length(input))...]
2628
for prediction_name in prediction_names
2729
index, name = split(split(prediction_name, PyBoltz.PYBOLTZ_INPUT_INDEX_PREFIX, limit=2)[2], "_", limit=2)
28-
push!(indices, parse(Int, index))
29-
push!(structure_names, name)
30+
idx = parse(Int, index)
31+
prediction_path = joinpath(joinpath(out_dir, only(readdir(out_dir)), "predictions"), prediction_name)
32+
cif_path = joinpath(prediction_path, basename(prediction_path)*"_model_0.cif")
33+
try
34+
results[idx] = read_boltz_cif(cif_path, name)
35+
catch e
36+
@warn e
37+
results[idx] = missing
38+
end
3039
end
31-
sortperm(indices), structure_names
3240
else
33-
collect(1:length(prediction_names)), prediction_names
34-
end
35-
for (structure_name, prediction_path) in zip(structure_names, prediction_paths)
36-
cif_path = joinpath(prediction_path, basename(prediction_path)*"_model_0.cif")
37-
push!(structures, read_boltz_cif(cif_path, structure_name))
41+
results = Union{MolecularStructure,Missing}[]
42+
for prediction_path in prediction_paths
43+
cif_path = joinpath(prediction_path, basename(prediction_path)*"_model_0.cif")
44+
try
45+
push!(results, read_boltz_cif(cif_path, basename(prediction_path)))
46+
catch e
47+
@warn e
48+
push!(results, missing)
49+
end
50+
end
3851
end
39-
return structures[perm]
52+
return results
4053
end
4154
end
4255

test/TMscore.jl

Lines changed: 0 additions & 255 deletions
This file was deleted.

test/runtests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ using BioAlignments
55
using BioSequences
66
using BioStructures
77

8-
include("TMscore.jl") # remove this once TMscore.jl is registered: https://github.com/JuliaRegistries/General/pull/130867
9-
using .TMscore
8+
using TMscore
109

1110
# ENV["PyBoltz_TEST_ACCELERATOR"] = "gpu"
1211

0 commit comments

Comments
 (0)