From a19bae07b9a3d7cc41b1143b8e5a3475600638b3 Mon Sep 17 00:00:00 2001 From: AntonOresten Date: Fri, 11 Oct 2024 08:56:55 +0200 Subject: [PATCH] ProteinStructureStore do syntax --- src/store/store.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/store/store.jl b/src/store/store.jl index 8f808db..86e3221 100644 --- a/src/store/store.jl +++ b/src/store/store.jl @@ -92,6 +92,15 @@ end Base.show(io::IO, store::ProteinStructureStore) = print(io, "$ProteinStructureStore(\"$(store.filename)\", $(store.mode))") Base.show(io::IO, ::MIME"text/plain", store::ProteinStructureStore) = print(io, summary(store)) +function ProteinStructureStore(f::Function, args...) + store = ProteinStructureStore(args...) + try + return f(store) + finally + close(store) + end +end + """ serialize(filename::AbstractString, structures::AbstractVector{<:ProteinStructure})