Input and Output (IO)

The following methods allow the user to load and export models and data from and to files.

By default, ProtoSyn supports the following file formats. This may change in future versions of ProtoSyn!

Format extensionReadWrite
.pdbYesYes
.ymlYesYes
.pqrNoYes
.xyzNoYes
ProtoSyn.loadFunction
load([::Type{T}], filename::AbstractString, [bonds_by_distance::Bool = false], [alternative_location::String = "A"], [ignore_residues::Vector{String} = Vector{String}()], [ignore_chains::Vector{String} = Vector{String}()]) where {T <: AbstractFloat}

Load the given filename into a Pose, parametrized by T. If this is not provided, the default ProtoSyn.Units.defaultFloat is used. The file format is infered from the extension (See ProtoSyn.supported_formats for all supported formats). If bonds_by_distance is set to true (false, by default), the CONECT records will be complemented with bonds infered by distance. The distances for each pair of atoms is defined in ProtoSyn.Units.bond_lengths (in Angstrom Å, with a standard deviation threshold of 0.1 Å). Return the resulting Pose instance. By default, and when available, ProtoSyn will use alternative_location A, unless specified in the flag alternative_location. If the input file if of type PDB and a trajectory, returns a vector of Pose instances instead. Optionally, by setting ignore_residues and ignore_chains, ProtoSyn will skip the load of any atom belonging to either the given residues or chains (by name).

See also

distance

Note:

This function tries to infer information of the parenthood and ascendents of each atom, using the CONECT records or infered bonds_by_distance. The parents are arbitrarily defined as the first bond found, by order, and any atom without parent is connected to the root. All Residue instances have the root.container as parent. Note that this infered information may need to be manually corrected.

Examples

julia> ProtoSyn.load("2a3d.pdb")
Pose{Topology}(Topology{/2a3d:6263}, State{Float64}:
 Size: 1140
 i2c: false | c2i: true
 Energy: Dict(:Total => Inf)
)
source
Downloads.downloadFunction
ProtoSyn.download([::T], pdb_code::String) where {T <: AbstractFloat}

Download the PDB file (for the given PDB code) from the RCSB Protein Data Bank into a Pose. The downloaded file can be found in the current working directory. If T is specified, the downloaded file will be loaded into a Pose parametrized by T, otherwise uses the default ProtoSyn.Units.defaultFloat.

See also

load

Examples

julia> ProtoSyn.download("2A3D")
source
ProtoSyn.writeFunction
ProtoSyn.write(pose::Pose, filename::String)

Write to file the given Pose pose. The file format is infered from the filename extension (See ProtoSyn.supported_formats for all supported formats). The Pose pose structure is automatically synched (using the sync! method) when writting to file, as only the cartesian coordinates are used.

See also

append

Examples

julia> ProtoSyn.write(pose, "new_file.pdb")
source
ProtoSyn.appendFunction
ProtoSyn.append(pose::Pose, filename::String, [model::Int = 1])

Append to file the given Pose pose (as a new frame, identified by the model number model: default is 1). The file format is infered from the filename extension (See ProtoSyn.supported_formats for all supported formats). The Pose pose structure is automatically synched (using the sync! method) when writting to file, as only the cartesian coordinates are used.

See also

write

Examples

julia> ProtoSyn.append(pose, "new_file.pdb")
source

The following methods are used by ProtoSyn in the load function automatically, but are displayed here for documentation purposes only.

ProtoSyn.is_trajectoryFunction
is_trajectory(filename::String)

Read the given filename and check if multiple "MODEL" entries are found. File must be in PDB format.

Examples

julia> ProtoSyn.is_trajectory("teste.pdb")
true
source
ProtoSyn.splice_trajectoryFunction
splice_trajectory(filename::String)

Create a new temporary folder holding all the "MODEL" entries in a given filename separated (one per file, input should be in PDB format).

Examples

julia> ProtoSyn.splice_trajectory("teste.pdb")
"teste_spliced"
source
ProtoSyn.load_trajectoryFunction
load_trajectory([::Type{T}], filename::AbstractString, ::Type{K}; [bonds_by_distance = false], [alternative_location::String = "A"], [ignore_residues::Vector{String} = Vector{String}()], [ignore_chains::Vector{String} = Vector{String}()]) where {T <: AbstractFloat, K}

Load the given filename into a vector of Pose instances, parametrized by T, separated by new "MODEL" entries. If T is not provided, the default ProtoSyn.Units.defaultFloat is used. The file format is infered from the extension (Supported: .pdb only). If bonds_by_distance is set to true (false, by default), the CONECT records will be complemented with bonds infered by distance. The distances for each pair of atoms is defined in ProtoSyn.Units.bond_lengths (in Angstrom Å, with a standard deviation threshold of 0.1 Å). Return the resulting vector of Pose instances. By default, and when available, ProtoSyn will use alternative_location A, unless specified in the flag alternative_location. Optionally, by setting ignore_residues and ignore_chains, ProtoSyn will skip the load of any atom belonging to either the given residues or chains (by name).

See also

is_trajectory splice_trajectory

Examples

julia> ProtoSyn.load_trajectory("teste.pdb")
2-element Vector{Pose}:
 Pose{Topology}(Topology{/1:5584}, State{Float64}:
 Size: 39
 i2c: false | c2i: false
 Energy: Dict(:Total => Inf)
)
 Pose{Topology}(Topology{/2:48484}, State{Float64}:
 Size: 39
 i2c: false | c2i: false
 Energy: Dict(:Total => Inf)
)
source