diff --git a/src/ProteinChains.jl b/src/ProteinChains.jl index fe3e2f7..3bb0a77 100644 --- a/src/ProteinChains.jl +++ b/src/ProteinChains.jl @@ -21,6 +21,7 @@ export get_atoms, get_backbone include("structure.jl") export ProteinStructure +export map_chains! include("io/io.jl") export readcif, readpdb diff --git a/src/structure.jl b/src/structure.jl index c408583..4ef171b 100644 --- a/src/structure.jl +++ b/src/structure.jl @@ -57,6 +57,13 @@ function Base.show(io::IO, ::MIME"text/plain", structure::ProteinStructure) end end +function map_chains!(f::Function, structure::ProteinStructure) + for (i, chain) in enumerate(structure) + structure[i] = f(chain) + end + return structure +end + function map_atoms!(f::Function, structure::ProteinStructure, args...) for chain in structure map_atoms!(f, chain, args...)