Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Oct 23, 2024
1 parent 5953f2d commit a56ebec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,34 @@ The `ProteinChain` type is meant to only store a basic set of fields, from which
julia> using ProteinChains

julia> structure = pdb"1EYE" # string macro to fetch proteins from the PDB
[ Info: Downloading file from PDB: 1EYE
1-chain ProteinStructure "1EYE.cif"
256-residue ProteinChain{Float64, @NamedTuple{}} (A)
[ Info: File exists: 1EYE
1-chain ProteinStructure{Float64} "1EYE.cif"
256-residue ProteinChain{Float64} (A)

julia> chain = structure["A"]
256-residue ProteinChain{Float64} (A)

julia> propertynames(chain)
(:id, :atoms, :sequence, :numbering)
(:id, :atoms, :sequence, :numbering, :ins_codes, :modelnum, :renumbering)
```
To store additional properties, `addproperties` can be used to attach persistent chain-level properties or indexable residue-level properties:
```julia
julia> chain = structure["A"]
256-residue ProteinChain{Float64, @NamedTuple{}} (A)
julia> new_chain = addproperties(chain; taxid=83332)
256-residue ProteinChain{Float64} (A)

julia> new_chain = addproperties(chain; taxid=PersistentProperty(83332))
256-residue ProteinChain{Float64, @NamedTuple{taxid::PersistentProperty{Int64}}} (A)
julia> new_chain = addproperties(new_chain; rand3=IndexableProperty(rand(3,256))) # last dimension matches chain length
256-residue ProteinChain{Float64} (A)

julia> new_chain = addproperties(new_chain; some_residue_property=IndexableProperty(rand(3,256))) # last dimension gets indexed
256-residue ProteinChain{Float64, @NamedTuple{taxid::PersistentProperty{Int64}, some_residue_property::IndexableProperty{Matrix{Float64}}}} (A)

julia> new_chain[1:100].some_residue_property
julia> new_chain[1:100].rand3
3×100 Matrix{Float64}:
0.273545 0.639173 0.92708 0.459441 0.196407 0.880034
0.981498 0.70263 0.279264 0.552049 0.89274 0.0328866
0.169268 0.117848 0.732741 0.301921 0.187094 0.281187

julia> propertynames(new_chain)
(:id, :atoms, :sequence, :numbering, :ins_codes, :modelnum, :rand3, :renumbering, :taxid)
```
## See also
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ using Test
@testset "structure.jl" begin
chain = ProteinChain("A", get_atoms(ProteinChains.Backbone(rand(3, 3, 5))), "AMINO", collect(1:5))
structure = ProteinStructure("1CHN", Atom{Float64}[], [chain, chain])
@test structure[1] === chain
@test structure["A"] === chain
@test structure[1] == chain
@test structure["A"] == chain
end

@testset "io" begin
Expand Down

2 comments on commit a56ebec

@AntonOresten
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Remove ProteinChain Ps type parameter, in order to avoid unnecessary method specialization for new combinations of properties.
  • Fix delete!(::ProteinStructureStore, key) failing to delete the HDF5 group.
  • Fix atom parsing edge case where the atom element symbol is not in the periodic table.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/117905

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.3 -m "<description of version>" a56ebec7a7be4cfd4529cfb6dbc62cba3f31bf72
git push origin v0.3.3

Please sign in to comment.