Skip to content

Commit

Permalink
implemented coor and updated version
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Apr 23, 2021
1 parent 4df5e96 commit ab0a389
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PDBTools"
uuid = "e29189f1-7114-4dbd-93d0-c5673a921a58"
authors = ["Leandro Martinez <leandro@iqm.unicamp.br>"]
version = "0.11.4"
version = "0.12"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ julia> printatom(atoms[1])
julia> mass(atoms[1])
14.0067
julia> name(atoms[1])
"Nitrogen"
julia> atomic_number(atoms[1])
7
julia> element(atoms[1])
"N"
julia> element_name(atoms[1])
"Nitrogen"
```
8 changes: 6 additions & 2 deletions src/coor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function coor(atoms::Vector{Atom}; only=all, column_based::Bool=true)
return x
end

#
# Coordinates of the atoms of a residue/molecule
coor(residue::Residue; column_based::Bool=true) =
coor(residue.atoms, only = atom -> (atom.index in residue.range), column_based=column_based)
#
coor(residue::Residue; only=all, column_based::Bool=true) =
coor(residue.atoms, only=only, column_based=column_based)
coor(residue::Residue, selection::String; column_based::Bool=true) =
coor(residue.atoms, selection, column_based=column_based)
5 changes: 4 additions & 1 deletion test/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
@test m.xmin [-14.18, -17.561, -15.369]
@test m.xmax [18.694, 14.182, 15.909]
@test m.xlength [32.873999999999995, 31.743000000000002, 31.278]
@test coor(select(atoms,"residue = 3")) ==
s = select(atoms,"residue = 3")
r = Residue(select(atoms,"residue = 3"))
@test coor(s) ==
[ -4.383 -4.51 -3.903 -3.731 -4.938 -4.417 -5.543 -5.867 -5.451 -6.974 -2.626 -1.94
-11.903 -11.263 -11.262 -12.076 -10.279 -9.552 -9.911 -10.85 -10.837 -11.289 -10.48 -10.014
-6.849 -6.096 -8.062 -8.767 -8.612 -9.06 -7.784 -9.684 -10.863 -9.3 -7.749 -8.658 ]
@test coor(s) == coor(r)
@test coor(select(atoms,"residue = 3"),column_based=false)' == coor(select(atoms,"residue = 3"))
@test PDBTools.same_residue(atoms[1],atoms[2]) == true
@test PDBTools.same_residue(atoms[1],atoms[20]) == false
Expand Down

2 comments on commit ab0a389

@lmiq
Copy link
Member Author

@lmiq lmiq commented on ab0a389 Apr 23, 2021

Choose a reason for hiding this comment

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

@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/35155

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.12.0 -m "<description of version>" ab0a389dfd40f43f3529e86ba795365023c3563d
git push origin v0.12.0

Please sign in to comment.