Skip to content

Commit

Permalink
script to compare mmCIF dicts to Biopython
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Sep 24, 2020
1 parent cfa6bc4 commit e58f6c1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/mmcif_biopython.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Script to check that all mmCIF dictionary entries are the same as those from Biopython
# Requires a Python installation with Biopython and NumPy installed

using BioStructures
using PyCall

version = pyimport("Bio").__version__
@info "Biopython version is $version"

MMCIF2Dict_python = pyimport("Bio.PDB.MMCIF2Dict").MMCIF2Dict

pdbids = pdbentrylist()

for pdbid in pdbids
filepath = downloadpdb(pdbid, format=MMCIF)
if isfile(filepath)
dict_julia = MMCIFDict(filepath).dict
dict_python = MMCIF2Dict_python(filepath)
rm(filepath)
status = "identical"
if convert(Array{String, 1}, sort(collect(keys(dict_python)))) == sort(collect(keys(dict_julia)))
for key in keys(dict_julia)
if key == "data_"
value_python = [dict_python[key]]
else
value_python = dict_python[key]
end
if dict_julia[key] != value_python
status = "different $key"
break
end
end
else
status = "different keys"
end
else
status = "download_failed"
end
println(pdbid, " ", status)
end

0 comments on commit e58f6c1

Please sign in to comment.