Builder
The Builder is a submodule of
ProtoSyn.Peptides
module. As such, the following section introduces both new types and methods that work together, in a generally independent way from the rest of the module, and require an unique exploratory section on their own.
As an expansion of the Core module Builder, this submodule introduces the peptidic LGrammar
type, as well as the necessary methods to append and insert Fragment
instances from a derivation, organized in the following topics:
- Loading the default Peptides Stochastic L-Grammar
- Building a molecular structure
- Manipulating a molecular structure by adding new residues from templates
Loading the default Peptides Stochastic L-Grammar
The default Peptides grammar is loaded when ProtoSyn is loaded, and can be accessed at Peptides.grammar
.
ProtoSyn.Peptides.load_default_grammar
— Functionload_default_grammar([::Type{T}])
Load the default Peptides LGrammar
(from the default resources/Peptides/ directory, types as T <: AbstractFloat
, if not provided will use ProtoSyn.Units.defaultFloat
).
The default Peptides LGrammar
is automatically loaded when using ProtoSyn. It can be found at Peptides.grammar
.
Examples
julia> ProtoSyn.Peptides.load_default_grammar()
LGrammar{Float64, String, Vector{String}}:
(...)
ProtoSyn.Peptides.load_grammar_from_file
— Functionload_grammar_from_file([::Type{T}], filename::AbstractString, key::String) where {T <: AbstractFloat}
Load a LGrammar
from the given filename
(this should in .yml format, only loads the given key
), typed to be of type T <: AbstractFloat
. If not provided, will use ProtoSyn.Units.defaultFloat
.
See also
Examples
julia> ProtoSyn.Peptides.load_grammar_from_file("grammars.yml", "default")
LGrammar{Float64, String, Vector{String}}:
(...)
ProtoSyn.Peptides.load_grammar_from_file!
— Functionload_grammar_from_file!([::Type{T}], grammar::LGrammar{T, K, V}, filename::AbstractString, key::String) where {T <: AbstractFloat, K, V}
Load a LGrammar
from the given filename
(this should in .yml format, only loads the given key
), typed to be of type T <: AbstractFloat
. If not provided, will use ProtoSyn.Units.defaultFloat
. Automatically add the loaded LGrammar
instance to the given grammar
(using the join_grammars!
method).
See also
Examples
julia> g1 = ProtoSyn.Peptides.load_grammar_from_file("grammars.yml", "default");
julia> g2 = ProtoSyn.Peptides.load_grammar_from_file!(g1, "grammars.yml", "ncaa")
LGrammar{Float64, String, Vector{String}}:
(...)
ProtoSyn.Peptides.join_grammars!
— Functionjoin_grammars!(g1::LGrammar{T, K, V}, g2::LGrammar{T, K, V}) where {T <: AbstractFloat, K, V}
Add LGrammar
g2
rules, variables and operators to LGrammar
g1
, joining both instances.
Examples
julia> g1 = ProtoSyn.Peptides.load_grammar_from_file("grammars.yml", "default");
julia> g2 = ProtoSyn.Peptides.load_grammar_from_file("grammars.yml", "ncaa");
julia> ProtoSyn.Peptides.join_grammars!(g1, g2)
LGrammar{Float64, String, Vector{String}}:
(...)
ProtoSyn.Peptides.load_grammar_extras_from_file!
— Functionload_grammar_extras_from_file!([::Type{T}], filename::AbstractString, key::String) where {T <: AbstractFloat}
Fill missing information in the following ProtoSyn constants with extra details from the loaded LGrammar
.yml filename
(under the key
entry, typed as T <: AbstractFloat
, if not provided will use ProtoSyn.Units.defaultFloat
):
ProtoSyn.Peptides.chi_dict
ProtoSyn.Peptides.available_aminoacids
ProtoSyn.three_2_one
ProtoSyn.one_2_three
See also
Examples
julia> ProtoSyn.Peptides.load_grammar_extras_from_file!("grammars.yml", "default")
Building a molecular structure
ProtoSyn.Peptides.build
— Methodbuild(grammar::LGrammar{T}, derivation, ss::NTuple{3,Number} = SecondaryStructure[:linear]) where {T <: AbstractFloat}
Build a Pose
using the given derivation
sequence on the provided grammar
instructions. If an ss
is provided, automatically apply it to the built pose (linear secondary structure, by default).
This function is an extension of ProtoSyn.build
.
See also
Examples
julia> pose = ProtoSyn.Peptides.build(res_lib, seq"QQQ")
Pose{Topology}(Topology{/UNK:1}, State{Float64}:
Size: 51
i2c: false | c2i: false
Energy: Dict(:Total => Inf)
)
Manipulating a molecular structure by adding new residues from templates
ProtoSyn.Peptides.append_fragment!
— Methodappend_fragment!(pose::Pose{Topology}, residue::Residue, grammar::LGrammar, derivation; [ss::Opt{SecondaryStructureTemplate} = nothing], [op = "α"])
Add the a Fragment
built from the given derivation
to the provided Pose
pose
, appending it after the given Residue
residue
. This residue and the new Fragment
frag
will be connected using operation op
("α" by default) of the given LGrammar
grammar
. If given, a SecondaryStructureTemplate
ss
can be applied to the new appendage (using the setss!
method). In either case, the C=O
bond position is re-calculated and set (in the anchor for the first residue of the appendage). Request internal to cartesian coordinate conversion and return the altered Pose
pose
.
This function is an extension of ProtoSyn.append_fragment!
.
See also
Examples
julia> ProtoSyn.Peptides.append_fragment!(pose, pose.graph[1][end], res_lib, seq"AAA")
Pose{Topology}(Topology{/UNK:1}, State{Float64}:
Size: 373
i2c: true | c2i: false
Energy: Dict(:Total => Inf)
)
ProtoSyn.Peptides.insert_fragment!
— Methodinsert_fragment!(pose::Pose{Topology}, residue::Residue, grammar::LGrammar, derivation; ss::Opt{SecondaryStructureTemplate} = nothing, op = "α")
Insert the Fragment
built from the given derivation
in the provided pose
, on the position of the provided Residue
instance residue
(the residue
gets shifted downstream). This first downstream Residue
and the new Fragment
will be connected using operation op
("α" by default) from [LGrammar
] grammar
. Also connects to the upstream Residue
instance, using the same operation. If given, a SecondaryStructureTemplate
ss
can be applied to the new appendage (using the setss!
method). If the appendage is not being inserted at the root
, the C=O
bond position is re-calculated and set (in the anchor for the first residue of the appendage). If the appendage is being inserted at the root
, perform a soft uncap of the terminal hydrogen atoms (removes "H2" and "H3", leaves "H1", renames it to "H") and recalculate the N-H bond position (at the first downstream Residue
). Request internal to cartesian coordinate conversion and return the altered Pose
pose
.
This function is an extension of ProtoSyn.insert_fragment!
.
See also
Examples
julia> ProtoSyn.Peptides.insert_fragment!(pose, pose.graph[1][1], res_lib, seq"AAA")
Pose{Topology}(Topology{/UNK:1}, State{Float64}:
Size: 373
i2c: true | c2i: false
Energy: Dict(:Total => Inf)
)