Auxiliary methods
The following methods include auxiliary functions for various tasks.
ProtoSyn.rand_vector_in_sphere
— Functionrand_vector_in_sphere([::Type{T}]) where {T <: AbstractFloat}
Return a random vector in a sphere, with norm = 1. The X, Y and Z cartesian coordinates are of type T
. If not provided, the ProtoSyn.Units.defaultFloat
type will be used.
Examples
julia> ProtoSyn.rand_vector_in_sphere()
3-element Array{Float64,1}:
0.4182585394795512
0.4965570141814753
0.7605859095589471
ProtoSyn.rotation_matrix_from_axis_angle
— Functionrotation_matrix_from_axis_angle(axis::Vector{T}, angle::T) where {T <: AbstractFloat}
Return a rotation matrix based on the provided axis and angle (in radians).
Examples
julia> ProtoSyn.rotation_matrix_from_axis_angle([1.1, 2.2, 3.3], π/2)
3×3 Matrix{Float64}:
0.0714286 -0.658927 0.748808
0.944641 0.285714 0.16131
-0.320237 0.695833 0.642857
ProtoSyn.unit_circle
— Functionunit_circle(value::T) where {T <: AbstractFloat}
Maps an angle value (in radians) from ]-∞, +∞[ to [0, 2π[ range. Returns value in radians.
Examples
julia> ProtoSyn.unit_circle(-2pi)
0.0
julia> ProtoSyn.unit_circle(-(3/2)pi)
1.5707963267948966
ProtoSyn.half_unit_circle
— Functionhalf_unit_circle(value::T) where {T <: AbstractFloat}
Maps an angle value (in radians) from ]-∞, +∞[ to [-π, π[ range. Returns value in radians.
Examples
julia> ProtoSyn.half_unit_circle(-2pi)
0.0
julia> ProtoSyn.half_unit_circle(-(3/2)pi)
-1.5707963267948966
ProtoSyn.fibonacci_sphere
— Functionfibonacci_sphere([::Type{T}], n_points::Int = 1000) where {T <: AbstractFloat}
Generate a set n_points
cartesian coordinates following the fibonnacci lattice (see http://extremelearning.com.au/how-to-evenly-distribute-points-on-a-sphere-more-effectively-than-the-canonical-fibonacci-lattice/). If provided, use the AbstractFloat
type T
(otherwise, will use ProtoSyn.Units.defaultFloat
).
Examples
julia> ProtoSyn.fibonacci_sphere(10)
10-element Vector{Vector{Float64}}:
[0.0, 1.0, 0.0]
[-0.4634653634889746, 0.7777777777777778, 0.42457223795379545]
[0.07269269081806179, 0.5555555555555556, -0.8282957185649263]
(...)
ProtoSyn.hist_by_distance_by_elem
— Functionhist_by_distance_by_elem(pose::Pose, [selection::Opt{AbstractSelection} = nothing]; [cutoff::T = 16.0], [bin::T = 0.2], [elems::Vector{String} = ["H", "O", "N", "C", "S"]], [dm::Opt{Matrix{T}} = nothing]) where {T <: AbstractFloat}
Calculates the given Pose
pose
distance histogram by Atom
element. The output format matches the requirements for predict_igbr_nn_born_radii
(for more information, see https://academic.oup.com/bioinformatics/article/36/6/1757/5613804). If an AbstractSelection
selection
is provided, only the selected subset of Atom
instances is considered for the histogram calculation (promoted to Atom
level using the promote
method). The distance histogram is generated for all Atom
instances within cutoff
Å of the focused Atom
, sub-divided in bins of bin
Å. If a full_distance_matrix
dm
is provided, use it for distance calculation, otherwise a new distance matrix is generated. Each Atom
histogram is divided by elements: one histogram is generated for each atomic element in elems
containing all neighbouring Atom
instances of that type.
Examples
julia> ProtoSyn.hist_by_distance_by_elem(pose)
1140×400 Matrix{Int64}:
(...)