Skip to content

Commit

Permalink
Define map_chains!
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Nov 6, 2024
1 parent 2b2bb9b commit 44fe730
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ProteinChains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export get_atoms, get_backbone

include("structure.jl")
export ProteinStructure
export map_chains!

include("io/io.jl")
export readcif, readpdb
Expand Down
7 changes: 7 additions & 0 deletions src/structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit 44fe730

Please sign in to comment.