From 28eb87d79678c51d4f37efd13481384c92b6539c Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 11 Sep 2023 23:51:38 +0000 Subject: [PATCH] build based on 6231058 --- dev/auxiliary/index.html | 2 +- dev/elements/index.html | 2 +- dev/help/index.html | 66 ++++++++++++++++++++----------------- dev/index.html | 2 +- dev/installation/index.html | 2 +- dev/readwrite/index.html | 2 +- dev/search/index.html | 2 +- dev/search_index.js | 2 +- dev/selections/index.html | 2 +- 9 files changed, 44 insertions(+), 38 deletions(-) diff --git a/dev/auxiliary/index.html b/dev/auxiliary/index.html index 5329947..5a145d2 100644 --- a/dev/auxiliary/index.html +++ b/dev/auxiliary/index.html @@ -81,4 +81,4 @@ ylabel="b-factor", xrotation=60, label=nothing, framestyle=:box, - )

Produces the following plot:

./assets/residue_ticks.png

+ )

Produces the following plot:

./assets/residue_ticks.png

diff --git a/dev/elements/index.html b/dev/elements/index.html index ed74990..3a0536d 100644 --- a/dev/elements/index.html +++ b/dev/elements/index.html @@ -22,4 +22,4 @@ julia> stoichiometry(select(atoms,"water")) H₂O₁ -

AtomsBase compatibility

Compat

This interface requires at least PDBTools version 0.14.2.

The following functions are supported as part of the API, to conform the AtomsBase interface:

FunctionExampleOutput
atomic_number(::PDBTools.Atom)atomic_number(Atom(name="NE2"))7
atomic_symbol(::PDBTools.Atom)atomic_symbol(Atom(name="NE2")):N
atomic_mass(::PDBTools.Atom)atomic_mass(Atom(name="NE2"))14.0067
position(::PDBTools.Atom)position(Atom(name="NE2"))SVector{3,Float64}(0,0,0)
+

AtomsBase compatibility

Compat

This interface requires at least PDBTools version 0.14.2.

The following functions are supported as part of the API, to conform the AtomsBase interface:

FunctionExampleOutput
atomic_number(::PDBTools.Atom)atomic_number(Atom(name="NE2"))7
atomic_symbol(::PDBTools.Atom)atomic_symbol(Atom(name="NE2")):N
atomic_mass(::PDBTools.Atom)atomic_mass(Atom(name="NE2"))14.0067
position(::PDBTools.Atom)position(Atom(name="NE2"))SVector{3,Float64}(0,0,0)
diff --git a/dev/help/index.html b/dev/help/index.html index df0ba80..14e8dc1 100644 --- a/dev/help/index.html +++ b/dev/help/index.html @@ -52,7 +52,7 @@ "N" julia> mass(pdb[1]) -14.0067

The element and charge fields, which are frequently left empty in PDB files, are not printed. They can be retrieved with the pdb_element and pdb_charge getter functions.

source
PDBTools.FormulaType
Formula::DataType

Formula data type. Contains the number of atoms of each type in a vector of tuples.

Example

julia> atoms = wget("1LBD","protein and residue 1");
+14.0067

The element and charge fields, which are frequently left empty in PDB files, are not printed. They can be retrieved with the pdb_element and pdb_charge getter functions.

source
PDBTools.FormulaType
Formula::DataType

Formula data type. Contains the number of atoms of each type in a vector of tuples.

Example

julia> atoms = wget("1LBD","protein and residue 1");
 
 julia> f = formula(atoms)
 C₃N₁O₂
@@ -66,11 +66,11 @@
 
 julia> f[3]
 ("O", 2)
-
source
PDBTools.FunctionalKeywordType
FunctionalKeyword{T}

This is a structure that will store a keyword that depends on an external function requiring an operator and an argument.

Example:

element_keyword = FunctionalKeyword(String,      
+
source
PDBTools.FunctionalKeywordType
FunctionalKeyword{T}

This is a structure that will store a keyword that depends on an external function requiring an operator and an argument.

Example:

element_keyword = FunctionalKeyword(String,      
                                     "element",
                                     element,
                                     ("=",isequal))
-

will define a keyword "element" to be used as element C, which will return true if there is an element function such that element(atom) == C.

source
PDBTools.ResidueType
Residue(atoms::AbstractVector{Atom}, range::UnitRange{Int})

Residue data structure. It contains two fields: atoms which is a vector of Atom elements, and range, which indicates which atoms of the atoms vector compose the residue.

The Residue structure carries the properties of the residue or molecule of the atoms it contains, but it does not copy the original vector of atoms, only the residue meta data for each residue.

Example

julia> pdb = wget("1LBD");
+

will define a keyword "element" to be used as element C, which will return true if there is an element function such that element(atom) == C.

source
PDBTools.ResidueType
Residue(atoms::AbstractVector{Atom}, range::UnitRange{Int})

Residue data structure. It contains two fields: atoms which is a vector of Atom elements, and range, which indicates which atoms of the atoms vector compose the residue.

The Residue structure carries the properties of the residue or molecule of the atoms it contains, but it does not copy the original vector of atoms, only the residue meta data for each residue.

Example

julia> pdb = wget("1LBD");
 
 julia> residues = collect(eachresidue(pdb))
    Array{Residue,1} with 238 residues.
@@ -86,7 +86,7 @@
 
 julia> residues[8].range
 52:58
-
source
PDBTools.SequenceType
Sequence

Wrapper for strings, or vectors of chars, strings, or residue names, to dispatch on functions that operate on amino acid sequences.

Example

julia> seq = ["Alanine", "Glutamic acid", "Glycine"];
+
source
PDBTools.SequenceType
Sequence

Wrapper for strings, or vectors of chars, strings, or residue names, to dispatch on functions that operate on amino acid sequences.

Example

julia> seq = ["Alanine", "Glutamic acid", "Glycine"];
 
 julia> mass(Sequence(seq))
 257.2432
@@ -94,14 +94,14 @@
 julia> seq = "AEG";
 
 julia> mass(Sequence(seq))
-257.2432
source
AtomsBase.atomic_numberMethod
atomic_number(name::String or atom::Atom)

Returns the atomic number of an atom given its name, or Atom structure.

Example

julia> at = Atom(name="NT3");
+257.2432
source
AtomsBase.atomic_numberMethod
atomic_number(name::String or atom::Atom)

Returns the atomic number of an atom given its name, or Atom structure.

Example

julia> at = Atom(name="NT3");
 
 julia> atomic_number(at)
 7
 
 julia> atomic_number("CA")
 6
-
source
PDBTools.closestMethod
closest(x,y)

Computes the minimum distance between two sets of atoms and returns the indexes of the atoms and their distance. Both vector of atoms or vectors of coordinates can be used as input.

Examples

julia> model = wget("1BSX");
+
source
PDBTools.closestMethod
closest(x,y)

Computes the minimum distance between two sets of atoms and returns the indexes of the atoms and their distance. Both vector of atoms or vectors of coordinates can be used as input.

Examples

julia> model = wget("1BSX");
 
 julia> protein = select(model,"protein");
 
@@ -126,7 +126,7 @@
 
 julia> closest(ligand,x)
 (43, 3684, 2.7775834820937417)
-
source
PDBTools.coorMethod
coor(atoms; selection)

Returns the coordinates of the atoms. The input may be one atom (type Atom), a vector of atoms, or a Residue. The coordinates are returned as a vector of static vectors (from StaticArrays), more specifically as a Vector{SVector{3,Float64}}.

Examples

julia> using PDBTools, StaticArrays 
+
source
PDBTools.coorMethod
coor(atoms; selection)

Returns the coordinates of the atoms. The input may be one atom (type Atom), a vector of atoms, or a Residue. The coordinates are returned as a vector of static vectors (from StaticArrays), more specifically as a Vector{SVector{3,Float64}}.

Examples

julia> using PDBTools, StaticArrays 
 
 julia> protein = wget("1LBD");
 
@@ -167,7 +167,7 @@
  [45.823, 80.796, 69.974]
  [47.147, 82.98, 71.413]
  [46.541, 82.639, 72.662]
-
source
PDBTools.distanceMethod
distance(x,y)

Computes the minimum distance between two sets of atoms, between an atom and a set of atoms, or simply the distance between two atoms. The input may be a vector of Atoms, or the coordinates that are output of the coor function.

Examples

julia> model = wget("1BSX");
+
source
PDBTools.distanceMethod
distance(x,y)

Computes the minimum distance between two sets of atoms, between an atom and a set of atoms, or simply the distance between two atoms. The input may be a vector of Atoms, or the coordinates that are output of the coor function.

Examples

julia> model = wget("1BSX");
 
 julia> protein = select(model,"protein");
 
@@ -181,7 +181,7 @@
 
 julia> distance(coor(ligand),protein)
 2.7775834820937417
-
source
PDBTools.eachresidueMethod
eachresidue(atoms::AbstractVector{Atom})

Iterator for the residues (or molecules) of a selection.

Example

julia> atoms = wget("1LBD");
+
source
PDBTools.eachresidueMethod
eachresidue(atoms::AbstractVector{Atom})

Iterator for the residues (or molecules) of a selection.

Example

julia> atoms = wget("1LBD");
 
 julia> length(eachresidue(atoms))
 238
@@ -204,7 +204,7 @@
        8   CA     ALA     A      226        2   43.020   80.825   70.455 63.69  1.00     1       -         8
        9    C     ALA     A      226        2   41.996   80.878   69.340 59.69  1.00     1       -         9
                                                       ...
-
source
PDBTools.edit!Method
edit!(atoms::Vector{Atom})

Opens a temporary PDB file in which the fields of the vector of atoms can be edited.

source
PDBTools.elementMethod
element_name(name::String or atom::Atom)

Returns the element name of an atom given its name, or Atom structure.

Example

julia> at = Atom(name="NT3");
+
source
PDBTools.edit!Method
edit!(atoms::Vector{Atom})

Opens a temporary PDB file in which the fields of the vector of atoms can be edited.

source
PDBTools.elementMethod
element_name(name::String or atom::Atom)

Returns the element name of an atom given its name, or Atom structure.

Example

julia> at = Atom(name="NT3");
 
 julia> element_name(at)
 "Nitrogen"
@@ -214,7 +214,7 @@
 
 julia> element_name("CA")
 "Carbon"
-
source
PDBTools.formulaMethod
formula(atoms::AbstractVector{Atom})

Returns the molecular formula of the current selection.

Example

julia> first_residue = wget("1LBD","protein and residue 1")
+
source
PDBTools.formulaMethod
formula(atoms::AbstractVector{Atom})

Returns the molecular formula of the current selection.

Example

julia> first_residue = wget("1LBD","protein and residue 1")
    Array{Atoms,1} with 6 atoms with fields:
    index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
        1    N     SER     A      225        1   45.228   84.358   70.638 67.05  1.00     1       -         1
@@ -227,7 +227,7 @@
 
 julia> formula(first_residue)
 C₃N₁O₂
-
source
PDBTools.getseqMethod
getseq(Vector{Atom} or filename; selection, code)

Returns the sequence of aminoacids from the vector of atoms or file name. Selections may be applied. Code defines if the output will be a one-letter, three-letter or full-residue name array.

Example

julia> protein = wget("1LBD");
+
source
PDBTools.getseqMethod
getseq(Vector{Atom} or filename; selection, code)

Returns the sequence of aminoacids from the vector of atoms or file name. Selections may be applied. Code defines if the output will be a one-letter, three-letter or full-residue name array.

Example

julia> protein = wget("1LBD");
 
 julia> getseq(protein,"residue < 3")
 2-element Vector{String}:
@@ -243,13 +243,13 @@
 2-element Vector{String}:
  "Serine"
  "Alanine"
-
source
PDBTools.has_keyMethod
has_key(key::String, s::AbstractVector{<:AbstractString})

Returns the first index of the vector s in which where key is found, or 0.

Example:


+
source
PDBTools.has_keyMethod
has_key(key::String, s::AbstractVector{<:AbstractString})

Returns the first index of the vector s in which where key is found, or 0.

Example:


 julia> PDBTools.has_key("or",["name","CA","or","index","1"])
 3
 
 julia> PDBTools.has_key("and",["name","CA","or","index","1"])
 0
-
source
PDBTools.massMethod
mass(name::String or atom::Atom or Vector{Atom})

Returns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms.

Example

julia> atoms = [ Atom(name="NT3"), Atom(name="CA") ];
+
source
PDBTools.massMethod
mass(name::String or atom::Atom or Vector{Atom})

Returns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms.

Example

julia> atoms = [ Atom(name="NT3"), Atom(name="CA") ];
 
 julia> mass(atoms[1])
 14.0067
@@ -259,7 +259,7 @@
 
 julia> mass(atoms)
 26.017699999999998
-
source
PDBTools.massMethod
mass(s::Sequence)

Returns the mass of a sequence of amino acids, given a Sequence struct type.

Examples

julia> seq = ["Alanine", "Glutamic acid", "Glycine"];
+
source
PDBTools.massMethod
mass(s::Sequence)

Returns the mass of a sequence of amino acids, given a Sequence struct type.

Examples

julia> seq = ["Alanine", "Glutamic acid", "Glycine"];
 
 julia> mass(Sequence(seq))
 257.2432
@@ -272,62 +272,68 @@
 julia> seq = ["ALA", "GLU", "GLY"];
 
 julia> mass(Sequence(seq))
-257.2432
source
PDBTools.maxminMethod
maxmin(atoms::Vector{Atom}; selection)

Returns the maximum and minimum coordinates of an atom vector, and the length (maximum minus minimum) in each direction.

Example

julia> protein = wget("1LBD");
+257.2432
source
PDBTools.maxminMethod
maxmin(atoms::Vector{Atom}; selection)

Returns the maximum and minimum coordinates of an atom vector, and the length (maximum minus minimum) in each direction.

Example

julia> protein = wget("1LBD");
 
 julia> maxmin(protein)
  
  Minimum atom coordinates: xmin = [-29.301, 57.178, 45.668]
  Maximum atom coordinates: xmax = [47.147, 99.383, 86.886]
  Length in each direction: xlength = [76.448, 42.205, 41.217999999999996]
-
source
PDBTools.oneletterMethod
oneletter(residue::Union{String,Char})

Function to return a one-letter residue code from the three letter code or residue name. The function is case-insensitive.

Examples

julia> oneletter("ALA")
+
source
PDBTools.oneletterMethod
oneletter(residue::Union{String,Char})

Function to return a one-letter residue code from the three letter code or residue name. The function is case-insensitive.

Examples

julia> oneletter("ALA")
 "A"
 
 julia> oneletter("Glutamic acid")
 "E"
-
source
PDBTools.parse_queryMethod
parse_query(selection:String)

Calls parse_query_vector after splitting the selection string.

source
PDBTools.parse_query_vectorMethod
parse_query_vector(s::AbstractVector{<:AbstractString})
source
PDBTools.parse_to_typeMethod
parse_to_type(key::Keyword, val::String)

Tries to parse val into the type of value expected by key.ValueType.

source
PDBTools.readPDBMethod
readPDB(filename; selection)

Reads a PDB file and stores the data in a vector of type Atom.

Example

julia> protein = readPDB("../test/structure.pdb")
+
source
PDBTools.parse_queryMethod
parse_query(selection:String)

Calls parse_query_vector after splitting the selection string.

source
PDBTools.parse_query_vectorMethod
parse_query_vector(s::AbstractVector{<:AbstractString})
source
PDBTools.parse_to_typeMethod
parse_to_type(key::Keyword, val::String)

Tries to parse val into the type of value expected by key.ValueType.

source
PDBTools.readPDBMethod
readPDB(pdbfile::String, selection::String)
+readPDB(pdbfile::String; only::Function = all)

Reads a PDB file and stores the data in a vector of type Atom.

If a selection is provided, only the atoms matching the selection will be read. For example, resname ALA will select all the atoms in the residue ALA.

If the only function keyword is provided, only the atoms for which only(atom) is true will be read.

Examples

julia> protein = readPDB("../test/structure.pdb")
    Array{Atoms,1} with 62026 atoms with fields:
    index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
        1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  1.00     1    PROT         1
        2  HT1     ALA     A        1        1  -10.048  -15.427   -5.569  0.00  0.00     1    PROT         2
-       3  HT2     ALA     A        1        1   -9.488  -13.913   -5.295  0.00  0.00     1    PROT         3
                                                        ⋮ 
-   62024  OH2    TIP3     C     9339    19638   13.485   -4.534  -34.438  0.00  1.00     1    WAT2     62024
    62025   H1    TIP3     C     9339    19638   13.218   -3.647  -34.453  0.00  1.00     1    WAT2     62025
    62026   H2    TIP3     C     9339    19638   12.618   -4.977  -34.303  0.00  1.00     1    WAT2     62026
 
-julia> protein = readPDB("../test/structure.pdb","resname = ALA")
+julia> ALA = readPDB("../test/structure.pdb","resname ALA")
    Array{Atoms,1} with 72 atoms with fields:
    index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
        1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  1.00     1    PROT         1
        2  HT1     ALA     A        1        1  -10.048  -15.427   -5.569  0.00  0.00     1    PROT         2
-       3  HT2     ALA     A        1        1   -9.488  -13.913   -5.295  0.00  0.00     1    PROT         3
                                                        ⋮ 
-    1338  HB3     ALA     A       95       95   11.464   -3.278   -4.953  0.00  1.00     1    PROT      1338
     1339    C     ALA     A       95       95   14.815   -3.057   -5.633  0.00  1.00     1    PROT      1339
-    1340    O     ALA     A       95       95   14.862   -2.204   -6.518  0.00  1.00     1    PROT      1340
source
PDBTools.residue_ticksMethod
residue_ticks(atoms::AbstractVector{<:Atom}; first=nothing, last=nothing, stride=1, oneletter=true)

Returns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.

first and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.

If oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX.

Examples

julia> using PDBTools
+    1340    O     ALA     A       95       95   14.862   -2.204   -6.518  0.00  1.00     1    PROT      1340
+
+julia> ALA = readPDB("../test/structure.pdb", only = atom -> atom.resname == "ALA")
+   Array{Atoms,1} with 72 atoms with fields:
+   index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
+       1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  1.00     1    PROT         1
+       2  HT1     ALA     A        1        1  -10.048  -15.427   -5.569  0.00  0.00     1    PROT         2
+                                                       ⋮ 
+    1339    C     ALA     A       95       95   14.815   -3.057   -5.633  0.00  1.00     1    PROT      1339
+    1340    O     ALA     A       95       95   14.862   -2.204   -6.518  0.00  1.00     1    PROT      1340
source
PDBTools.residue_ticksMethod
residue_ticks(atoms::AbstractVector{<:Atom}; first=nothing, last=nothing, stride=1, oneletter=true)

Returns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.

first and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.

If oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX.

Examples

julia> using PDBTools
 
 julia> atoms = wget("1UBQ", "protein");
 
 julia> residue_ticks(atoms; stride=10)
-([1, 11, 21, 31, 41, 51, 61, 71], ["M1", "K11", "D21", "Q31", "Q41", "E51", "I61", "L71"])

The resulting tuple of residue numbers and labels can be used as xticks in Plots.plot, for example.

source
PDBTools.residuenameMethod
residuename(residue::Union{String,Char})

Function to return the long residue name from other residue codes. The function is case-insensitive.

Examples

julia> residuename("A")
+([1, 11, 21, 31, 41, 51, 61, 71], ["M1", "K11", "D21", "Q31", "Q41", "E51", "I61", "L71"])

The resulting tuple of residue numbers and labels can be used as xticks in Plots.plot, for example.

source
PDBTools.residuenameMethod
residuename(residue::Union{String,Char})

Function to return the long residue name from other residue codes. The function is case-insensitive.

Examples

julia> residuename("A")
 "Alanine"
 
 julia> residuename("Glu")
 "Glutamic Acid"
-
source
PDBTools.resnameMethod
resname(residue::Union{String,Char})

Returns the residue name, given the one-letter code or residue name. Differently from threeletter, this function will return the force-field name if available in the list of protein residues.

Examples

julia> resname("ALA")
+
source
PDBTools.resnameMethod
resname(residue::Union{String,Char})

Returns the residue name, given the one-letter code or residue name. Differently from threeletter, this function will return the force-field name if available in the list of protein residues.

Examples

julia> resname("ALA")
 "ALA"
 
 julia> resname("GLUP")
-"GLUP"
source
PDBTools.stoichiometryMethod
stoichiometry(atoms::AbstractVector{Atom})

Returns the stoichiometry of atom selection in a Formula structure.

Example

julia> stoichiometry(select(atoms,"water"))
+"GLUP"
source
PDBTools.stoichiometryMethod
stoichiometry(atoms::AbstractVector{Atom})

Returns the stoichiometry of atom selection in a Formula structure.

Example

julia> stoichiometry(select(atoms,"water"))
 H₂O₁
-
source
PDBTools.threeletterMethod
threeletter(residue::String)

Function to return the three-letter natural-amino acid residue code from the one-letter code or residue name. The function is case-insensitive.

Examples

julia> threeletter("A")
+
source
PDBTools.threeletterMethod
threeletter(residue::String)

Function to return the three-letter natural-amino acid residue code from the one-letter code or residue name. The function is case-insensitive.

Examples

julia> threeletter("A")
 "ALA"
 
 julia> threeletter("Aspartic acid")
 "ASP"
 
 julia> threeletter("HSD")
-"HIS"
source
PDBTools.wgetMethod
wget(PDBid; selection)

Retrieves a PDB file from the protein data bank. Selections may be applied.

Example

julia> protein = wget("1LBD","chain A")
+"HIS"
source
PDBTools.wgetMethod
wget(PDBid; selection)

Retrieves a PDB file from the protein data bank. Selections may be applied.

Example

julia> protein = wget("1LBD","chain A")
    Array{Atoms,1} with 1870 atoms with fields:
    index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
        1    N     SER     A      225        1   45.228   84.358   70.638 67.05  1.00     1       -         1
@@ -337,4 +343,4 @@
     1868  OG1     THR     A      462      238  -27.462   74.325   48.885 79.98  1.00     1       -      1868
     1869  CG2     THR     A      462      238  -27.063   71.965   49.222 78.62  1.00     1       -      1869
     1870  OXT     THR     A      462      238  -25.379   71.816   51.613 84.35  1.00     1       -      1870
-
source
PDBTools.writePDBMethod
writePDB(atoms::Vector{Atom}, filename, selection; header=:auto, footer=:auto)

Write a PDB file with the atoms in atoms to filename. The selection argument is a string that can be used to select a subset of the atoms in atoms. For example, writePDB(atoms, "test.pdb", "name CA").

The header and footer arguments can be used to add a header and footer to the PDB file. If header is :auto, then a header will be added with the number of atoms in atoms. If footer is :auto, then a footer will be added with the "END" keyword. Either can be set to nothing if no header or footer is desired.

source
+source
PDBTools.writePDBMethod
writePDB(atoms::Vector{Atom}, filename, selection; header=:auto, footer=:auto)

Write a PDB file with the atoms in atoms to filename. The selection argument is a string that can be used to select a subset of the atoms in atoms. For example, writePDB(atoms, "test.pdb", "name CA").

The header and footer arguments can be used to add a header and footer to the PDB file. If header is :auto, then a header will be added with the number of atoms in atoms. If footer is :auto, then a footer will be added with the "END" keyword. Either can be set to nothing if no header or footer is desired.

source
diff --git a/dev/index.html b/dev/index.html index 4261a83..a8b2746 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,4 +1,4 @@ Home · PDBTools.jl

PDBTools

PDBTools is a simple package to read and write Protein Data Bank files, select atoms, and work with their coordinates.

Features:

Simple data structure:

julia> printatom(atoms[1])
   index name resname chain   resnum  residue        x        y        z  beta occup model segname index_pdb
-      1   OW     SOL     X        1        1   54.370   45.310   33.970  0.00  0.00     1       -         1

Selection syntax:

resname ARG and name CA

Allows use of Julia (possibly user-defined) functions for selection:

atom -> ( atom.resname == "ARG" && atom.x < 10 ) || atom.name == "N"

Not indicated for:

We do not aim to provide the fastest PDB parsing methods. If speed in reading files, returning subsets of the structures, etc., is critical to you, probably you will do better with some packages of BioJulia, BioStructures in particular.

+ 1 OW SOL X 1 1 54.370 45.310 33.970 0.00 0.00 1 - 1

Selection syntax:

resname ARG and name CA

Allows use of Julia (possibly user-defined) functions for selection:

atom -> ( atom.resname == "ARG" && atom.x < 10 ) || atom.name == "N"

Not indicated for:

We do not aim to provide the fastest PDB parsing methods. If speed in reading files, returning subsets of the structures, etc., is critical to you, probably you will do better with some packages of BioJulia, BioStructures in particular.

diff --git a/dev/installation/index.html b/dev/installation/index.html index ab879fb..45dc7c3 100644 --- a/dev/installation/index.html +++ b/dev/installation/index.html @@ -1,4 +1,4 @@ Installation · PDBTools.jl

Installation

Install the package using the package manager:

julia> ] add PDBTools
 

and load it with

julia> using PDBTools
-
+ diff --git a/dev/readwrite/index.html b/dev/readwrite/index.html index 7268bcb..82395ba 100644 --- a/dev/readwrite/index.html +++ b/dev/readwrite/index.html @@ -48,4 +48,4 @@ index name resname chain resnum residue x y z beta occup model segname index_pdb 1 N ABC A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1

Write a PDB file

To write a PDB file use the writePDB function, as:

writePDB(atoms,"file.pdb")
-

where atoms contain a list of atoms with the Atom structures.

Read and write single-atom lines

PDBTools.read_atom(pdb_line): Given a line of a PDB file containing atom data, returns the data in a Atom structure.

PDBTools.write_atom(atom::Atom): Given an atom in the Atom structure, returns a string formatted in the PDB format, to be written to a file.

+

where atoms contain a list of atoms with the Atom structures.

Read and write single-atom lines

PDBTools.read_atom(pdb_line): Given a line of a PDB file containing atom data, returns the data in a Atom structure.

PDBTools.write_atom(atom::Atom): Given an atom in the Atom structure, returns a string formatted in the PDB format, to be written to a file.

diff --git a/dev/search/index.html b/dev/search/index.html index 43c70d7..75a7717 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · PDBTools.jl

Loading search...

    +Search · PDBTools.jl

    Loading search...

      diff --git a/dev/search_index.js b/dev/search_index.js index 5d8b814..5daf540 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"selections/#selections","page":"Selections","title":"Selection functions","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"A simple selection syntax is provided. Use it with, for example: ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"atoms = select(atoms,\"protein and resnum < 30\")","category":"page"},{"location":"selections/#General-selections","page":"Selections","title":"General selections","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Accepted Boolean operators: and, or, and not. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"The accepted keywords for the selection are: ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Keyword Options Input value Example\nindex =,>,<,<=,>= Integer index <= 10\nindex_pdb =,>,<,<=,>= Integer index_pdb <= 10\nname String name CA\nelement String element N\nresname String resname ALA\nresnum =,>,<,<=,>= Integer resnum = 10\nresidue =,>,<,<=,>= Integer residue = 10\nchain String chain A\nmodel Integer model 1\nbeta =,>,<,<=,>= Real beta > 0.5\noccup =,>,<,<=,>= Real occup >= 0.3\nsegname String segname PROT\n ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nresnum is the residue number as written in the PDB file, while residue is the residue number counted sequentially in the file.index_pdb is the number written in the \"atom index\" field of the PDB file, while index is the sequential index of the atom in the file. ","category":"page"},{"location":"selections/#Special-macros:-proteins,-water","page":"Selections","title":"Special macros: proteins, water","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Just use these keywords to select the residues matching the properties desired. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Examples:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"aromatic = select(atoms,\"aromatic\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"aromatic = select(atoms,\"charged\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Available keywords:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Keywords \nwater \nprotein backbone sidechain\nacidic basic \naliphatic aromatic \ncharged neutral \npolar nonpolar \nhydrophobic \n ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nThe properties refer to protein residues and will return false to every non-protein residue. Thus, be careful with the use of not with these selections, as they might retrieve non-protein atoms.","category":"page"},{"location":"selections/#Retrieving-indexes-only","page":"Selections","title":"Retrieving indexes only","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"If only the indexes of the atoms are of interest, a specific function will directly return them:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"indexes = selindex(atoms,\"protein and name CA\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nAll indexing is 1-based. Thus, the first atom of the structure is atom 1.","category":"page"},{"location":"selections/#Use-Julia-anonymous-functions-directly","page":"Selections","title":"Use Julia anonymous functions directly","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Selections can be done using Julia anonymous functions directly, providing a greater control over the selection and, possibly, the use of user defined selection functions. For example:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"atoms = select(atoms, by = atom -> atom.x < 10.)\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"With that, selections can become really complex, as:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"sel = atom -> (atom.x < 10. && atom.resname == \"GLY\") || (atom.name == \"CA\") \natoms = select(atoms, by = sel )\n","category":"page"},{"location":"selections/#Iterate-over-residues-(or-molecules)","page":"Selections","title":"Iterate over residues (or molecules)","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"The eachresidue iterator allows iteration over the resiudes of a structure (in PDB files distinct molecules are associated to different residues, thus this iterates similarly over the molecules of a structure). For example:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> protein = wget(\"1LBD\")\n Array{Atoms,1} with 1870 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n ⋮ \n 1868 OG1 THR A 462 238 -27.462 74.325 48.885 79.98 1.00 1 - 1868\n 1869 CG2 THR A 462 238 -27.063 71.965 49.222 78.62 1.00 1 - 1869\n 1870 OXT THR A 462 238 -25.379 71.816 51.613 84.35 1.00 1 - 1870\n\njulia> nALA = 0\n for residue in eachresidue(protein)\n if name(residue) == \"ALA\"\n nALA += 1\n end\n end\n nALA\n22\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"The result of the iterator can also be collected, with:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> residues = collect(eachresidue(protein))\n Array{Residue,1} with 238 residues.\n\n\njulia> residues[1]\n Residue of name SER with 6 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"These residue vector do not copy the data from the original atom vector. Therefore, changes performed on these vectors will be reflected on the original data. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"It is possible also to iterate over the atoms of one or more residue:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> m_ALA = 0.\n for residue in eachresidue(protein)\n if name(residue) == \"ALA\"\n for atom in residue\n m_ALA += mass(atom)\n end\n end\n end\n m_ALA\n1452.8601999999983\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Which, in this simple example, results in the same as:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> sum( mass(atom) for atom in protein if atom.resname == \"ALA\" )\n1452.8601999999983\n","category":"page"},{"location":"auxiliary/#Some-auxiliary-functions-to-quickly-retrieve-some-data","page":"Auxiliary functions","title":"Some auxiliary functions to quickly retrieve some data","text":"","category":"section"},{"location":"auxiliary/#Get-the-protein-sequence","page":"Auxiliary functions","title":"Get the protein sequence","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"To obtain a list of the residue names of the protein with three- and one-letter codes, use","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> seq = getseq(\"file.pdb\")\n76-element Vector{String}:\n \"V\"\n \"K\"\n ⋮ \n \"R\"\n \"G\"\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Use getseq(atoms,code=2) to get the sequence as three-letter residue codes, or code=3 to get full natural-aminoacid names, like \"Alanine\", \"Proline\", etc.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"note: Note\nIf there is some non-standard protein residue in the sequence, inform the getseq function by adding a selection:julia> getseq(\"file.pdb\",\"protein or resname NEW\")\n77-element Vector{String}:\n \"V\"\n \"N\"\n ⋮ \n \"R\"\n \"G\"By default the selection will only return the sequence of natural amino acids. ","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The getseq function can of course be used on an Atom list, accepts selections as the last argument, as well as the reading and writing functions:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"atoms = readPDB(\"file.pdb\")\nseq = getseq(atoms,\"chain A\")\n","category":"page"},{"location":"auxiliary/#Distance-between-sets-of-atoms","page":"Auxiliary functions","title":"Distance between sets of atoms","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The distance between atoms, or sets of atoms, can be computed with the distance function. This function returns the minimum distance between the atoms of the sets involved. For example:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> distance(protein,ligand)\n2.7775834820937417\n ","category":"page"},{"location":"auxiliary/#Closest-atoms-and-their-distance","page":"Auxiliary functions","title":"Closest atoms and their distance","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"A function similar to the one above is closest, which returns the shortest distance between atoms but also the identity of the atom or pair of atoms that satisfy that shortest distance:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> closest(ligand,protein)\n(43, 3684, 2.7775834820937417)\n\njulia> ligand[43]\n 4037 O1 T3 B 2 512 -22.568 81.625 3.159 36.59 1.00 1 - 4041\n\njulia> protein[3684]\n 3684 NE2 HIS B 435 472 -21.539 82.145 5.686 44.44 1.00 1 - 3686\n\njulia> distance(ligand[43],protein[3684])\n2.7775834820937417\n ","category":"page"},{"location":"auxiliary/#Obtain-arrays-with-coordinates","page":"Auxiliary functions","title":"Obtain arrays with coordinates","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"All atoms:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> x = coor(atoms)\n1463-element Vector{SVector{3, Float64}}:\n [-9.229, -14.861, -5.481]\n [-10.048, -15.427, -5.569]\n [-9.488, -13.913, -5.295]\n ⋮\n [5.772, -10.399, -8.044]\n [6.408, -12.034, -8.343]\n [6.017, -10.967, -9.713]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Or use selections to retrieve the coordinates of subsets of atoms:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Calpha coordinates:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> xCA = coor(protein,\"name CA\")\n104-element Vector{SVector{3, Float64}}:\n [-8.483, -14.912, -6.726]\n [-5.113, -13.737, -5.466]\n [-3.903, -11.262, -8.062]\n ⋮\n 7.836, -2.933, -6.873]\n [4.414, -4.302, -7.734]\n [4.134, -7.811, -6.344]\n [3.244, -10.715, -8.603]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The coordinates are output as arrays of static arrays (more specifically, as a Vector{SVector{3,Float64}}, from StaticArrays). ","category":"page"},{"location":"auxiliary/#Maximum-and-minimum-coordinates-of-the-atoms","page":"Auxiliary functions","title":"Maximum and minimum coordinates of the atoms","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Use maxmin(atoms), or maxmin(atoms,\"resname CA\"), for example:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> m = maxmin(atoms,\"chain A\")\n\n Minimum atom coordinates: xmin = [-41.5, -41.526, -41.517]\n Maximum atom coordinates: xmax = [41.583, 41.502, 41.183]\n Length in each direction: xlength = [83.083, 83.028, 82.7]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"m is a structure containing the three vectors with minimum and maximum coordinates, and lengths.","category":"page"},{"location":"auxiliary/#Residue-tick-labels-for-plots","page":"Auxiliary functions","title":"Residue tick labels for plots","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"compat: Compat\nThe residue_ticks function requires at least PDBTools version 0.14.1.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The residue_ticks function provides a practical way to define tick labels in plots associated to an amino-acid sequence:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"residue_ticks(\n atoms::AbstractVector{<:Atom}; \n first=nothing, last=nothing, stride=1, oneletter=true\n)","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The function returns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"first and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"If oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX. ","category":"page"},{"location":"auxiliary/#Example","page":"Auxiliary functions","title":"Example","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Here we illustrate how to plot the average temperature factor of each residue of a crystallographic model as function of the residues.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> using PDBTools, Plots\n\njulia> atoms = wget(\"1UBQ\", \"protein\");\n\njulia> residue_ticks(atoms; stride=10) # example of output\n([1, 11, 21, 31, 41, 51, 61, 71], [\"M1\", \"K11\", \"D21\", \"Q31\", \"Q41\", \"E51\", \"I61\", \"L71\"])\n\njulia> plot(\n resnum.(eachresidue(atoms)), # x-axis: residue numbers\n [ mean(beta.(res)) for res in eachresidue(atoms) ], # y-axis: average b-factor per residue\n xlabel=\"Residue\", \n xticks=residue_ticks(atoms; stride=10), # here we define the x-tick labels\n ylabel=\"b-factor\", \n xrotation=60,\n label=nothing, framestyle=:box,\n )","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Produces the following plot:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"(Image: ./assets/residue_ticks.png)","category":"page"},{"location":"elements/#Atomic-and-molecular-properties","page":"Element properties","title":"Atomic and molecular properties","text":"","category":"section"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"Some simple atom properties can be retrieved using special functions, which operate on atoms of the type Atom. For example:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"julia> atoms = readPDB(\"./file.pdb\");\n\njulia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 OW SOL X 1 1 54.370 45.310 33.970 0.00 0.00 1 - 1\n\njulia> mass(atoms[1])\n14.0067\n\njulia> atomic_number(atoms[1])\n7\n\njulia> element(atoms[1])\n\"N\"\n\njulia> element_name(atoms[1])\n\"Nitrogen\"","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"The formula or stoichiometry of a selection can also be retrieved:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"julia> atoms = wget(\"1LBD\",\"protein and residue 1\");\n\njulia> f = formula(atoms)\nC₃N₁O₂\n\njulia> stoichiometry(select(atoms,\"water\"))\nH₂O₁\n","category":"page"},{"location":"elements/#AtomsBase-compatibility","page":"Element properties","title":"AtomsBase compatibility","text":"","category":"section"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"compat: Compat\nThis interface requires at least PDBTools version 0.14.2.","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"The following functions are supported as part of the API, to conform the AtomsBase interface:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"Function Example Output\natomic_number(::PDBTools.Atom) atomic_number(Atom(name=\"NE2\")) 7\natomic_symbol(::PDBTools.Atom) atomic_symbol(Atom(name=\"NE2\")) :N\natomic_mass(::PDBTools.Atom) atomic_mass(Atom(name=\"NE2\")) 14.0067\nposition(::PDBTools.Atom) position(Atom(name=\"NE2\")) SVector{3,Float64}(0,0,0)","category":"page"},{"location":"help/#Help-entries","page":"Help entries","title":"Help entries","text":"","category":"section"},{"location":"help/","page":"Help entries","title":"Help entries","text":"These entries can be accessed from the Julia REPL by typing ?, for example,","category":"page"},{"location":"help/","page":"Help entries","title":"Help entries","text":"julia> ? mass\nsearch: mass mapslices MathConstants makedocs set_zero_subnormals get_zero_subnormals mutable struct\n\n mass(name::String or atom::Atom or Vector{Atom})\n\n Returns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms.\n\n Example\n –––––––––\n\n julia> atoms = [ Atom(name=\"NT3\"), Atom(name=\"CA\") ];\n \n julia> mass(atoms[1])\n 14.0067\n \n julia> mass(\"CA\")\n 12.011\n \n julia> mass(atoms)\n 26.017699999999998\n","category":"page"},{"location":"help/","page":"Help entries","title":"Help entries","text":"Modules=[PDBTools]","category":"page"},{"location":"help/#PDBTools.Atom","page":"Help entries","title":"PDBTools.Atom","text":"Atom::DataType\n\nStructure that contains the atom properties. It is mutable, so it can be edited. Fields:\n\nmutable struct Atom\n index::Int # The sequential index of the atoms in the file\n index_pdb::Int # The index as written in the PDB file (might be anything)\n name::String # Atom name\n resname::String # Residue name\n chain::String # Chain identifier\n resnum::Int # Number of residue as written in PDB file\n residue::Int # Sequential residue (molecule) number in file\n x::Float64 # x coordinate\n y::Float64 # y coordinate\n z::Float64 # z coordinate\n beta::Float64 # temperature factor\n occup::Float64 # occupancy\n model::Int # model number\n segname::String # Segment name (cols 73:76)\n element::String # Element symbol string (cols 77:78)\n charge::String # Charge (cols: 79:80)\nend\n\nExample\n\njulia> pdb = wget(\"1LBD\");\n\njulia> printatom(pdb[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA P 1 1 2.062 -13.995 21.747 0.00 1.00 1 PROT 1\n\njulia> pdb[1].resname\n\"ALA\"\n\njulia> pdb[1].chain\n\"P\"\n\njulia> element(pdb[1])\n\"N\"\n\njulia> mass(pdb[1])\n14.0067\n\nThe element and charge fields, which are frequently left empty in PDB files, are not printed. They can be retrieved with the pdb_element and pdb_charge getter functions. \n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Formula","page":"Help entries","title":"PDBTools.Formula","text":"Formula::DataType\n\nFormula data type. Contains the number of atoms of each type in a vector of tuples.\n\nExample\n\njulia> atoms = wget(\"1LBD\",\"protein and residue 1\");\n\njulia> f = formula(atoms)\nC₃N₁O₂\n\n\njulia> f[1]\n(\"C\", 3)\n\njulia> f[2]\n(\"N\", 1)\n\njulia> f[3]\n(\"O\", 2)\n\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.FunctionalKeyword","page":"Help entries","title":"PDBTools.FunctionalKeyword","text":"FunctionalKeyword{T}\n\nThis is a structure that will store a keyword that depends on an external function requiring an operator and an argument. \n\nExample:\n\nelement_keyword = FunctionalKeyword(String, \n \"element\",\n element,\n (\"=\",isequal))\n\n\nwill define a keyword \"element\" to be used as element C, which will return true if there is an element function such that element(atom) == C.\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Residue","page":"Help entries","title":"PDBTools.Residue","text":"Residue(atoms::AbstractVector{Atom}, range::UnitRange{Int})\n\nResidue data structure. It contains two fields: atoms which is a vector of Atom elements, and range, which indicates which atoms of the atoms vector compose the residue.\n\nThe Residue structure carries the properties of the residue or molecule of the atoms it contains, but it does not copy the original vector of atoms, only the residue meta data for each residue.\n\nExample\n\njulia> pdb = wget(\"1LBD\");\n\njulia> residues = collect(eachresidue(pdb))\n Array{Residue,1} with 238 residues.\n\njulia> resnum.(residues[1:3])\n3-element Vector{Int64}:\n 225\n 226\n 227\n\njulia> residues[5].chain\n\"A\"\n\njulia> residues[8].range\n52:58\n\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Sequence","page":"Help entries","title":"PDBTools.Sequence","text":"Sequence\n\nWrapper for strings, or vectors of chars, strings, or residue names, to dispatch on functions that operate on amino acid sequences.\n\nExample\n\njulia> seq = [\"Alanine\", \"Glutamic acid\", \"Glycine\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = \"AEG\";\n\njulia> mass(Sequence(seq))\n257.2432\n\n\n\n\n\n","category":"type"},{"location":"help/#AtomsBase.atomic_number-Tuple{Atom}","page":"Help entries","title":"AtomsBase.atomic_number","text":"atomic_number(name::String or atom::Atom)\n\nReturns the atomic number of an atom given its name, or Atom structure.\n\nExample\n\njulia> at = Atom(name=\"NT3\");\n\njulia> atomic_number(at)\n7\n\njulia> atomic_number(\"CA\")\n6\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.closest-Union{Tuple{T2}, Tuple{T1}, Tuple{AbstractVector{T1}, AbstractVector{T2}}} where {T1, T2<:Union{Atom, StaticArraysCore.SVector}}","page":"Help entries","title":"PDBTools.closest","text":"closest(x,y)\n\nComputes the minimum distance between two sets of atoms and returns the indexes of the atoms and their distance. Both vector of atoms or vectors of coordinates can be used as input.\n\nExamples\n\njulia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> closest(ligand,protein)\n(43, 3684, 2.7775834820937417)\n\njulia> ligand[43]\n 4037 O1 T3 B 2 512 -22.568 81.625 3.159 36.59 1.00 1 - 4041\n\njulia> closest(ligand[43],protein)\n(1, 3684, 2.7775834820937417)\n\njulia> x = coor(protein)\n3994-element Vector{SVector{3, Float64}}:\n [52.884, 24.022, 35.587]\n [52.916, 24.598, 36.993]\n ⋮\n [-46.887, 86.925, 13.235]\n [-47.164, 83.593, 15.25]\n\njulia> closest(ligand,x)\n(43, 3684, 2.7775834820937417)\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.coor-Tuple{Atom}","page":"Help entries","title":"PDBTools.coor","text":"coor(atoms; selection)\n\nReturns the coordinates of the atoms. The input may be one atom (type Atom), a vector of atoms, or a Residue. The coordinates are returned as a vector of static vectors (from StaticArrays), more specifically as a Vector{SVector{3,Float64}}.\n\nExamples\n\njulia> using PDBTools, StaticArrays \n\njulia> protein = wget(\"1LBD\");\n\njulia> coor(protein[1])\n3-element SVector{3, Float64} with indices SOneTo(3):\n 45.228\n 84.358\n 70.638\n\njulia> coor(protein[1],as=SVector{3,Float32})\n3-element SVector{3, Float32} with indices SOneTo(3):\n 45.228\n 84.358\n 70.638\n\njulia> coor(protein, \"index <= 2\")\n2-element Vector{SVector{3, Float64}}:\n [45.228, 84.358, 70.638]\n [46.08, 83.165, 70.327]\n\njulia> coor(protein, only = at -> at.resname == \"ALA\")\n110-element Vector{SVector{3, Float64}}:\n [43.94, 81.982, 70.474]\n [43.02, 80.825, 70.455]\n [41.996, 80.878, 69.34]\n ⋮\n [-17.866, 84.088, 51.741]\n [-18.496, 83.942, 52.777]\n [-15.888, 82.583, 51.706]\n \njulia> residues = collect(eachresidue(protein));\n\njulia> coor(residues[1])\n6-element Vector{SVector{3, Float64}}:\n [45.228, 84.358, 70.638]\n [46.08, 83.165, 70.327]\n [45.257, 81.872, 70.236]\n [45.823, 80.796, 69.974]\n [47.147, 82.98, 71.413]\n [46.541, 82.639, 72.662]\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.distance-Tuple{StaticArraysCore.SVector, StaticArraysCore.SVector}","page":"Help entries","title":"PDBTools.distance","text":"distance(x,y)\n\nComputes the minimum distance between two sets of atoms, between an atom and a set of atoms, or simply the distance between two atoms. The input may be a vector of Atoms, or the coordinates that are output of the coor function. \n\nExamples\n\njulia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> distance(protein,ligand)\n2.7775834820937417\n\njulia> distance(protein[1],ligand[3])\n36.453551075306784\n\njulia> distance(coor(ligand),protein)\n2.7775834820937417\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.eachresidue-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.eachresidue","text":"eachresidue(atoms::AbstractVector{Atom})\n\nIterator for the residues (or molecules) of a selection. \n\nExample\n\njulia> atoms = wget(\"1LBD\");\n\njulia> length(eachresidue(atoms))\n238\n\njulia> for res in eachresidue(atoms)\n println(res)\n end\n Residue of name SER with 6 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n\n Residue of name ALA with 5 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 7 N ALA A 226 2 43.940 81.982 70.474 67.09 1.00 1 - 7\n 8 CA ALA A 226 2 43.020 80.825 70.455 63.69 1.00 1 - 8\n 9 C ALA A 226 2 41.996 80.878 69.340 59.69 1.00 1 - 9\n ...\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.edit!-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.edit!","text":"edit!(atoms::Vector{Atom})\n\nOpens a temporary PDB file in which the fields of the vector of atoms can be edited. \n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.element-Tuple{Atom}","page":"Help entries","title":"PDBTools.element","text":"element_name(name::String or atom::Atom)\n\nReturns the element name of an atom given its name, or Atom structure.\n\nExample\n\njulia> at = Atom(name=\"NT3\");\n\njulia> element_name(at)\n\"Nitrogen\"\n\njulia> element_name(\"NT3\")\n\"Nitrogen\"\n\njulia> element_name(\"CA\")\n\"Carbon\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.formula-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.formula","text":"formula(atoms::AbstractVector{Atom})\n\nReturns the molecular formula of the current selection. \n\nExample\n\njulia> first_residue = wget(\"1LBD\",\"protein and residue 1\")\n Array{Atoms,1} with 6 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n\n\njulia> formula(first_residue)\nC₃N₁O₂\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.getseq-Tuple{AbstractVector{Atom}, String}","page":"Help entries","title":"PDBTools.getseq","text":"getseq(Vector{Atom} or filename; selection, code)\n\nReturns the sequence of aminoacids from the vector of atoms or file name. Selections may be applied. Code defines if the output will be a one-letter, three-letter or full-residue name array.\n\nExample\n\njulia> protein = wget(\"1LBD\");\n\njulia> getseq(protein,\"residue < 3\")\n2-element Vector{String}:\n \"S\"\n \"A\"\n\njulia> getseq(protein,\"residue < 3\", code=2)\n2-element Vector{String}:\n \"SER\"\n \"ALA\"\n\njulia> getseq(protein,\"residue < 3\",code=3)\n2-element Vector{String}:\n \"Serine\"\n \"Alanine\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.has_key-Tuple{String, AbstractVector{<:AbstractString}}","page":"Help entries","title":"PDBTools.has_key","text":"has_key(key::String, s::AbstractVector{<:AbstractString})\n\nReturns the first index of the vector s in which where key is found, or 0. \n\nExample:\n\n\njulia> PDBTools.has_key(\"or\",[\"name\",\"CA\",\"or\",\"index\",\"1\"])\n3\n\njulia> PDBTools.has_key(\"and\",[\"name\",\"CA\",\"or\",\"index\",\"1\"])\n0\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.mass-Tuple{Atom}","page":"Help entries","title":"PDBTools.mass","text":"mass(name::String or atom::Atom or Vector{Atom})\n\nReturns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms. \n\nExample\n\njulia> atoms = [ Atom(name=\"NT3\"), Atom(name=\"CA\") ];\n\njulia> mass(atoms[1])\n14.0067\n\njulia> mass(\"CA\")\n12.011\n\njulia> mass(atoms)\n26.017699999999998\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.mass-Tuple{Sequence}","page":"Help entries","title":"PDBTools.mass","text":"mass(s::Sequence)\n\nReturns the mass of a sequence of amino acids, given a Sequence struct type.\n\nExamples\n\njulia> seq = [\"Alanine\", \"Glutamic acid\", \"Glycine\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = \"AEG\";\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = [\"ALA\", \"GLU\", \"GLY\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.maxmin-Tuple{AbstractVector{Atom}, String}","page":"Help entries","title":"PDBTools.maxmin","text":"maxmin(atoms::Vector{Atom}; selection)\n\nReturns the maximum and minimum coordinates of an atom vector, and the length (maximum minus minimum) in each direction. \n\nExample\n\njulia> protein = wget(\"1LBD\");\n\njulia> maxmin(protein)\n \n Minimum atom coordinates: xmin = [-29.301, 57.178, 45.668]\n Maximum atom coordinates: xmax = [47.147, 99.383, 86.886]\n Length in each direction: xlength = [76.448, 42.205, 41.217999999999996]\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.oneletter-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.oneletter","text":"oneletter(residue::Union{String,Char})\n\nFunction to return a one-letter residue code from the three letter code or residue name. The function is case-insensitive.\n\nExamples\n\njulia> oneletter(\"ALA\")\n\"A\"\n\njulia> oneletter(\"Glutamic acid\")\n\"E\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_query-Tuple{String}","page":"Help entries","title":"PDBTools.parse_query","text":"parse_query(selection:String)\n\nCalls parse_query_vector after splitting the selection string.\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_query_vector-Tuple{Any}","page":"Help entries","title":"PDBTools.parse_query_vector","text":"parse_query_vector(s::AbstractVector{<:AbstractString})\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_to_type-Tuple{Union{PDBTools.Keyword, PDBTools.FunctionalKeyword}, Any}","page":"Help entries","title":"PDBTools.parse_to_type","text":"parse_to_type(key::Keyword, val::String)\n\nTries to parse val into the type of value expected by key.ValueType. \n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.readPDB-Tuple{String, String}","page":"Help entries","title":"PDBTools.readPDB","text":"readPDB(filename; selection)\n\nReads a PDB file and stores the data in a vector of type Atom.\n\nExample\n\njulia> protein = readPDB(\"../test/structure.pdb\")\n Array{Atoms,1} with 62026 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n 3 HT2 ALA A 1 1 -9.488 -13.913 -5.295 0.00 0.00 1 PROT 3\n ⋮ \n 62024 OH2 TIP3 C 9339 19638 13.485 -4.534 -34.438 0.00 1.00 1 WAT2 62024\n 62025 H1 TIP3 C 9339 19638 13.218 -3.647 -34.453 0.00 1.00 1 WAT2 62025\n 62026 H2 TIP3 C 9339 19638 12.618 -4.977 -34.303 0.00 1.00 1 WAT2 62026\n\njulia> protein = readPDB(\"../test/structure.pdb\",\"resname = ALA\")\n Array{Atoms,1} with 72 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n 3 HT2 ALA A 1 1 -9.488 -13.913 -5.295 0.00 0.00 1 PROT 3\n ⋮ \n 1338 HB3 ALA A 95 95 11.464 -3.278 -4.953 0.00 1.00 1 PROT 1338\n 1339 C ALA A 95 95 14.815 -3.057 -5.633 0.00 1.00 1 PROT 1339\n 1340 O ALA A 95 95 14.862 -2.204 -6.518 0.00 1.00 1 PROT 1340\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.residue_ticks-Tuple{AbstractVector{<:Atom}}","page":"Help entries","title":"PDBTools.residue_ticks","text":"residue_ticks(atoms::AbstractVector{<:Atom}; first=nothing, last=nothing, stride=1, oneletter=true)\n\nReturns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.\n\nfirst and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.\n\nIf oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX. \n\nExamples\n\njulia> using PDBTools\n\njulia> atoms = wget(\"1UBQ\", \"protein\");\n\njulia> residue_ticks(atoms; stride=10)\n([1, 11, 21, 31, 41, 51, 61, 71], [\"M1\", \"K11\", \"D21\", \"Q31\", \"Q41\", \"E51\", \"I61\", \"L71\"])\n\nThe resulting tuple of residue numbers and labels can be used as xticks in Plots.plot, for example.\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.residuename-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.residuename","text":"residuename(residue::Union{String,Char})\n\nFunction to return the long residue name from other residue codes. The function is case-insensitive.\n\nExamples\n\njulia> residuename(\"A\")\n\"Alanine\"\n\njulia> residuename(\"Glu\")\n\"Glutamic Acid\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.resname-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.resname","text":"resname(residue::Union{String,Char})\n\nReturns the residue name, given the one-letter code or residue name. Differently from threeletter, this function will return the force-field name if available in the list of protein residues.\n\nExamples\n\njulia> resname(\"ALA\")\n\"ALA\"\n\njulia> resname(\"GLUP\")\n\"GLUP\"\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.stoichiometry-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.stoichiometry","text":"stoichiometry(atoms::AbstractVector{Atom})\n\nReturns the stoichiometry of atom selection in a Formula structure. \n\nExample\n\njulia> stoichiometry(select(atoms,\"water\"))\nH₂O₁\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.threeletter-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.threeletter","text":"threeletter(residue::String)\n\nFunction to return the three-letter natural-amino acid residue code from the one-letter code or residue name. The function is case-insensitive.\n\nExamples\n\njulia> threeletter(\"A\")\n\"ALA\"\n\njulia> threeletter(\"Aspartic acid\")\n\"ASP\"\n\njulia> threeletter(\"HSD\")\n\"HIS\"\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.wget-Tuple{String, String}","page":"Help entries","title":"PDBTools.wget","text":"wget(PDBid; selection)\n\nRetrieves a PDB file from the protein data bank. Selections may be applied.\n\nExample\n\njulia> protein = wget(\"1LBD\",\"chain A\")\n Array{Atoms,1} with 1870 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n ⋮ \n 1868 OG1 THR A 462 238 -27.462 74.325 48.885 79.98 1.00 1 - 1868\n 1869 CG2 THR A 462 238 -27.063 71.965 49.222 78.62 1.00 1 - 1869\n 1870 OXT THR A 462 238 -25.379 71.816 51.613 84.35 1.00 1 - 1870\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.writePDB-Tuple{AbstractVector{Atom}, Any, Any}","page":"Help entries","title":"PDBTools.writePDB","text":"writePDB(atoms::Vector{Atom}, filename, selection; header=:auto, footer=:auto)\n\nWrite a PDB file with the atoms in atoms to filename. The selection argument is a string that can be used to select a subset of the atoms in atoms. For example, writePDB(atoms, \"test.pdb\", \"name CA\").\n\nThe header and footer arguments can be used to add a header and footer to the PDB file. If header is :auto, then a header will be added with the number of atoms in atoms. If footer is :auto, then a footer will be added with the \"END\" keyword. Either can be set to nothing if no header or footer is desired.\n\n\n\n\n\n","category":"method"},{"location":"installation/#Installation","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"installation/","page":"Installation","title":"Installation","text":"Install the package using the package manager:","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"julia> ] add PDBTools\n","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"and load it with","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"julia> using PDBTools\n","category":"page"},{"location":"readwrite/#Read-and-write-files","page":"Read and Write","title":"Read and write files","text":"","category":"section"},{"location":"readwrite/#Read-a-PDB-file","page":"Read and Write","title":"Read a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"To read a PDB file and return a vector of atoms of type Atom, do:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"atoms = readPDB(\"file.pdb\")\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Atom is the structure of data containing the atom index, name, residue, coordinates, etc. For example, after reading a file (as shown bellow), a list of atoms with the following structure will be generated:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"The data in the Atom structure is organized as follows:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"struct Atom\n index :: Int64 # The sequential index of the atoms in the file\n index_pdb :: Int64 # The index as written in the PDB file (might be anything)\n name :: String\n resname :: String\n chain :: String\n resnum :: Int64 # Number of residue as written in PDB file\n residue :: Int64 # Sequential residue (molecule) number in file\n x :: Float64\n y :: Float64\n z :: Float64\n beta :: Float64\n occup :: Float64\n model :: Int64\n segname :: String # Segment name (cols 73:76)\nend","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"tip: Tip\nFor all these reading and writting functions, a final argument can be provided to read or write a subset of the atoms, following the selection syntax described in the Selection section. For example:protein = readPDB(\"file.pdb\",\"protein\")\norarginines = readPDB(\"file.pdb\",\"resname ARG\")\nThe only difference is that, if using Julia anonymous functions, the keyword is only:arginines = readPDB(\"file.pdb\",only = atom -> atom.resname == \"ARG\")\nThe same is valid for the write function, below. ","category":"page"},{"location":"readwrite/#Retrive-from-Protein-Data-Bank","page":"Read and Write","title":"Retrive from Protein Data Bank","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Use the wget function to retrieve the atom data directly from the PDB database, optionally filtering the atoms with a selection:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> atoms = wget(\"1LBD\",\"name CA\")\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 8 CA ALA A 226 2 43.020 80.825 70.455 63.69 1.00 1 - 8\n 13 CA ASN A 227 3 41.052 82.178 67.504 53.45 1.00 1 - 13\n ⋮\n 1847 CA GLN A 460 236 -22.650 79.082 50.023 71.46 1.00 1 - 1847\n 1856 CA MET A 461 237 -25.561 77.191 51.710 78.41 1.00 1 - 1856\n 1864 CA THR A 462 238 -26.915 73.645 51.198 82.96 1.00 1 - 1864\n","category":"page"},{"location":"readwrite/#Edit-a-PDB-file","page":"Read and Write","title":"Edit a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"The Atom structure is mutable, meaning that the fields can be edited. For example:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> atoms = readPDB(\"file.pdb\")\n Array{PDBTools.Atom,1} with 62026 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n 3 HT2 ALA A 1 1 -9.488 -13.913 -5.295 0.00 0.00 1 PROT 3\n\njulia> atoms[1].segname = \"ABCD\"\n\"ABCD\"\n\njulia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 ABCD 1\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Additionally, With the edit! function, you can directly edit or view the data in a vector of Atoms in your preferred text editor. ","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> edit!(atoms)\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"This will open a text editor. Here, we modified the data in the resname field of the first atom to ABC. Saving and closing the file will update the atoms array:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ABC A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n","category":"page"},{"location":"readwrite/#Write-a-PDB-file","page":"Read and Write","title":"Write a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"To write a PDB file use the writePDB function, as:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"writePDB(atoms,\"file.pdb\")\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"where atoms contain a list of atoms with the Atom structures.","category":"page"},{"location":"readwrite/#Read-and-write-single-atom-lines","page":"Read and Write","title":"Read and write single-atom lines","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"PDBTools.read_atom(pdb_line): Given a line of a PDB file containing atom data, returns the data in a Atom structure. ","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"PDBTools.write_atom(atom::Atom): Given an atom in the Atom structure, returns a string formatted in the PDB format, to be written to a file. ","category":"page"},{"location":"#PDBTools","page":"Home","title":"PDBTools","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"PDBTools is a simple package to read and write Protein Data Bank files, select atoms, and work with their coordinates. ","category":"page"},{"location":"#Features:","page":"Home","title":"Features:","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Simple data structure: ","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 OW SOL X 1 1 54.370 45.310 33.970 0.00 0.00 1 - 1","category":"page"},{"location":"","page":"Home","title":"Home","text":"Selection syntax:","category":"page"},{"location":"","page":"Home","title":"Home","text":"resname ARG and name CA","category":"page"},{"location":"","page":"Home","title":"Home","text":"Allows use of Julia (possibly user-defined) functions for selection:","category":"page"},{"location":"","page":"Home","title":"Home","text":"atom -> ( atom.resname == \"ARG\" && atom.x < 10 ) || atom.name == \"N\"","category":"page"},{"location":"#Not-indicated-for:","page":"Home","title":"Not indicated for:","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"We do not aim to provide the fastest PDB parsing methods. If speed in reading files, returning subsets of the structures, etc., is critical to you, probably you will do better with some packages of BioJulia, BioStructures in particular.","category":"page"}] +[{"location":"selections/#selections","page":"Selections","title":"Selection functions","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"A simple selection syntax is provided. Use it with, for example: ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"atoms = select(atoms,\"protein and resnum < 30\")","category":"page"},{"location":"selections/#General-selections","page":"Selections","title":"General selections","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Accepted Boolean operators: and, or, and not. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"The accepted keywords for the selection are: ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Keyword Options Input value Example\nindex =,>,<,<=,>= Integer index <= 10\nindex_pdb =,>,<,<=,>= Integer index_pdb <= 10\nname String name CA\nelement String element N\nresname String resname ALA\nresnum =,>,<,<=,>= Integer resnum = 10\nresidue =,>,<,<=,>= Integer residue = 10\nchain String chain A\nmodel Integer model 1\nbeta =,>,<,<=,>= Real beta > 0.5\noccup =,>,<,<=,>= Real occup >= 0.3\nsegname String segname PROT\n ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nresnum is the residue number as written in the PDB file, while residue is the residue number counted sequentially in the file.index_pdb is the number written in the \"atom index\" field of the PDB file, while index is the sequential index of the atom in the file. ","category":"page"},{"location":"selections/#Special-macros:-proteins,-water","page":"Selections","title":"Special macros: proteins, water","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Just use these keywords to select the residues matching the properties desired. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Examples:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"aromatic = select(atoms,\"aromatic\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"aromatic = select(atoms,\"charged\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Available keywords:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Keywords \nwater \nprotein backbone sidechain\nacidic basic \naliphatic aromatic \ncharged neutral \npolar nonpolar \nhydrophobic \n ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nThe properties refer to protein residues and will return false to every non-protein residue. Thus, be careful with the use of not with these selections, as they might retrieve non-protein atoms.","category":"page"},{"location":"selections/#Retrieving-indexes-only","page":"Selections","title":"Retrieving indexes only","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"If only the indexes of the atoms are of interest, a specific function will directly return them:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"indexes = selindex(atoms,\"protein and name CA\")\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"note: Note\nAll indexing is 1-based. Thus, the first atom of the structure is atom 1.","category":"page"},{"location":"selections/#Use-Julia-anonymous-functions-directly","page":"Selections","title":"Use Julia anonymous functions directly","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"Selections can be done using Julia anonymous functions directly, providing a greater control over the selection and, possibly, the use of user defined selection functions. For example:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"atoms = select(atoms, by = atom -> atom.x < 10.)\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"With that, selections can become really complex, as:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"sel = atom -> (atom.x < 10. && atom.resname == \"GLY\") || (atom.name == \"CA\") \natoms = select(atoms, by = sel )\n","category":"page"},{"location":"selections/#Iterate-over-residues-(or-molecules)","page":"Selections","title":"Iterate over residues (or molecules)","text":"","category":"section"},{"location":"selections/","page":"Selections","title":"Selections","text":"The eachresidue iterator allows iteration over the resiudes of a structure (in PDB files distinct molecules are associated to different residues, thus this iterates similarly over the molecules of a structure). For example:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> protein = wget(\"1LBD\")\n Array{Atoms,1} with 1870 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n ⋮ \n 1868 OG1 THR A 462 238 -27.462 74.325 48.885 79.98 1.00 1 - 1868\n 1869 CG2 THR A 462 238 -27.063 71.965 49.222 78.62 1.00 1 - 1869\n 1870 OXT THR A 462 238 -25.379 71.816 51.613 84.35 1.00 1 - 1870\n\njulia> nALA = 0\n for residue in eachresidue(protein)\n if name(residue) == \"ALA\"\n nALA += 1\n end\n end\n nALA\n22\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"The result of the iterator can also be collected, with:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> residues = collect(eachresidue(protein))\n Array{Residue,1} with 238 residues.\n\n\njulia> residues[1]\n Residue of name SER with 6 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"These residue vector do not copy the data from the original atom vector. Therefore, changes performed on these vectors will be reflected on the original data. ","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"It is possible also to iterate over the atoms of one or more residue:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> m_ALA = 0.\n for residue in eachresidue(protein)\n if name(residue) == \"ALA\"\n for atom in residue\n m_ALA += mass(atom)\n end\n end\n end\n m_ALA\n1452.8601999999983\n","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"Which, in this simple example, results in the same as:","category":"page"},{"location":"selections/","page":"Selections","title":"Selections","text":"julia> sum( mass(atom) for atom in protein if atom.resname == \"ALA\" )\n1452.8601999999983\n","category":"page"},{"location":"auxiliary/#Some-auxiliary-functions-to-quickly-retrieve-some-data","page":"Auxiliary functions","title":"Some auxiliary functions to quickly retrieve some data","text":"","category":"section"},{"location":"auxiliary/#Get-the-protein-sequence","page":"Auxiliary functions","title":"Get the protein sequence","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"To obtain a list of the residue names of the protein with three- and one-letter codes, use","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> seq = getseq(\"file.pdb\")\n76-element Vector{String}:\n \"V\"\n \"K\"\n ⋮ \n \"R\"\n \"G\"\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Use getseq(atoms,code=2) to get the sequence as three-letter residue codes, or code=3 to get full natural-aminoacid names, like \"Alanine\", \"Proline\", etc.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"note: Note\nIf there is some non-standard protein residue in the sequence, inform the getseq function by adding a selection:julia> getseq(\"file.pdb\",\"protein or resname NEW\")\n77-element Vector{String}:\n \"V\"\n \"N\"\n ⋮ \n \"R\"\n \"G\"By default the selection will only return the sequence of natural amino acids. ","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The getseq function can of course be used on an Atom list, accepts selections as the last argument, as well as the reading and writing functions:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"atoms = readPDB(\"file.pdb\")\nseq = getseq(atoms,\"chain A\")\n","category":"page"},{"location":"auxiliary/#Distance-between-sets-of-atoms","page":"Auxiliary functions","title":"Distance between sets of atoms","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The distance between atoms, or sets of atoms, can be computed with the distance function. This function returns the minimum distance between the atoms of the sets involved. For example:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> distance(protein,ligand)\n2.7775834820937417\n ","category":"page"},{"location":"auxiliary/#Closest-atoms-and-their-distance","page":"Auxiliary functions","title":"Closest atoms and their distance","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"A function similar to the one above is closest, which returns the shortest distance between atoms but also the identity of the atom or pair of atoms that satisfy that shortest distance:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> closest(ligand,protein)\n(43, 3684, 2.7775834820937417)\n\njulia> ligand[43]\n 4037 O1 T3 B 2 512 -22.568 81.625 3.159 36.59 1.00 1 - 4041\n\njulia> protein[3684]\n 3684 NE2 HIS B 435 472 -21.539 82.145 5.686 44.44 1.00 1 - 3686\n\njulia> distance(ligand[43],protein[3684])\n2.7775834820937417\n ","category":"page"},{"location":"auxiliary/#Obtain-arrays-with-coordinates","page":"Auxiliary functions","title":"Obtain arrays with coordinates","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"All atoms:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> x = coor(atoms)\n1463-element Vector{SVector{3, Float64}}:\n [-9.229, -14.861, -5.481]\n [-10.048, -15.427, -5.569]\n [-9.488, -13.913, -5.295]\n ⋮\n [5.772, -10.399, -8.044]\n [6.408, -12.034, -8.343]\n [6.017, -10.967, -9.713]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Or use selections to retrieve the coordinates of subsets of atoms:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Calpha coordinates:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> xCA = coor(protein,\"name CA\")\n104-element Vector{SVector{3, Float64}}:\n [-8.483, -14.912, -6.726]\n [-5.113, -13.737, -5.466]\n [-3.903, -11.262, -8.062]\n ⋮\n 7.836, -2.933, -6.873]\n [4.414, -4.302, -7.734]\n [4.134, -7.811, -6.344]\n [3.244, -10.715, -8.603]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The coordinates are output as arrays of static arrays (more specifically, as a Vector{SVector{3,Float64}}, from StaticArrays). ","category":"page"},{"location":"auxiliary/#Maximum-and-minimum-coordinates-of-the-atoms","page":"Auxiliary functions","title":"Maximum and minimum coordinates of the atoms","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Use maxmin(atoms), or maxmin(atoms,\"resname CA\"), for example:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> m = maxmin(atoms,\"chain A\")\n\n Minimum atom coordinates: xmin = [-41.5, -41.526, -41.517]\n Maximum atom coordinates: xmax = [41.583, 41.502, 41.183]\n Length in each direction: xlength = [83.083, 83.028, 82.7]\n","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"m is a structure containing the three vectors with minimum and maximum coordinates, and lengths.","category":"page"},{"location":"auxiliary/#Residue-tick-labels-for-plots","page":"Auxiliary functions","title":"Residue tick labels for plots","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"compat: Compat\nThe residue_ticks function requires at least PDBTools version 0.14.1.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The residue_ticks function provides a practical way to define tick labels in plots associated to an amino-acid sequence:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"residue_ticks(\n atoms::AbstractVector{<:Atom}; \n first=nothing, last=nothing, stride=1, oneletter=true\n)","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"The function returns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"first and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"If oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX. ","category":"page"},{"location":"auxiliary/#Example","page":"Auxiliary functions","title":"Example","text":"","category":"section"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Here we illustrate how to plot the average temperature factor of each residue of a crystallographic model as function of the residues.","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"julia> using PDBTools, Plots\n\njulia> atoms = wget(\"1UBQ\", \"protein\");\n\njulia> residue_ticks(atoms; stride=10) # example of output\n([1, 11, 21, 31, 41, 51, 61, 71], [\"M1\", \"K11\", \"D21\", \"Q31\", \"Q41\", \"E51\", \"I61\", \"L71\"])\n\njulia> plot(\n resnum.(eachresidue(atoms)), # x-axis: residue numbers\n [ mean(beta.(res)) for res in eachresidue(atoms) ], # y-axis: average b-factor per residue\n xlabel=\"Residue\", \n xticks=residue_ticks(atoms; stride=10), # here we define the x-tick labels\n ylabel=\"b-factor\", \n xrotation=60,\n label=nothing, framestyle=:box,\n )","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"Produces the following plot:","category":"page"},{"location":"auxiliary/","page":"Auxiliary functions","title":"Auxiliary functions","text":"(Image: ./assets/residue_ticks.png)","category":"page"},{"location":"elements/#Atomic-and-molecular-properties","page":"Element properties","title":"Atomic and molecular properties","text":"","category":"section"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"Some simple atom properties can be retrieved using special functions, which operate on atoms of the type Atom. For example:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"julia> atoms = readPDB(\"./file.pdb\");\n\njulia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 OW SOL X 1 1 54.370 45.310 33.970 0.00 0.00 1 - 1\n\njulia> mass(atoms[1])\n14.0067\n\njulia> atomic_number(atoms[1])\n7\n\njulia> element(atoms[1])\n\"N\"\n\njulia> element_name(atoms[1])\n\"Nitrogen\"","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"The formula or stoichiometry of a selection can also be retrieved:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"julia> atoms = wget(\"1LBD\",\"protein and residue 1\");\n\njulia> f = formula(atoms)\nC₃N₁O₂\n\njulia> stoichiometry(select(atoms,\"water\"))\nH₂O₁\n","category":"page"},{"location":"elements/#AtomsBase-compatibility","page":"Element properties","title":"AtomsBase compatibility","text":"","category":"section"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"compat: Compat\nThis interface requires at least PDBTools version 0.14.2.","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"The following functions are supported as part of the API, to conform the AtomsBase interface:","category":"page"},{"location":"elements/","page":"Element properties","title":"Element properties","text":"Function Example Output\natomic_number(::PDBTools.Atom) atomic_number(Atom(name=\"NE2\")) 7\natomic_symbol(::PDBTools.Atom) atomic_symbol(Atom(name=\"NE2\")) :N\natomic_mass(::PDBTools.Atom) atomic_mass(Atom(name=\"NE2\")) 14.0067\nposition(::PDBTools.Atom) position(Atom(name=\"NE2\")) SVector{3,Float64}(0,0,0)","category":"page"},{"location":"help/#Help-entries","page":"Help entries","title":"Help entries","text":"","category":"section"},{"location":"help/","page":"Help entries","title":"Help entries","text":"These entries can be accessed from the Julia REPL by typing ?, for example,","category":"page"},{"location":"help/","page":"Help entries","title":"Help entries","text":"julia> ? mass\nsearch: mass mapslices MathConstants makedocs set_zero_subnormals get_zero_subnormals mutable struct\n\n mass(name::String or atom::Atom or Vector{Atom})\n\n Returns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms.\n\n Example\n –––––––––\n\n julia> atoms = [ Atom(name=\"NT3\"), Atom(name=\"CA\") ];\n \n julia> mass(atoms[1])\n 14.0067\n \n julia> mass(\"CA\")\n 12.011\n \n julia> mass(atoms)\n 26.017699999999998\n","category":"page"},{"location":"help/","page":"Help entries","title":"Help entries","text":"Modules=[PDBTools]","category":"page"},{"location":"help/#PDBTools.Atom","page":"Help entries","title":"PDBTools.Atom","text":"Atom::DataType\n\nStructure that contains the atom properties. It is mutable, so it can be edited. Fields:\n\nmutable struct Atom\n index::Int # The sequential index of the atoms in the file\n index_pdb::Int # The index as written in the PDB file (might be anything)\n name::String # Atom name\n resname::String # Residue name\n chain::String # Chain identifier\n resnum::Int # Number of residue as written in PDB file\n residue::Int # Sequential residue (molecule) number in file\n x::Float64 # x coordinate\n y::Float64 # y coordinate\n z::Float64 # z coordinate\n beta::Float64 # temperature factor\n occup::Float64 # occupancy\n model::Int # model number\n segname::String # Segment name (cols 73:76)\n element::String # Element symbol string (cols 77:78)\n charge::String # Charge (cols: 79:80)\nend\n\nExample\n\njulia> pdb = wget(\"1LBD\");\n\njulia> printatom(pdb[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA P 1 1 2.062 -13.995 21.747 0.00 1.00 1 PROT 1\n\njulia> pdb[1].resname\n\"ALA\"\n\njulia> pdb[1].chain\n\"P\"\n\njulia> element(pdb[1])\n\"N\"\n\njulia> mass(pdb[1])\n14.0067\n\nThe element and charge fields, which are frequently left empty in PDB files, are not printed. They can be retrieved with the pdb_element and pdb_charge getter functions. \n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Formula","page":"Help entries","title":"PDBTools.Formula","text":"Formula::DataType\n\nFormula data type. Contains the number of atoms of each type in a vector of tuples.\n\nExample\n\njulia> atoms = wget(\"1LBD\",\"protein and residue 1\");\n\njulia> f = formula(atoms)\nC₃N₁O₂\n\n\njulia> f[1]\n(\"C\", 3)\n\njulia> f[2]\n(\"N\", 1)\n\njulia> f[3]\n(\"O\", 2)\n\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.FunctionalKeyword","page":"Help entries","title":"PDBTools.FunctionalKeyword","text":"FunctionalKeyword{T}\n\nThis is a structure that will store a keyword that depends on an external function requiring an operator and an argument. \n\nExample:\n\nelement_keyword = FunctionalKeyword(String, \n \"element\",\n element,\n (\"=\",isequal))\n\n\nwill define a keyword \"element\" to be used as element C, which will return true if there is an element function such that element(atom) == C.\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Residue","page":"Help entries","title":"PDBTools.Residue","text":"Residue(atoms::AbstractVector{Atom}, range::UnitRange{Int})\n\nResidue data structure. It contains two fields: atoms which is a vector of Atom elements, and range, which indicates which atoms of the atoms vector compose the residue.\n\nThe Residue structure carries the properties of the residue or molecule of the atoms it contains, but it does not copy the original vector of atoms, only the residue meta data for each residue.\n\nExample\n\njulia> pdb = wget(\"1LBD\");\n\njulia> residues = collect(eachresidue(pdb))\n Array{Residue,1} with 238 residues.\n\njulia> resnum.(residues[1:3])\n3-element Vector{Int64}:\n 225\n 226\n 227\n\njulia> residues[5].chain\n\"A\"\n\njulia> residues[8].range\n52:58\n\n\n\n\n\n\n","category":"type"},{"location":"help/#PDBTools.Sequence","page":"Help entries","title":"PDBTools.Sequence","text":"Sequence\n\nWrapper for strings, or vectors of chars, strings, or residue names, to dispatch on functions that operate on amino acid sequences.\n\nExample\n\njulia> seq = [\"Alanine\", \"Glutamic acid\", \"Glycine\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = \"AEG\";\n\njulia> mass(Sequence(seq))\n257.2432\n\n\n\n\n\n","category":"type"},{"location":"help/#AtomsBase.atomic_number-Tuple{Atom}","page":"Help entries","title":"AtomsBase.atomic_number","text":"atomic_number(name::String or atom::Atom)\n\nReturns the atomic number of an atom given its name, or Atom structure.\n\nExample\n\njulia> at = Atom(name=\"NT3\");\n\njulia> atomic_number(at)\n7\n\njulia> atomic_number(\"CA\")\n6\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.closest-Union{Tuple{T2}, Tuple{T1}, Tuple{AbstractVector{T1}, AbstractVector{T2}}} where {T1, T2<:Union{Atom, StaticArraysCore.SVector}}","page":"Help entries","title":"PDBTools.closest","text":"closest(x,y)\n\nComputes the minimum distance between two sets of atoms and returns the indexes of the atoms and their distance. Both vector of atoms or vectors of coordinates can be used as input.\n\nExamples\n\njulia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> closest(ligand,protein)\n(43, 3684, 2.7775834820937417)\n\njulia> ligand[43]\n 4037 O1 T3 B 2 512 -22.568 81.625 3.159 36.59 1.00 1 - 4041\n\njulia> closest(ligand[43],protein)\n(1, 3684, 2.7775834820937417)\n\njulia> x = coor(protein)\n3994-element Vector{SVector{3, Float64}}:\n [52.884, 24.022, 35.587]\n [52.916, 24.598, 36.993]\n ⋮\n [-46.887, 86.925, 13.235]\n [-47.164, 83.593, 15.25]\n\njulia> closest(ligand,x)\n(43, 3684, 2.7775834820937417)\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.coor-Tuple{Atom}","page":"Help entries","title":"PDBTools.coor","text":"coor(atoms; selection)\n\nReturns the coordinates of the atoms. The input may be one atom (type Atom), a vector of atoms, or a Residue. The coordinates are returned as a vector of static vectors (from StaticArrays), more specifically as a Vector{SVector{3,Float64}}.\n\nExamples\n\njulia> using PDBTools, StaticArrays \n\njulia> protein = wget(\"1LBD\");\n\njulia> coor(protein[1])\n3-element SVector{3, Float64} with indices SOneTo(3):\n 45.228\n 84.358\n 70.638\n\njulia> coor(protein[1],as=SVector{3,Float32})\n3-element SVector{3, Float32} with indices SOneTo(3):\n 45.228\n 84.358\n 70.638\n\njulia> coor(protein, \"index <= 2\")\n2-element Vector{SVector{3, Float64}}:\n [45.228, 84.358, 70.638]\n [46.08, 83.165, 70.327]\n\njulia> coor(protein, only = at -> at.resname == \"ALA\")\n110-element Vector{SVector{3, Float64}}:\n [43.94, 81.982, 70.474]\n [43.02, 80.825, 70.455]\n [41.996, 80.878, 69.34]\n ⋮\n [-17.866, 84.088, 51.741]\n [-18.496, 83.942, 52.777]\n [-15.888, 82.583, 51.706]\n \njulia> residues = collect(eachresidue(protein));\n\njulia> coor(residues[1])\n6-element Vector{SVector{3, Float64}}:\n [45.228, 84.358, 70.638]\n [46.08, 83.165, 70.327]\n [45.257, 81.872, 70.236]\n [45.823, 80.796, 69.974]\n [47.147, 82.98, 71.413]\n [46.541, 82.639, 72.662]\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.distance-Tuple{StaticArraysCore.SVector, StaticArraysCore.SVector}","page":"Help entries","title":"PDBTools.distance","text":"distance(x,y)\n\nComputes the minimum distance between two sets of atoms, between an atom and a set of atoms, or simply the distance between two atoms. The input may be a vector of Atoms, or the coordinates that are output of the coor function. \n\nExamples\n\njulia> model = wget(\"1BSX\");\n\njulia> protein = select(model,\"protein\");\n\njulia> ligand = select(model,\"resname T3\");\n\njulia> distance(protein,ligand)\n2.7775834820937417\n\njulia> distance(protein[1],ligand[3])\n36.453551075306784\n\njulia> distance(coor(ligand),protein)\n2.7775834820937417\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.eachresidue-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.eachresidue","text":"eachresidue(atoms::AbstractVector{Atom})\n\nIterator for the residues (or molecules) of a selection. \n\nExample\n\njulia> atoms = wget(\"1LBD\");\n\njulia> length(eachresidue(atoms))\n238\n\njulia> for res in eachresidue(atoms)\n println(res)\n end\n Residue of name SER with 6 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n\n Residue of name ALA with 5 atoms.\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 7 N ALA A 226 2 43.940 81.982 70.474 67.09 1.00 1 - 7\n 8 CA ALA A 226 2 43.020 80.825 70.455 63.69 1.00 1 - 8\n 9 C ALA A 226 2 41.996 80.878 69.340 59.69 1.00 1 - 9\n ...\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.edit!-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.edit!","text":"edit!(atoms::Vector{Atom})\n\nOpens a temporary PDB file in which the fields of the vector of atoms can be edited. \n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.element-Tuple{Atom}","page":"Help entries","title":"PDBTools.element","text":"element_name(name::String or atom::Atom)\n\nReturns the element name of an atom given its name, or Atom structure.\n\nExample\n\njulia> at = Atom(name=\"NT3\");\n\njulia> element_name(at)\n\"Nitrogen\"\n\njulia> element_name(\"NT3\")\n\"Nitrogen\"\n\njulia> element_name(\"CA\")\n\"Carbon\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.formula-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.formula","text":"formula(atoms::AbstractVector{Atom})\n\nReturns the molecular formula of the current selection. \n\nExample\n\njulia> first_residue = wget(\"1LBD\",\"protein and residue 1\")\n Array{Atoms,1} with 6 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n 4 O SER A 225 1 45.823 80.796 69.974 64.85 1.00 1 - 4\n 5 CB SER A 225 1 47.147 82.980 71.413 70.79 1.00 1 - 5\n 6 OG SER A 225 1 46.541 82.639 72.662 73.55 1.00 1 - 6\n\n\njulia> formula(first_residue)\nC₃N₁O₂\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.getseq-Tuple{AbstractVector{Atom}, String}","page":"Help entries","title":"PDBTools.getseq","text":"getseq(Vector{Atom} or filename; selection, code)\n\nReturns the sequence of aminoacids from the vector of atoms or file name. Selections may be applied. Code defines if the output will be a one-letter, three-letter or full-residue name array.\n\nExample\n\njulia> protein = wget(\"1LBD\");\n\njulia> getseq(protein,\"residue < 3\")\n2-element Vector{String}:\n \"S\"\n \"A\"\n\njulia> getseq(protein,\"residue < 3\", code=2)\n2-element Vector{String}:\n \"SER\"\n \"ALA\"\n\njulia> getseq(protein,\"residue < 3\",code=3)\n2-element Vector{String}:\n \"Serine\"\n \"Alanine\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.has_key-Tuple{String, AbstractVector{<:AbstractString}}","page":"Help entries","title":"PDBTools.has_key","text":"has_key(key::String, s::AbstractVector{<:AbstractString})\n\nReturns the first index of the vector s in which where key is found, or 0. \n\nExample:\n\n\njulia> PDBTools.has_key(\"or\",[\"name\",\"CA\",\"or\",\"index\",\"1\"])\n3\n\njulia> PDBTools.has_key(\"and\",[\"name\",\"CA\",\"or\",\"index\",\"1\"])\n0\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.mass-Tuple{Atom}","page":"Help entries","title":"PDBTools.mass","text":"mass(name::String or atom::Atom or Vector{Atom})\n\nReturns the mass of an atom given its name, or Atom structure, or the total mass of a vector of Atoms. \n\nExample\n\njulia> atoms = [ Atom(name=\"NT3\"), Atom(name=\"CA\") ];\n\njulia> mass(atoms[1])\n14.0067\n\njulia> mass(\"CA\")\n12.011\n\njulia> mass(atoms)\n26.017699999999998\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.mass-Tuple{Sequence}","page":"Help entries","title":"PDBTools.mass","text":"mass(s::Sequence)\n\nReturns the mass of a sequence of amino acids, given a Sequence struct type.\n\nExamples\n\njulia> seq = [\"Alanine\", \"Glutamic acid\", \"Glycine\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = \"AEG\";\n\njulia> mass(Sequence(seq))\n257.2432\n\njulia> seq = [\"ALA\", \"GLU\", \"GLY\"];\n\njulia> mass(Sequence(seq))\n257.2432\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.maxmin-Tuple{AbstractVector{Atom}, String}","page":"Help entries","title":"PDBTools.maxmin","text":"maxmin(atoms::Vector{Atom}; selection)\n\nReturns the maximum and minimum coordinates of an atom vector, and the length (maximum minus minimum) in each direction. \n\nExample\n\njulia> protein = wget(\"1LBD\");\n\njulia> maxmin(protein)\n \n Minimum atom coordinates: xmin = [-29.301, 57.178, 45.668]\n Maximum atom coordinates: xmax = [47.147, 99.383, 86.886]\n Length in each direction: xlength = [76.448, 42.205, 41.217999999999996]\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.oneletter-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.oneletter","text":"oneletter(residue::Union{String,Char})\n\nFunction to return a one-letter residue code from the three letter code or residue name. The function is case-insensitive.\n\nExamples\n\njulia> oneletter(\"ALA\")\n\"A\"\n\njulia> oneletter(\"Glutamic acid\")\n\"E\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_query-Tuple{String}","page":"Help entries","title":"PDBTools.parse_query","text":"parse_query(selection:String)\n\nCalls parse_query_vector after splitting the selection string.\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_query_vector-Tuple{Any}","page":"Help entries","title":"PDBTools.parse_query_vector","text":"parse_query_vector(s::AbstractVector{<:AbstractString})\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.parse_to_type-Tuple{Union{PDBTools.Keyword, PDBTools.FunctionalKeyword}, Any}","page":"Help entries","title":"PDBTools.parse_to_type","text":"parse_to_type(key::Keyword, val::String)\n\nTries to parse val into the type of value expected by key.ValueType. \n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.readPDB-Tuple{String, String}","page":"Help entries","title":"PDBTools.readPDB","text":"readPDB(pdbfile::String, selection::String)\nreadPDB(pdbfile::String; only::Function = all)\n\nReads a PDB file and stores the data in a vector of type Atom. \n\nIf a selection is provided, only the atoms matching the selection will be read. For example, resname ALA will select all the atoms in the residue ALA.\n\nIf the only function keyword is provided, only the atoms for which only(atom) is true will be read.\n\nExamples\n\njulia> protein = readPDB(\"../test/structure.pdb\")\n Array{Atoms,1} with 62026 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n ⋮ \n 62025 H1 TIP3 C 9339 19638 13.218 -3.647 -34.453 0.00 1.00 1 WAT2 62025\n 62026 H2 TIP3 C 9339 19638 12.618 -4.977 -34.303 0.00 1.00 1 WAT2 62026\n\njulia> ALA = readPDB(\"../test/structure.pdb\",\"resname ALA\")\n Array{Atoms,1} with 72 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n ⋮ \n 1339 C ALA A 95 95 14.815 -3.057 -5.633 0.00 1.00 1 PROT 1339\n 1340 O ALA A 95 95 14.862 -2.204 -6.518 0.00 1.00 1 PROT 1340\n\njulia> ALA = readPDB(\"../test/structure.pdb\", only = atom -> atom.resname == \"ALA\")\n Array{Atoms,1} with 72 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n ⋮ \n 1339 C ALA A 95 95 14.815 -3.057 -5.633 0.00 1.00 1 PROT 1339\n 1340 O ALA A 95 95 14.862 -2.204 -6.518 0.00 1.00 1 PROT 1340\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.residue_ticks-Tuple{AbstractVector{<:Atom}}","page":"Help entries","title":"PDBTools.residue_ticks","text":"residue_ticks(atoms::AbstractVector{<:Atom}; first=nothing, last=nothing, stride=1, oneletter=true)\n\nReturns a tuple with residue numbers and residue names for the given atoms, to be used as tick labels in plots.\n\nfirst and last optional keyword parameters are integers that refer to the residue numbers to be included. The stride option can be used to skip residues and declutter the tick labels.\n\nIf oneletter is false, three-letter residue codes are returned. Residues with unknown names will be named X or XXX. \n\nExamples\n\njulia> using PDBTools\n\njulia> atoms = wget(\"1UBQ\", \"protein\");\n\njulia> residue_ticks(atoms; stride=10)\n([1, 11, 21, 31, 41, 51, 61, 71], [\"M1\", \"K11\", \"D21\", \"Q31\", \"Q41\", \"E51\", \"I61\", \"L71\"])\n\nThe resulting tuple of residue numbers and labels can be used as xticks in Plots.plot, for example.\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.residuename-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.residuename","text":"residuename(residue::Union{String,Char})\n\nFunction to return the long residue name from other residue codes. The function is case-insensitive.\n\nExamples\n\njulia> residuename(\"A\")\n\"Alanine\"\n\njulia> residuename(\"Glu\")\n\"Glutamic Acid\"\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.resname-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.resname","text":"resname(residue::Union{String,Char})\n\nReturns the residue name, given the one-letter code or residue name. Differently from threeletter, this function will return the force-field name if available in the list of protein residues.\n\nExamples\n\njulia> resname(\"ALA\")\n\"ALA\"\n\njulia> resname(\"GLUP\")\n\"GLUP\"\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.stoichiometry-Tuple{AbstractVector{Atom}}","page":"Help entries","title":"PDBTools.stoichiometry","text":"stoichiometry(atoms::AbstractVector{Atom})\n\nReturns the stoichiometry of atom selection in a Formula structure. \n\nExample\n\njulia> stoichiometry(select(atoms,\"water\"))\nH₂O₁\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.threeletter-Tuple{Union{Char, String}}","page":"Help entries","title":"PDBTools.threeletter","text":"threeletter(residue::String)\n\nFunction to return the three-letter natural-amino acid residue code from the one-letter code or residue name. The function is case-insensitive.\n\nExamples\n\njulia> threeletter(\"A\")\n\"ALA\"\n\njulia> threeletter(\"Aspartic acid\")\n\"ASP\"\n\njulia> threeletter(\"HSD\")\n\"HIS\"\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.wget-Tuple{String, String}","page":"Help entries","title":"PDBTools.wget","text":"wget(PDBid; selection)\n\nRetrieves a PDB file from the protein data bank. Selections may be applied.\n\nExample\n\njulia> protein = wget(\"1LBD\",\"chain A\")\n Array{Atoms,1} with 1870 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3\n ⋮ \n 1868 OG1 THR A 462 238 -27.462 74.325 48.885 79.98 1.00 1 - 1868\n 1869 CG2 THR A 462 238 -27.063 71.965 49.222 78.62 1.00 1 - 1869\n 1870 OXT THR A 462 238 -25.379 71.816 51.613 84.35 1.00 1 - 1870\n\n\n\n\n\n\n","category":"method"},{"location":"help/#PDBTools.writePDB-Tuple{AbstractVector{Atom}, Any, Any}","page":"Help entries","title":"PDBTools.writePDB","text":"writePDB(atoms::Vector{Atom}, filename, selection; header=:auto, footer=:auto)\n\nWrite a PDB file with the atoms in atoms to filename. The selection argument is a string that can be used to select a subset of the atoms in atoms. For example, writePDB(atoms, \"test.pdb\", \"name CA\").\n\nThe header and footer arguments can be used to add a header and footer to the PDB file. If header is :auto, then a header will be added with the number of atoms in atoms. If footer is :auto, then a footer will be added with the \"END\" keyword. Either can be set to nothing if no header or footer is desired.\n\n\n\n\n\n","category":"method"},{"location":"installation/#Installation","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"installation/","page":"Installation","title":"Installation","text":"Install the package using the package manager:","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"julia> ] add PDBTools\n","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"and load it with","category":"page"},{"location":"installation/","page":"Installation","title":"Installation","text":"julia> using PDBTools\n","category":"page"},{"location":"readwrite/#Read-and-write-files","page":"Read and Write","title":"Read and write files","text":"","category":"section"},{"location":"readwrite/#Read-a-PDB-file","page":"Read and Write","title":"Read a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"To read a PDB file and return a vector of atoms of type Atom, do:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"atoms = readPDB(\"file.pdb\")\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Atom is the structure of data containing the atom index, name, residue, coordinates, etc. For example, after reading a file (as shown bellow), a list of atoms with the following structure will be generated:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"The data in the Atom structure is organized as follows:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"struct Atom\n index :: Int64 # The sequential index of the atoms in the file\n index_pdb :: Int64 # The index as written in the PDB file (might be anything)\n name :: String\n resname :: String\n chain :: String\n resnum :: Int64 # Number of residue as written in PDB file\n residue :: Int64 # Sequential residue (molecule) number in file\n x :: Float64\n y :: Float64\n z :: Float64\n beta :: Float64\n occup :: Float64\n model :: Int64\n segname :: String # Segment name (cols 73:76)\nend","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"tip: Tip\nFor all these reading and writting functions, a final argument can be provided to read or write a subset of the atoms, following the selection syntax described in the Selection section. For example:protein = readPDB(\"file.pdb\",\"protein\")\norarginines = readPDB(\"file.pdb\",\"resname ARG\")\nThe only difference is that, if using Julia anonymous functions, the keyword is only:arginines = readPDB(\"file.pdb\",only = atom -> atom.resname == \"ARG\")\nThe same is valid for the write function, below. ","category":"page"},{"location":"readwrite/#Retrive-from-Protein-Data-Bank","page":"Read and Write","title":"Retrive from Protein Data Bank","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Use the wget function to retrieve the atom data directly from the PDB database, optionally filtering the atoms with a selection:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> atoms = wget(\"1LBD\",\"name CA\")\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2\n 8 CA ALA A 226 2 43.020 80.825 70.455 63.69 1.00 1 - 8\n 13 CA ASN A 227 3 41.052 82.178 67.504 53.45 1.00 1 - 13\n ⋮\n 1847 CA GLN A 460 236 -22.650 79.082 50.023 71.46 1.00 1 - 1847\n 1856 CA MET A 461 237 -25.561 77.191 51.710 78.41 1.00 1 - 1856\n 1864 CA THR A 462 238 -26.915 73.645 51.198 82.96 1.00 1 - 1864\n","category":"page"},{"location":"readwrite/#Edit-a-PDB-file","page":"Read and Write","title":"Edit a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"The Atom structure is mutable, meaning that the fields can be edited. For example:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> atoms = readPDB(\"file.pdb\")\n Array{PDBTools.Atom,1} with 62026 atoms with fields:\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n 2 HT1 ALA A 1 1 -10.048 -15.427 -5.569 0.00 0.00 1 PROT 2\n 3 HT2 ALA A 1 1 -9.488 -13.913 -5.295 0.00 0.00 1 PROT 3\n\njulia> atoms[1].segname = \"ABCD\"\n\"ABCD\"\n\njulia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 ABCD 1\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"Additionally, With the edit! function, you can directly edit or view the data in a vector of Atoms in your preferred text editor. ","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> edit!(atoms)\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"This will open a text editor. Here, we modified the data in the resname field of the first atom to ABC. Saving and closing the file will update the atoms array:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 N ABC A 1 1 -9.229 -14.861 -5.481 0.00 1.00 1 PROT 1\n","category":"page"},{"location":"readwrite/#Write-a-PDB-file","page":"Read and Write","title":"Write a PDB file","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"To write a PDB file use the writePDB function, as:","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"writePDB(atoms,\"file.pdb\")\n","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"where atoms contain a list of atoms with the Atom structures.","category":"page"},{"location":"readwrite/#Read-and-write-single-atom-lines","page":"Read and Write","title":"Read and write single-atom lines","text":"","category":"section"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"PDBTools.read_atom(pdb_line): Given a line of a PDB file containing atom data, returns the data in a Atom structure. ","category":"page"},{"location":"readwrite/","page":"Read and Write","title":"Read and Write","text":"PDBTools.write_atom(atom::Atom): Given an atom in the Atom structure, returns a string formatted in the PDB format, to be written to a file. ","category":"page"},{"location":"#PDBTools","page":"Home","title":"PDBTools","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"PDBTools is a simple package to read and write Protein Data Bank files, select atoms, and work with their coordinates. ","category":"page"},{"location":"#Features:","page":"Home","title":"Features:","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Simple data structure: ","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> printatom(atoms[1])\n index name resname chain resnum residue x y z beta occup model segname index_pdb\n 1 OW SOL X 1 1 54.370 45.310 33.970 0.00 0.00 1 - 1","category":"page"},{"location":"","page":"Home","title":"Home","text":"Selection syntax:","category":"page"},{"location":"","page":"Home","title":"Home","text":"resname ARG and name CA","category":"page"},{"location":"","page":"Home","title":"Home","text":"Allows use of Julia (possibly user-defined) functions for selection:","category":"page"},{"location":"","page":"Home","title":"Home","text":"atom -> ( atom.resname == \"ARG\" && atom.x < 10 ) || atom.name == \"N\"","category":"page"},{"location":"#Not-indicated-for:","page":"Home","title":"Not indicated for:","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"We do not aim to provide the fastest PDB parsing methods. If speed in reading files, returning subsets of the structures, etc., is critical to you, probably you will do better with some packages of BioJulia, BioStructures in particular.","category":"page"}] } diff --git a/dev/selections/index.html b/dev/selections/index.html index a1f4210..f2036b3 100644 --- a/dev/selections/index.html +++ b/dev/selections/index.html @@ -49,4 +49,4 @@ 1452.8601999999983

      Which, in this simple example, results in the same as:

      julia> sum( mass(atom) for atom in protein if atom.resname == "ALA" )
       1452.8601999999983
      -
      +