BioStructures API
Package extensions are used in order to reduce the number of dependencies:
- To use
LongAA, callusing BioSequences. - To use
pairalign,superimpose!,rmsd/displacementswith thesuperimposeoption orTransformationon structural elements, callusing BioAlignments. - To use
DataFrame, callusing DataFrames. - To use
MetaGraph, callusing MetaGraphs. - To use
MMTFDictorwritemmtf, callimport MMTF. - To use
rundssp!,rundsspor therun_dsspoption withread/retrievepdb, callusing DSSP_jll. - To use
runstride!,runstrideor therun_strideoption withread/retrievepdb, callusing STRIDE_jll.
Exported names
BioStructures.BioStructuresBioStructures.AbstractAtomBioStructures.AbstractResidueBioStructures.AtomBioStructures.AtomRecordBioStructures.ChainBioStructures.ContactMapBioStructures.DisorderedAtomBioStructures.DisorderedResidueBioStructures.DistanceMapBioStructures.MMCIFDictBioStructures.MMCIFFormatBioStructures.MMTFDictBioStructures.MMTFFormatBioStructures.ModelBioStructures.MolecularStructureBioStructures.PDBConsistencyErrorBioStructures.PDBFormatBioStructures.PDBParseErrorBioStructures.PDBXMLFormatBioStructures.ResidueBioStructures.SpatialMapBioStructures.StructuralElementBioStructures.StructuralElementOrListBioStructures.TransformationBioStructures.backboneatomnamesBioStructures.calphaatomnamesBioStructures.cbetaatomnamesBioStructures.coilsscodesBioStructures.helixsscodesBioStructures.pdbextensionBioStructures.proteinresnamesBioStructures.sheetsscodesBioStructures.threeletter_to_aaBioStructures.waterresnamesBase.collectBase.readBioGenerics.distanceBioStructures.acidicresselectorBioStructures.aliphaticresselectorBioStructures.allselectorBioStructures.altlocidBioStructures.altlocidsBioStructures.applyselectorsBioStructures.applyselectors!BioStructures.applytransformBioStructures.applytransform!BioStructures.aromaticresselectorBioStructures.atomidBioStructures.atomnameBioStructures.atomnamesBioStructures.atomnameselectorBioStructures.atomsBioStructures.backboneselectorBioStructures.basicresselectorBioStructures.bondangleBioStructures.calphaselectorBioStructures.cbetaselectorBioStructures.chainBioStructures.chainidBioStructures.chainid!BioStructures.chainidsBioStructures.chainsBioStructures.chargeBioStructures.chargedresselectorBioStructures.chiangleBioStructures.chianglesBioStructures.chianglesBioStructures.choosedefaultaltlocidBioStructures.coilselectorBioStructures.collectatomsBioStructures.collectchainsBioStructures.collectmodelsBioStructures.collectresiduesBioStructures.coordarrayBioStructures.coordsBioStructures.coords!BioStructures.countatomsBioStructures.countchainsBioStructures.countmodelsBioStructures.countresiduesBioStructures.defaultaltlocidBioStructures.defaultatomBioStructures.defaultmodelBioStructures.defaultresidueBioStructures.defaultresnameBioStructures.dihedralangleBioStructures.disorderedresBioStructures.disorderselectorBioStructures.displacementsBioStructures.downloadallobsoletepdbBioStructures.downloadentirepdbBioStructures.downloadpdbBioStructures.elementBioStructures.generatechainidBioStructures.heavyatomselectorBioStructures.helixselectorBioStructures.heteroselectorBioStructures.hydrogenselectorBioStructures.hydrophobicresselectorBioStructures.inscodeBioStructures.isdisorderedatomBioStructures.isdisorderedresBioStructures.isheteroBioStructures.modelBioStructures.modelnumberBioStructures.modelnumbersBioStructures.modelsBioStructures.neutralresselectorBioStructures.nonpolarresselectorBioStructures.notwaterselectorBioStructures.occupancyBioStructures.omegaangleBioStructures.omegaanglesBioStructures.pdbentrylistBioStructures.pdblineBioStructures.pdbobsoletelistBioStructures.pdbrecentchangesBioStructures.pdbstatuslistBioStructures.phiangleBioStructures.phianglesBioStructures.polarresselectorBioStructures.proteinselectorBioStructures.psiangleBioStructures.psianglesBioStructures.ramachandrananglesBioStructures.readmultimmcifBioStructures.residBioStructures.residsBioStructures.residueBioStructures.residuesBioStructures.resnameBioStructures.resnamesBioStructures.resnameselectorBioStructures.resnumberBioStructures.retrievepdbBioStructures.rmsdBioStructures.rundsspBioStructures.rundssp!BioStructures.runstrideBioStructures.runstride!BioStructures.sequentialresiduesBioStructures.serialBioStructures.sheetselectorBioStructures.showcontactmapBioStructures.sidechainselectorBioStructures.spaceatomnameBioStructures.specializeresnames!BioStructures.sqdistanceBioStructures.sscodeBioStructures.sscode!BioStructures.sscodeselectorBioStructures.standardselectorBioStructures.structureBioStructures.structurenameBioStructures.superimpose!BioStructures.tempfactorBioStructures.updatelocalpdbBioStructures.waterselectorBioStructures.writemmcifBioStructures.writemmtfBioStructures.writemultimmcifBioStructures.writepdbBioStructures.xBioStructures.x!BioStructures.yBioStructures.y!BioStructures.zBioStructures.z!BioStructures.@sel_str
Non-exported names
Docstrings
BioStructures.BioStructures — Module
Read, write and manipulate macromolecular structures.
BioStructures.AbstractAtom — Type
An atom that is part of a macromolecule - either an Atom or a DisorderedAtom.
BioStructures.AbstractResidue — Type
A residue (amino acid) or other molecule - either a Residue or a DisorderedResidue.
BioStructures.Atom — Type
An atom that is part of a macromolecule.
BioStructures.AtomRecord — Type
A record for a single atom, e.g. as represented in a Protein Data Bank (PDB) file.
BioStructures.Chain — Type
A chain (molecule) from a macromolecular structure.
BioStructures.ContactMap — Type
ContactMap(element, contact_distance)
ContactMap(element_one, element_two, contact_distance)
ContactMap(bit_array_2D)Calculate the contact map for a StructuralElementOrList, or between two StructuralElementOrLists.
This returns a ContactMap type containing a BitArray{2} with true where the sub-elements are no further than the contact distance and false otherwise. When one element is given as input this returns a symmetric square matrix. To directly access the underlying data of ContactMap cm, use cm.data.
Examples
cbetas_A = collectatoms(struc["A"], cbetaselector)
cbetas_B = collectatoms(struc["B"], cbetaselector)
# Contact map of chain A using conventional Cβ and 8 Å definitions
cm = ContactMap(cbetas_A, 8.0)
# Returns true if a contact is present between the tenth and twentieth element
cm[10, 20]
# Rectangular contact map of chains A and B
cm = ContactMap(cbetas_A, cbetas_B, 8.0)
# Write the contact map to file
using DelimitedFiles
writedlm("contacts.out", Int64.(cm.data), " ")BioStructures.DisorderedAtom — Type
A container to hold different locations of the same atom.
BioStructures.DisorderedResidue — Type
A container to hold different versions of the same residue (point mutations).
BioStructures.DistanceMap — Type
DistanceMap(element)
DistanceMap(element_one, element_two)
DistanceMap(float_array_2D)Calculate the distance map for a StructuralElementOrList, or between two StructuralElementOrLists.
This returns a DistanceMap type containing a Array{Float64, 2} with minimum distances between the sub-elements. When one element is given as input this returns a symmetric square matrix. To directly access the underlying data of DistanceMap dm, use dm.data.
Examples
cbetas_A = collectatoms(struc["A"], cbetaselector)
cbetas_B = collectatoms(struc["B"], cbetaselector)
# Distance map of chain A showing how far each Cβ atom is from the others
dm = DistanceMap(cbetas_A)
# Returns the distance between the tenth and twentieth element
dm[10, 20]
# Rectangular distance map of chains A and B
dm = DistanceMap(cbetas_A, cbetas_B)
# Write the distance map to file
using DelimitedFiles
writedlm("distances.out", dm.data, " ")BioStructures.MMCIFDict — Type
MMCIFDict(filepath; gzip=false)
MMCIFDict(io; gzip=false)
MMCIFDict()A macromolecular Crystallographic Information File (mmCIF) dictionary.
Can be accessed using similar functions to a standard Dict. Keys are field names as a String and values are always Vector{String}, even for multiple components or numerical data. To directly access the underlying dictionary of MMCIFDict d, use d.dict. Call MMCIFDict with a filepath or stream to read the dictionary from that source. The keyword argument gzip (default false) determines if the input is gzipped.
BioStructures.MMCIFFormat — Type
Protein Data Bank (PDB) mmCIF file format.
BioStructures.MMTFDict — Type
MMTFDict(filepath; gzip=false)
MMTFDict(io; gzip=false)
MMTFDict()A Macromolecular Transmission Format (MMTF) dictionary.
Use of the dictionary requires the MMTF.jl package to be imported. Can be accessed using similar functions to a standard Dict. Keys are field names as a String and values are various types. To directly access the underlying dictionary of MMTFDict d, use d.dict. Call MMTFDict with a filepath or stream to read the dictionary from that source. The keyword argument gzip (default false) determines if the file is gzipped.
BioStructures.MMTFFormat — Type
Protein Data Bank (PDB) MMTF file format.
BioStructures.Model — Type
A conformation of a macromolecular structure.
BioStructures.MolecularStructure — Type
A container for multiple Models that represents a Protein Data Bank (PDB) entry.
BioStructures.PDBConsistencyError — Type
Error arising from an attempt to make an inconsistent structural state.
BioStructures.PDBFormat — Type
Protein Data Bank (PDB) file format.
BioStructures.PDBParseError — Type
Error arising from parsing a Protein Data Bank (PDB) file.
BioStructures.PDBXMLFormat — Type
Protein Data Bank (PDB) XML file format.
BioStructures.Residue — Type
A residue (amino acid) or other molecule.
BioStructures.SpatialMap — Type
A map of a structural property, e.g. a ContactMap or a DistanceMap.
BioStructures.StructuralElement — Type
A macromolecular structural element.
BioStructures.Transformation — Type
Transformation(coords1, coords2)
Transformation(el1, el2, residue_selectors...)
Transformation(trans1, trans2, rot)A 3D rigid transformation approximately mapping coords1 to coords2, found using the Kabsch algorithm.
When called with structural elements, carries out a pairwise alignment and superimposes on atoms from aligned residues. In this case the BioSequences.jl and BioAlignments.jl packages should be imported. Keyword arguments for pairwise alignment can be given, see pairalign. The residue selectors determine which residues to do the pairwise alignment on. The keyword argument alignatoms is an atom selector that selects the atoms to calculate the superimposition on (default calphaselector). Can also be called with two sets of coordinates of the same size, with the number of dimensions in the first axis and the number of points in the second axis.
The returned Transformation object consists of the mean coordinates of the first set, the mean coordinates of the second set, the rotation to map the first centred set onto the second centred set, and the indices of the aligned residues in the first and second elements if relevant.
BioStructures.StructuralElementOrList — Type
A StructuralElement or Vector of StructuralElements up to a Vector{Model}.
BioStructures.backboneatomnames — Constant
Set of protein backbone atom names.
BioStructures.calphaatomnames — Constant
Set of Cα atom names.
BioStructures.cbetaatomnames — Constant
Set of Cβ atom names.
BioStructures.coilsscodes — Constant
Set of secondary structure codes corresponding to a coil.
BioStructures.helixsscodes — Constant
Set of secondary structure codes corresponding to an α-helix.
BioStructures.pdbextension — Constant
Mapping of Protein Data Bank (PDB) formats to their file extensions.
BioStructures.proteinresnames — Constant
Set of residue names found in proteins and peptides.
BioStructures.sheetsscodes — Constant
Set of secondary structure codes corresponding to a β-sheet.
BioStructures.threeletter_to_aa — Constant
Lookup table of amino acids, re-exported from BioSymbols.
BioStructures.waterresnames — Constant
Set of residue names corresponding to water.
Base.collect — Method
collect(el)Returns a Vector of the sub-elements in a StructuralElementOrList, e.g. AbstractAtoms in a Residue or AbstractResidues in a Chain.
Base.read — Method
read(filepath::AbstractString, format::Type; <keyword arguments>)
read(input::IO, format::Type; <keyword arguments>)Read a Protein Data Bank (PDB) file and return a MolecularStructure.
Arguments
format::Type: the format of the PDB file; options are PDBFormat, MMCIFFormat and MMTFFormat. MMTFFormat requires the MMTF.jl package to be imported.structure_name::AbstractString: the name given to the returnedMolecularStructure; defaults to the file name.remove_disorder::Bool=false: whether to remove atoms with alt loc ID not ' ' or 'A'.read_std_atoms::Bool=true: whether to read standard ATOM records.read_het_atoms::Bool=true: whether to read HETATOM records.run_dssp::Bool=false: whether to run DSSP to assign secondary structure. Requires the DSSP_jll.jl package to be imported if set totrue.run_stride::Bool=false: whether to run STRIDE to assign secondary structure. Requires the STRIDE_jll.jl package to be imported if set totrue.gzip::Bool=false: whether the input is gzipped, not available for PDB format.
BioGenerics.distance — Method
distance(element_one, element_two, atom_selectors...)Get the minimum distance in Å between two StructuralElementOrLists.
Additional arguments are atom selector functions - only atoms that return true from the functions are retained.
BioStructures.acidicresselector — Method
acidicresselector(res)
acidicresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, an acidic amino acid based on the residue name.
BioStructures.aliphaticresselector — Method
aliphaticresselector(res)
aliphaticresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, an aliphatic amino acid based on the residue name.
BioStructures.allselector — Method
allselector(at)
allselector(res)Trivial selector that returns true for any structural element.
BioStructures.altlocid — Method
altlocid(at)Get the alternative location ID of an AbstractAtom as a Char.
BioStructures.altlocids — Method
altlocids(dis_at)Get the list of alternative location IDs in an AbstractAtom as a Vector{Char}, sorted by atom serial.
BioStructures.applyselectors! — Method
applyselectors!(els, selectors...)Removes from a Vector of StructuralElements all elements that do not return true from all the selector functions.
BioStructures.applyselectors — Method
applyselectors(els, selectors...)Returns a copy of a Vector of StructuralElements with all elements that do not return true from all the selector functions removed.
BioStructures.applytransform! — Method
applytransform!(el, transformation)Modify all coordinates in an element according to a transformation.
BioStructures.applytransform — Method
applytransform(coords, transformation)Modify coordinates according to a transformation.
BioStructures.aromaticresselector — Method
aromaticresselector(res)
aromaticresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, an aromatic amino acid based on the residue name.
BioStructures.atomid — Method
atomid(at)Get a descriptive atom ID for an AbstractAtom as a Tuple of the form (full residue ID, residue name, atom name).
BioStructures.atomname — Method
atomname(at; strip=true)Get the atom name of an AbstractAtom as a String. strip determines whether surrounding whitespace is stripped.
BioStructures.atomnames — Method
atomnames(res; strip=true)Get the sorted list of AbstractAtoms in an AbstractResidue. strip determines whether surrounding whitespace is stripped.
BioStructures.atomnameselector — Method
atomnameselector(at, atom_names; strip=true)Determines if an AbstractAtom has its atom name in a list of names. strip determines whether surrounding whitespace is stripped from the atom name before it is checked in the list.
BioStructures.atoms — Method
atoms(res)Return the dictionary of AbstractAtoms in an AbstractResidue.
BioStructures.backboneselector — Method
backboneselector(at)Determines if an AbstractAtom is not a hetero-atom and corresponds to a protein backbone atom.
BioStructures.basicresselector — Method
basicresselector(res)
basicresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a basic amino acid based on the residue name.
BioStructures.bondangle — Method
bondangle(atom_a, atom_b, atom_c)
bondangle(vec_ba, vec_bc)Calculate the bond or pseudo-bond angle in radians between three AbstractAtoms or two vectors.
The angle between B→A and B→C is returned in the range 0 to π.
BioStructures.calphaselector — Method
calphaselector(at)Determines if an AbstractAtom is not a hetero-atom and corresponds to a Cα atom.
BioStructures.cbetaselector — Method
cbetaselector(at)Determines if an AbstractAtom is not a hetero-atom and corresponds to a Cβ atom, or a Cα atom in glycine.
BioStructures.chain — Method
chain(at)
chain(res)Return the Chain that an AbstractAtom or AbstractResidue belongs to.
BioStructures.chainid! — Method
chainid!(ch, id)
chainid!(res, id)Set the chain ID of a Chain or an AbstractResidue to a new String.
If a chain with this ID already exists, it will be removed from its current chain and added to that chain. If a chain with this ID does not exist, a new chain will be added to the model and this residue will be added to it. If moving this residue from a chain to a new chain leaves the old chain without residues, the old chain will be removed from the Model.
BioStructures.chainid — Method
chainid(el)Get the chain ID of an AbstractAtom, AbstractResidue or Chain as a String.
BioStructures.chainids — Method
chainids(model)
chainids(struc)Get the sorted chain IDs of the chains in a Model, or the default Model of a MolecularStructure, as a Vector{String}.
BioStructures.chains — Method
chains(model)
chains(struc)Return the dictionary of Chains in a Model, or the default Model of a MolecularStructure.
BioStructures.charge — Method
charge(at; strip=true)Get the charge on an AbstractAtom as a String. The charge is set to " " if not specified during atom creation. strip determines whether surrounding whitespace is stripped.
BioStructures.chargedresselector — Method
chargedresselector(res)
chargedresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a charged amino acid based on the residue name.
BioStructures.chiangle — Method
chiangle(res, i)Calculate the χᵢ angle in radians for a standard AbstractResidue with standard atom names. The angle is in the range -π to π.
BioStructures.chiangles — Method
chiangles(res)Calculate the Vector of standard χ angles for a standard AbstractResidue with standard atom names. The length of the vector ranges from 0 (GLY, ALA) to 5 (ARG). The angles are each in the range -π to π.
BioStructures.chiangles — Method
chiangles(element, residue_selectors...)Calculate the Vector of standard χ angles for each residue in a StructuralElementOrList. This returns a Vector of Vectors, where all angles are in the range -π to π. Additional arguments are residue selector functions - only residues that return true from the functions are retained.
BioStructures.choosedefaultaltlocid — Method
choosedefaultaltlocid(at_one, at_two)Determine which of two Atoms representing a disorered atom better qualifies as the default location.
The Atom with the highest occupancy is chosen; in the case of ties the Atom with the lowest alternative location ID in alphabetical order is chosen.
BioStructures.coilselector — Method
coilselector(res)
coilselector(at)Determines if an AbstractResidue or AbstractAtom is part of a coil, i.e. whether the secondary structure code is in coilsscodes.
BioStructures.collectatoms — Method
collectatoms(el)Returns a Vector of the atoms in a StructuralElementOrList.
Additional arguments are atom selector functions - only atoms that return true from all the functions are retained. The keyword argument expand_disordered (default false) determines whether to return all copies of disordered atoms separately.
BioStructures.collectchains — Method
collectchains(el)Returns a Vector of the chains in a StructuralElementOrList.
Additional arguments are chain selector functions - only chains that return true from all the functions are retained.
BioStructures.collectmodels — Method
collectmodels(el)Returns a Vector of the models in a StructuralElementOrList.
Additional arguments are model selector functions - only models that return true from all the functions are retained.
BioStructures.collectresidues — Method
collectresidues(el)Returns a Vector of the residues in a StructuralElementOrList.
Additional arguments are residue selector functions - only residues that return true from all the functions are retained. The keyword argument expand_disordered (default false) determines whether to return all copies of disordered residues separately.
BioStructures.coordarray — Method
coordarray(element, atom_selectors...)Get the atomic coordinates in Å of a StructuralElementOrList as a 2D Array.
Each column corresponds to one atom, so the size is (3, natoms). Additional arguments are atom selector functions - only atoms that return true from all the functions are retained. The keyword argument `expanddisordered(defaultfalse`) determines whether to return coordinates for all copies of disordered atoms separately.
BioStructures.coords! — Method
coords!(at, new_coords)Set the coordinates in Å of an AbstractAtom to a Vector of 3 numbers.
For DisorderedAtoms only the default atom is updated.
BioStructures.coords — Method
coords(at)Get the coordinates in Å of an AbstractAtom as a Vector{Float64}.
BioStructures.countatoms — Method
countatoms(el)Return the number of atoms in a StructuralElementOrList as an Int.
Additional arguments are atom selector functions - only atoms that return true from all the functions are counted. The keyword argument expand_disordered (default false) determines whether to return all copies of disordered atoms separately.
BioStructures.countchains — Method
countchains(el)Return the number of Chains in a StructuralElementOrList as an Int.
Additional arguments are chain selector functions - only chains that return true from all the functions are counted.
BioStructures.countmodels — Method
countmodels(el)Return the number of Models in a StructuralElementOrList as an Int.
Additional arguments are model selector functions - only models that return true from all the functions are counted.
BioStructures.countresidues — Method
countresidues(el)Return the number of residues in a StructuralElementOrList as an Int.
Additional arguments are residue selector functions - only residues that return true from all the functions are counted. The keyword argument expand_disordered (default false) determines whether to return all copies of disordered residues separately.
BioStructures.defaultaltlocid — Method
defaultaltlocid(dis_at)Get the alternative location ID of the default Atom in a DisorderedAtom as a Char.
The default is the highest occupancy, or lowest character alternative location ID for ties (i.e. 'A' beats 'B').
BioStructures.defaultatom — Method
defaultatom(dis_at)Return the default Atom in a DisorderedAtom.
The default is the highest occupancy, or lowest character alternative location ID for ties (i.e. 'A' beats 'B').
BioStructures.defaultmodel — Method
defaultmodel(struc)Get the default Model in a MolecularStructure.
This is the Model with the lowest model number.
BioStructures.defaultresidue — Method
defaultresidue(dis_res)Return the default Residue in a DisorderedResidue.
The default is the first name read in.
BioStructures.defaultresname — Method
defaultresname(dis_res)Get the name of the default Residue in a DisorderedResidue as a String.
The default is the first name read in.
BioStructures.dihedralangle — Method
dihedralangle(atom_a, atom_b, atom_c, atom_d)
dihedralangle(vec_ab, vec_bc, vec_cd)Calculate the dihedral angle in radians defined by four AbstractAtoms or three vectors.
The angle between the planes defined by atoms (A, B, C) and (B, C, D) is returned in the range -π to π.
BioStructures.disorderedres — Method
disorderedres(dis_res, res_name)Return the Residue in a DisorderedResidue with a given residue name.
BioStructures.disorderselector — Method
disorderselector(at)
disorderselector(res)Determines whether an AbstractAtom or AbstractResidue is disordered, i.e. has multiple locations in the case of atoms or multiple residue names (point mutants) in the case of residues.
BioStructures.displacements — Method
displacements(element_one, element_two, residue_selectors...)
displacements(element_one, element_two, superimpose=false)
displacements(coords_one, coords_two)Get the displacements in Å between atomic coordinates from two StructuralElementOrLists or two coordinate Arrays.
If superimpose is true (the default), the elements are superimposed before calculation and the displacements are calculated on the superimposed residues. In this case the BioSequences.jl and BioAlignments.jl packages should be imported. See Transformation for keyword arguments. If superimpose is false the elements are assumed to be superimposed and must be of the same length. The keyword argument dispatoms is an atom selector that selects the atoms to calculate displacements on (default calphaselector).
BioStructures.downloadallobsoletepdb — Method
downloadallobsoletepdb(; <keyword arguments>)Download all obsolete Protein Data Bank (PDB) files from the RCSB server.
Returns the list of PDB IDs downloaded. Requires an internet connection.
Arguments
obsolete_dir::AbstractString=pwd(): the directory where the PDB files are downloaded; defaults to the current working directory.format::Type=PDBFormat: the format of the PDB file; options are PDBFormat, PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.overwrite::Bool=false: if settrue, overwrites the PDB file if it exists indir; by default skips downloading the PDB file if it exists.
BioStructures.downloadentirepdb — Method
downloadentirepdb(; <keyword arguments>)Download the entire Protein Data Bank (PDB) from the RCSB server.
Returns the list of PDB IDs downloaded. Ensure you have enough disk space and time before running. The function can be stopped any time and called again to resume downloading. Requires an internet connection.
Arguments
dir::AbstractString=pwd(): the directory to which the PDB files are downloaded; defaults to the current working directory.format::Type=PDBFormat: the format of the PDB file; options are PDBFormat, PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.overwrite::Bool=false: if settrue, overwrites the PDB file if it exists indir; by default skips downloading the PDB file if it exists.
BioStructures.downloadpdb — Method
downloadpdb(pdbid::AbstractString; <keyword arguments>)
downloadpdb(pdbid::AbstractArray{<:AbstractString, 1}; <keyword arguments>)
downloadpdb(f::Function, args...)Download files from the Protein Data Bank (PDB) via RCSB.
When given an AbstractString, e.g. "1AKE", downloads the PDB file and returns the path to the file. When given an Array{<:AbstractString, 1}, downloads the PDB files in the array and returns an array of the paths to the files. When given a function as the first argument, runs the function with the downloaded filepath(s) as an argument then removes the file(s). Requires an internet connection.
Arguments
dir::AbstractString=pwd(): the directory to which the PDB file is downloaded; defaults to the current working directory.format::Type=PDBFormat: the format of the PDB file; options are PDBFormat, PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.obsolete::Bool=false: if settrue, the PDB file is downloaded in the auto-generated "obsolete" directory inside the specifieddir.overwrite::Bool=false: if settrue, overwrites the PDB file if it exists indir; by default skips downloading the PDB file if it exists.ba_number::Integer=0: if set > 0 downloads the respective biological assembly; by default downloads the PDB file.
BioStructures.element — Method
element(at; strip=true)Get the element of an AbstractAtom as a String.
The element is set to " " if not specified during atom creation. strip determines whether surrounding whitespace is stripped.
BioStructures.generatechainid — Method
generatechainid(entity_id)Convert a positive Integer into a chain ID.
Goes A to Z, then AA to ZA, AB to ZB etc. This is in line with Protein Data Bank (PDB) conventions.
BioStructures.heavyatomselector — Method
heavyatomselector(at)Determines if an AbstractAtom corresponds to a heavy (non-hydrogen) atom and is not a hetero-atom.
BioStructures.helixselector — Method
helixselector(res)
helixselector(at)Determines if an AbstractResidue or AbstractAtom is part of an α-helix, i.e. whether the secondary structure code is in helixsscodes.
BioStructures.heteroselector — Method
heteroselector(at)
heteroselector(res)Determines if an AbstractAtom represents a hetero atom, e.g. came from a HETATM record in a Protein Data Bank (PDB) file, or if an AbstractResidue represents a hetero molecule, e.g. consists of HETATM records from a PDB file.
BioStructures.hydrogenselector — Method
hydrogenselector(at)Determines if an AbstractAtom represents hydrogen.
Uses the element field where possible, otherwise uses the atom name.
BioStructures.hydrophobicresselector — Method
hydrophobicresselector(res)
hydrophobicresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a hydrophobic amino acid based on the residue name.
BioStructures.inscode — Method
inscode(at)
inscode(res)Get the insertion code of an AbstractAtom or AbstractResidue as a Char.
BioStructures.isdisorderedatom — Method
isdisorderedatom(at)Determines if an AbstractAtom is a DisorderedAtom, i.e. if there are multiple locations present for an atom.
BioStructures.isdisorderedres — Method
isdisorderedres(res)Determine if an AbstractResidue is a DisorderedResidue, i.e. there are multiple residue names with the same residue ID.
BioStructures.ishetero — Method
ishetero(at)
ishetero(res)Determines if an AbstractAtom represents a hetero atom, e.g. came from a HETATM record in a Protein Data Bank (PDB) file, or if an AbstractResidue represents a hetero molecule, e.g. consists of HETATM records from a PDB file.
BioStructures.model — Method
model(el)Return the Model that an AbstractAtom, AbstractResidue or Chain belongs to.
BioStructures.modelnumber — Method
modelnumber(el)Get the model number of a Model, Chain, AbstractResidue or AbstractAtom as an Int.
BioStructures.modelnumbers — Method
modelnumbers(struc)Get the sorted model numbers from a MolecularStructure as a Vector{Int}.
BioStructures.models — Method
models(struc)Return the dictionary of Models in a MolecularStructure.
BioStructures.neutralresselector — Method
neutralresselector(res)
neutralresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a neutral amino acid based on the residue name.
BioStructures.nonpolarresselector — Method
nonpolarresselector(res)
nonpolarresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a non-polar amino acid based on the residue name.
BioStructures.notwaterselector — Method
notwaterselector(res)
notwaterselector(at)Determines if an AbstractResidue or AbstractAtom does not represent a water molecule, i.e. whether the residue name is not in waterresnames.
BioStructures.occupancy — Method
occupancy(at)Get the occupancy of an AbstractAtom as a Float64.
The occupancy is set to 1.0 if not specified during atom creation.
BioStructures.omegaangle — Method
omegaangle(res, res_previous)
omegaangle(chain, res_id)Calculate the omega angle in radians for an AbstractResidue.
Arguments can either be a residue and the previous residue or a chain and the position as a residue ID. The first residue (or one at the given index) requires the atoms "N" and "CA" and the previous residue requires the atoms "CA" and "C". The angle is in the range -π to π.
BioStructures.omegaangles — Method
omegaangles(element, residue_selectors...)Calculate the Vector of omega angles of a StructuralElementOrList.
The vectors have NaN for residues where an angle cannot be calculated, e.g. due to missing atoms or lack of an adjacent residue. The angle is in the range -π to π. Additional arguments are residue selector functions - only residues that return true from the functions are retained.
BioStructures.pdbentrylist — Method
pdbentrylist()Obtain the list of all Protein Data Bank (PDB) entries from the RCSB server.
Requires an internet connection.
BioStructures.pdbline — Method
pdbline(at::Atom)
pdbline(at::DisorderedAtom)
pdbline(at::AtomRecord)Form a Protein Data Bank (PDB) format ATOM or HETATM record as a String from an Atom, DisorderedAtom or AtomRecord.
This will throw an ArgumentError if a value cannot fit into the allocated space, e.g. the chain ID is longer than one character or the atom serial is greater than 99999. In this case consider using writemmcif or writemmtf to write a mmCIF file or a MMTF file.
BioStructures.pdbobsoletelist — Method
pdbobsoletelist()Obtain the list of all obsolete Protein Data Bank (PDB) entries from the RCSB server.
Requires an internet connection.
BioStructures.pdbrecentchanges — Method
pdbrecentchanges()Obtain three lists giving the added, modified and obsolete Protein Data Bank (PDB) entries from the recent RCSB weekly status files.
Requires an internet connection.
BioStructures.pdbstatuslist — Method
pdbstatuslist(url::AbstractString)Obtain the list of Protein Data Bank (PDB) entries from a RCSB weekly status file by specifying its URL.
An example URL is https://files.wwpdb.org/pub/pdb/pub/pdb/data/status/latest/added.pdb. Requires an internet connection.
BioStructures.phiangle — Method
phiangle(res, res_previous)
phiangle(chain, res_id)Calculate the phi angle in radians for an AbstractResidue.
Arguments can either be a residue and the previous residue or a chain and the position as a residue ID. The first residue (or one at the given index) requires the atoms "N", "CA" and "C" and the previous residue requires the atom "C". The angle is in the range -π to π.
BioStructures.phiangles — Method
phiangles(element, residue_selectors...)Calculate the Vector of phi angles of a StructuralElementOrList.
The vectors have NaN for residues where an angle cannot be calculated, e.g. due to missing atoms or lack of an adjacent residue. The angle is in the range -π to π. Additional arguments are residue selector functions - only residues that return true from the functions are retained.
BioStructures.polarresselector — Method
polarresselector(res)
polarresselector(at)Determines if an AbstractResidue is, or an AbstractAtom is part of, a polar amino acid based on the residue name.
BioStructures.proteinselector — Method
proteinselector(res)
proteinselector(at)Determines if an AbstractResidue or AbstractAtom is part of a protein or peptide based on the residue name.
BioStructures.psiangle — Method
psiangle(res, res_next)
psiangle(chain, res_id)Calculate the psi angle in radians for an AbstractResidue.
Arguments can either be a residue and the next residue or a chain and the position as a residue ID. The first residue (or one at the given index) requires the atoms "N", "CA" and "C" and the next residue requires the atom "N". The angle is in the range -π to π.
BioStructures.psiangles — Method
psiangles(element, residue_selectors...)Calculate the Vector of psi angles of a StructuralElementOrList.
The vectors have NaN for residues where an angle cannot be calculated, e.g. due to missing atoms or lack of an adjacent residue. The angle is in the range -π to π. Additional arguments are residue selector functions - only residues that return true from the functions are retained.
BioStructures.ramachandranangles — Method
ramachandranangles(element, residue_selectors...)Calculate the Vectors of phi and psi angles of a StructuralElementOrList.
The vectors have NaN for residues where an angle cannot be calculated, e.g. due to missing atoms or lack of an adjacent residue. The angles are in the range -π to π. Additional arguments are residue selector functions - only residues that return true from the functions are retained.
BioStructures.readmultimmcif — Method
readmultimmcif(filepath; gzip=false)
readmultimmcif(io; gzip=false)Read multiple MMCIFDicts from a filepath or stream. Each MMCIFDict in the returned Dict{String, MMCIFDict} corresponds to an mmCIF data block from the input. An example of such a file is the chemical component dictionary from the Protein Data Bank. The keyword argument gzip (default false) determines if the input is gzipped.
BioStructures.resid — Method
resid(res; full=true)Get a descriptive residue ID String for an AbstractAtom or AbstractResidue.
Format is residue number then insertion code with "H" in front for hetero residues. If full equals true the chain ID is also added after a colon. Examples are "50A", "H20" and "10:A".
BioStructures.resids — Method
resids(ch)Get the sorted list of AbstractResidues in a Chain.
BioStructures.residue — Method
residue(at)Get the Residue that an AbstractAtom belongs to.
BioStructures.residues — Method
residues(ch)Return the dictionary of AbstractResidues in a Chain.
BioStructures.resname — Method
resname(at; strip=true)
resname(res; strip=true)Get the residue name of an AbstractAtom or AbstractResidue as a String.
strip determines whether surrounding whitespace is stripped.
BioStructures.resnames — Method
resnames(dis_res)Get the residue names in an AbstractResidue as a Vector{String}.
For a DisorderedResidue there will be multiple residue names - in this case the default residue name is placed first, then the others are ordered alphabetically.
BioStructures.resnameselector — Method
resnameselector(res, res_names)
resnameselector(at, res_names)Determines if an AbstractResidue or AbstractAtom has its residue name in a list of names.
BioStructures.resnumber — Method
resnumber(at)
resnumber(res)Get the residue number of an AbstractAtom or AbstractResidue as an Int.
BioStructures.retrievepdb — Method
retrievepdb(pdbid::AbstractString; <keyword arguments>)Download and read a Protein Data Bank (PDB) file or biological assembly from the RCSB server, returning a MolecularStructure.
Requires an internet connection.
Arguments
pdbid::AbstractString: the PDB ID to be downloaded and read.dir::AbstractString=pwd(): the directory to which the PDB file is downloaded; defaults to the current working directory.format::Type=MMCIFFormat: the format of the PDB file; options are PDBFormat, PDBXMLFormat and MMCIFFormat. MMTF files are no longer available to download.obsolete::Bool=false: if settrue, the PDB file is downloaded in the auto-generated "obsolete" directory inside the specifieddir.overwrite::Bool=false: if settrue, overwrites the PDB file if it exists indir; by default skips downloading the PDB file if it exists.ba_number::Integer=0: if set > 0 downloads the respective biological assembly; by default downloads the PDB file.structure_name::AbstractString="$pdbid.pdb": the name given to the returnedMolecularStructure; defaults to the PDB ID.remove_disorder::Bool=false: whether to remove atoms with alt loc ID not ' ' or 'A'.read_std_atoms::Bool=true: whether to read standard ATOM records.read_het_atoms::Bool=true: whether to read HETATOM records.run_dssp::Bool=false: whether to run DSSP to assign secondary structure. Requires the DSSP_jll.jl package to be imported if set totrue.run_stride::Bool=false: whether to run STRIDE to assign secondary structure. Requires the STRIDE_jll.jl package to be imported if set totrue.
BioStructures.rmsd — Method
rmsd(element_one, element_two, residue_selectors...)
rmsd(element_one, element_two, superimpose=false)
rmsd(coords_one, coords_two)Get the root-mean-square deviation (RMSD) in Å between two StructuralElementOrLists or two coordinate Arrays.
If superimpose is true (the default), the elements are superimposed before RMSD calculation and the RMSD is calculated on the superimposed residues. In this case the BioSequences.jl and BioAlignments.jl packages should be imported. See Transformation for keyword arguments. If superimpose is false the elements are assumed to be superimposed and must be of the same length. The keyword argument rmsdatoms is an atom selector that selects the atoms to calculate RMSD on (default calphaselector).
BioStructures.rundssp — Function
rundssp(struc)
rundssp(model)
rundssp(filepath_in, dssp_filepath_out)Return a copy of the structural element with DSSP (Define Secondary Structure of Proteins) run to assign secondary structure, or run DSSP directly on a PDB or mmCIF file.
Requires the DSSP_jll.jl package to be imported.
BioStructures.rundssp! — Function
rundssp!(struc)
rundssp!(model)Run DSSP (Define Secondary Structure of Proteins) on the given structural element to assign secondary structure.
Requires the DSSP_jll.jl package to be imported. A temporary PDB file is written, so this will fail if the structural element cannot be written to a PDB file, for example if there are two-letter chain IDs.
BioStructures.runstride — Function
runstride(struc)
runstride(model)
runstride(filepath_in, stride_filepath_out)Return a copy of the structural element with STRIDE run to assign secondary structure, or run STRIDE directly on a PDB file.
Requires the STRIDE_jll.jl package to be imported.
BioStructures.runstride! — Function
runstride!(struc)
runstride!(model)Run STRIDE on the given structural element to assign secondary structure.
Requires the STRIDE_jll.jl package to be imported. A temporary PDB file is written, so this will fail if the structural element cannot be written to a PDB file, for example if there are two-letter chain IDs.
BioStructures.sequentialresidues — Method
sequentialresidues(res_first, res_second)Determine if the second residue follows the first in sequence.
For this to be true the residues need to have the same chain ID, both need to be standard/hetero residues and the residue number of the second needs to be one greater than that of the first (or the residue numbers the same and the insertion code of the second greater than the first).
BioStructures.serial — Method
serial(at)Get the serial number of an AbstractAtom as an Int.
BioStructures.sheetselector — Method
sheetselector(res)
sheetselector(at)Determines if an AbstractResidue or AbstractAtom is part of a β-sheet, i.e. whether the secondary structure code is in sheetsscodes.
BioStructures.showcontactmap — Method
showcontactmap(contact_map)
showcontactmap(io, contact_map)Print a representation of a ContactMap to stdout, or a specified IO instance.
A fully plotted version can be obtained with plot(contact_map) but that requires Plots.jl; showcontactmap works without that dependency.
BioStructures.sidechainselector — Method
sidechainselector(at)Determines if an AbstractAtom is not a hetero-atom and corresponds to a protein side chain atom.
BioStructures.spaceatomname — Method
spaceatomname(at::Atom)Space an Atom name such that the last element letter (generally) appears in the second column.
If the element property of the Atom is set it is used to get the element, otherwise the name starts from the second column where possible. This function is generally not required as spacing is recorded when atom names are read in from a Protein Data Bank (PDB) file. However this spacing can be important, for example distinguising between Cα and calcium atoms.
BioStructures.specializeresnames! — Method
specializeresnames!(el)Rename residues to reflect the bonding topology.
Renames histidine residues to reflect a specific protonation configuration (HID, HIE, or HIP) based on the presence of HD1 and HE2 atoms. Renames N-terminal and C-terminal (e.g. ALA -> NALA) residues based on the presence of certain atoms. Other residues remain unchanged.
Hydrogens must have been assigned prior to calling this function.
BioStructures.sqdistance — Method
sqdistance(element_one, element_two, atom_selectors...)Get the minimum square distance in Å between two StructuralElementOrLists.
Additional arguments are atom selector functions - only atoms that return true from the functions are retained.
BioStructures.sscode! — Method
sscode!(res, ss_code)Set the secondary structure code of an AbstractResidue to a Char.
BioStructures.sscode — Method
sscode(res)
sscode(at)Get the secondary structure code of an AbstractResidue or AbstractAtom as a Char.
'-' represents unassigned secondary structure. Secondary structure can be assigned using rundssp! or runstride!.
BioStructures.sscodeselector — Method
sscodeselector(res, ss_codes)
sscodeselector(at, ss_codes)Determines if an AbstractResidue or AbstractAtom has its secondary structure code in a list of secondary structure codes.
BioStructures.standardselector — Method
standardselector(at)
standardselector(res)Determines if an AbstractAtom represents a standard atom, e.g. came from a ATOM record in a Protein Data Bank (PDB) file, or if an AbstractResidue represents a standard molecule, e.g. consists of ATOM records from a PDB file.
BioStructures.structure — Method
structure(el)Return the MolecularStructure that an AbstractAtom, AbstractResidue, Chain or Model belongs to.
BioStructures.structurename — Method
structurename(el)Get the name of the MolecularStructure that a StructuralElement belongs to as a String.
BioStructures.superimpose! — Method
superimpose!(el1, el2, residue_selectors...)Calculate the Transformation that maps the first element onto the second, and modify all coordinates in the first element according to the transformation.
Requires the BioSequences.jl and BioAlignments.jl packages to be imported. See Transformation for keyword arguments.
BioStructures.tempfactor — Method
tempfactor(at)Get the temperature factor of an AbstractAtom as a Float64.
The temperature factor is set to 0.0 if not specified during atom creation.
BioStructures.updatelocalpdb — Method
updatelocalpdb(; dir::AbstractString=pwd(), format::Type=PDBFormat)Update a local copy of the Protein Data Bank (PDB).
Obtains the recent weekly lists of new, modified and obsolete PDB entries and automatically updates the PDB files of the given format inside the local dir directory. Requires an internet connection.
BioStructures.waterselector — Method
waterselector(res)
waterselector(at)Determines if an AbstractResidue or AbstractAtom represents a water molecule, i.e. whether the residue name is in waterresnames.
BioStructures.writemmcif — Method
writemmcif(output, element, atom_selectors...; gzip=false)
writemmcif(output, mmcif_dict; gzip=false)Write a StructuralElementOrList or a MMCIFDict to a mmCIF format file or output stream.
Atom selector functions can be given as additional arguments - only atoms that return true from all the functions are retained. The keyword argument expand_disordered (default true) determines whether to return all copies of disordered residues and atoms. The keyword argument gzip (default false) determines if the output is gzipped.
BioStructures.writemmtf — Function
writemmtf(output, element, atom_selectors...; gzip=false)
writemmtf(output, mmtf_dict; gzip=false)Write a StructuralElementOrList or a MMTFDict to a MMTF file or output stream.
Requires the MMTF.jl package to be imported. Atom selector functions can be given as additional arguments - only atoms that return true from all the functions are retained. The keyword argument expand_disordered (default true) determines whether to return all copies of disordered residues and atoms. The keyword argument gzip (default false) determines if the file should be gzipped.
BioStructures.writemultimmcif — Method
writemultimmcif(filepath, cifs; gzip=false)
writemultimmcif(io, cifs; gzip=false)Write multiple MMCIFDicts as a Dict{String, MMCIFDict} to a filepath or stream. The keyword argument gzip (default false) determines if the output is gzipped.
BioStructures.writepdb — Method
writepdb(output, element, atom_selectors...)Write a StructuralElementOrList to a Protein Data Bank (PDB) format file or output stream.
Only ATOM, HETATM, MODEL and ENDMDL records are written - there is no header and there are no TER records. Atom selector functions can be given as additional arguments - only atoms that return true from all the functions are retained. The keyword argument expand_disordered (default true) determines whether to return all copies of disordered residues and atoms.
BioStructures.@sel_str — Macro
String selection syntax.
BioStructures.x — Function
x(at)Get the x coordinate in Å of an AbstractAtom as a Float64.
BioStructures.x! — Function
x!(at, val)Set the x coordinate in Å of an AbstractAtom to val.
For DisorderedAtoms only the default atom is updated.
BioStructures.y — Function
y(at)Get the y coordinate in Å of an AbstractAtom as a Float64.
BioStructures.y! — Function
y!(at, val)Set the y coordinate in Å of an AbstractAtom to val.
For DisorderedAtoms only the default atom is updated.
BioStructures.z — Function
z(at)Get the z coordinate in Å of an AbstractAtom as a Float64.
BioStructures.z! — Function
z!(at, val)Set the z coordinate in Å of an AbstractAtom to val.
For DisorderedAtoms only the default atom is updated.