MLNanoShaper
Documentation for MLNanoShaper. MLNanoShaper is a machine learning algorithm that can compute the surface of proteins. There are multiple ways to interface with the software.
- As julia Modules
MLNanoShaperandMLNanoShaperRunner - As a cli command mlnanoshaper in
~/.julia/bin. - As a training script
script/training.bashthat run multiple training runs. Requires parallel. - Running only: as a .so object.
MLNanoShaper.AccumulatorLoggerMLNanoShaper.AdamDeltaMLNanoShaper.AnnotedKDTreeMLNanoShaper.AuxiliaryParametersMLNanoShaper.LossTypeMLNanoShaper.TrainingDataMLNanoShaper.TrainingParametersMLNanoShaperRunner.BatchMLNanoShaperRunner.ConcatenatedBatchMLNanoShaperRunner.ModelInputMLNanoShaperRunner.OptionMLNanoShaperRunner.RegularGridMLNanoShaperRunner.RegularGridMLNanoShaper._trainMLNanoShaper.categorical_lossMLNanoShaper.continuous_lossMLNanoShaper.distanceMLNanoShaper.generate_dataMLNanoShaper.generate_data_pointsMLNanoShaper.implicit_surfaceMLNanoShaper.load_data_pqrMLNanoShaper.signed_distanceMLNanoShaperRunner.batched_sumMLNanoShaperRunner.eval_modelMLNanoShaperRunner.eval_modelMLNanoShaperRunner.get_cutoff_radiusMLNanoShaperRunner.light_angular_denseMLNanoShaperRunner.light_soft_max_angular_denseMLNanoShaperRunner.load_atomsMLNanoShaperRunner.load_modelMLNanoShaperRunner.medium_angular_denseMLNanoShaperRunner.production_instantiateMLNanoShaperRunner.tiny_angular_denseMLNanoShaperRunner.tiny_soft_max_angular_dense
MLNanoShaper.AccumulatorLogger — Typeaccumulator(processing,logger)A processing logger that transform logger on multiple batches Ca be used to liss numerical data, for logging to TensorBoardLogger.
MLNanoShaper.AdamDelta — TypeAdamDelta(ρ = 0.9, ϵ = 1e-8)
AdaDelta(; [rho, epsilon])Parameters
- Rho (
ρ == rho): Factor by which the gradient is decayed at each time step. - Machine epsilon (
ϵ == epsilon): Constant to prevent division by zero (no need to change default)
MLNanoShaper.AnnotedKDTree — TypeAnnotedKDTree(data::StructVector,property::StaticSymbol)Fields
- data::StructVector
- tree::KDTree
MLNanoShaper.AuxiliaryParameters — TypeAuxiliaryParametersThe variables that do not influence the outome of the training run. This include the nb_epoch.
MLNanoShaper.LossType — Typeabstract type LossType endLossType is an interface for defining loss functions.
Implementation
- getlossfn(::LossType)::Function : the associated loss function
- metrictype(::Type{<:LossType)::Type : the type of metrics returned by the loss function
- getlosstype(::StaticSymbol)::LossType : the function generating the losstype
MLNanoShaper.TrainingData — TypeTraining information used in model training.
Fields
atoms: the set of atoms used as model inputskin: the Surface generated by Nanoshaper
MLNanoShaper.TrainingParameters — TypeTrainingParametersThe training parameters used in the model training. Default values are in the param file. The training is deterministric. Theses values are hased to determine a training run
MLNanoShaper._train — Method_train(training_parameters::TrainingParameters, directories::AuxiliaryParameters)train the model given TrainingParameters and AuxiliaryParameters.
MLNanoShaper.categorical_loss — Methodcategorical_loss(model, ps, st, (; point, atoms, d_real))The loss function used by in training. Return the KL divergence between true probability and empirical probability Return the error with the espected distance as a metric.
MLNanoShaper.continuous_loss — Methodcontinus_loss(model, ps, st, (; point, atoms, d_real))The loss function used by in training. compare the predicted (square) distance with $\frac{1 + anh(d)}{2}$ Return the error with the espected distance as a metric.
MLNanoShaper.distance — Methoddistance(x::GeometryBasics.Mesh, y::KDTree)Return the Hausdorff distance betwen the mesh coordinates
MLNanoShaper.generate_data — Methodgenerate_data()generate data from the parameters files in param/ by downloading the pdb files and running Nanoshaper.
MLNanoShaper.generate_data_points — Methodgenerate_data_points(
preprocessing::Lux.AbstractExplicitLayer, points::AbstractVector{<:Point3},
(; atoms, skin)::TreeTrainingData{Float32}, (; ref_distance)::TrainingParameters)generate the data_points for a set of positions points on one protein.
MLNanoShaper.implicit_surface — Methodimplicit_surface(atoms::RegularGrid{T},
model::Lux.StatefulLuxLayer, (;
cutoff_radius, step)) where {T}
Create a mesh form the isosurface of function `pos -> model(atoms,pos)` using marching cubes algorithm and using step size `step`.MLNanoShaper.load_data_pqr — Methodload_data_pqr(T, name::String)Load a TrainingData{T} from current directory. You should have a pdb and an off file with name name in current directory.
MLNanoShaper.signed_distance — Methodsigned_distance(p::Point3, mesh::RegionMesh)::Numberreturns the signed distance between point p and the mesh a positive distance means that we are inside the mesh
MLNanoShaperRunner.Option — TypestateThe global state manipulated by the c interface. To use, you must first load the weights using load_weights and the input atoms using load_atoms. Then you can call eval_model to get the field on a certain point.
MLNanoShaperRunner.Batch — TypeBatch A wrapper arround a vector to design a variable dimension
MLNanoShaperRunner.ConcatenatedBatch — TypeConcatenatedBatchRepresent a vector of arrays of sizes (a..., bn) where bn is the variable dimension of the batch. You can access view of individual arrays with get_slice.
MLNanoShaperRunner.ModelInput — TypeModelInputinput of the model
Fields
- point::Point3, the position of the input
- atoms::StructVector{Sphere}, the atoms in the neighboord
MLNanoShaperRunner.RegularGrid — Typestruct RegularGrid{T<:Number,G,F<:Function}A structure representing the input of the surface prediction model
MLNanoShaperRunner.RegularGrid — MethodRegularGrid(spheres::AbstractVector,radius::Number,[center]) A constructor that take a vector of spheres. If you are not using Geometry basic spheres, you will need to give a function center that return the center of each point.
MLNanoShaperRunner.batched_sum — Methodbatched_sum(b::AbstractMatrix,nb_elements::AbstractVector)compute the sum of a Concatenated batch with ndim = 2. The first dim is the feature dimension. The second dim is the the batch dim.
Given b of size (n,m) and nb_elements of size (k,), the output has size (n,k).
MLNanoShaperRunner.eval_model — Functioneval_model(x::Float32,y::Float32,z::Float32)::Float32evaluate the model at coordinates x y z.
MLNanoShaperRunner.eval_model — Methodevaluate_modelMLNanoShaperRunner.get_cutoff_radius — Methodget_cutoff_radius(x::Lux.AbstractLuxLayer)extract the cutoff radius of a Lux Model.
MLNanoShaperRunner.light_angular_dense — Methodlight_angular_dense(; categorical=false, van_der_waals_channel=false, kargs...)
`light_angular_dense` is a function that generate a lux model.MLNanoShaperRunner.light_soft_max_angular_dense — Methodlight_soft_max_angular_dense(; categorical=false, van_der_waals_channel=false, kargs...)
`light_soft_max_angular_dense` is a function that generate a lux model.MLNanoShaperRunner.load_atoms — Functionload_atoms(start::Ptr{CSphere},length::Cint)::CintLoad the atoms into the julia model. Start is a pointer to the start of the array of CSphere and length is the length of the array
Return an error status:
- 0: OK
- 1: data could not be read
- 2: unknow error
MLNanoShaperRunner.load_model — Functionload_model(path::String)::CintLoad the model from a MLNanoShaperRunner.SerializedModel serialized state at absolute path path.
Return an error status:
- 0: OK
- 1: file not found
- 2: file could not be deserialized properly
- 3: unknow error
MLNanoShaperRunner.medium_angular_dense — Methodmedium_angular_dense(; categorical=false, van_der_waals_channel=false, kargs...)
`medium_angular_dense` is a function that generate a lux model.MLNanoShaperRunner.production_instantiate — Methodproduction_instantiate(model::SerializedModel;[on_gpu])::Lux.StatefullLuxLayer{true}Turn a SerializedModel into a Stateful Lux Layer.
MLNanoShaperRunner.tiny_angular_dense — Methodtiny_angular_dense(; categorical=false, van_der_waals_channel=false, kargs...)
`tiny_angular_dense` is a function that generate a lux model.MLNanoShaperRunner.tiny_soft_max_angular_dense — Methodtiny_angular_dense(; categorical=false, van_der_waals_channel=false, kargs...)
`tiny_angular_dense` is a function that generate a lux model.