Skip to content

Commit

Permalink
Bump to 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shuuul committed Sep 21, 2023
1 parent d3cfd76 commit fb69373
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 89 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BioStructures"
uuid = "de9282ab-8554-53be-b2d6-f6c222edabfc"
authors = ["Joe G Greener <[email protected]>"]
version = "2.0.1"
version = "2.1.0"

[deps]
BioAlignments = "00701ae9-d1dc-5365-b64a-a3a3ebf5695e"
Expand Down
38 changes: 36 additions & 2 deletions docs/src/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Properties can be retrieved as follows:
| [`resnumber`](@ref) | Residue number of a residue or atom | `Int` |
| [`sequentialresidues`](@ref) | Determine if the second residue follows the first in sequence | `Bool` |
| [`inscode`](@ref) | Insertion code of a residue or atom | `Char` |
| [`ss_code`](@ref) | Secondary Structure code of a residue or atom | `String` |
| [`sscode`](@ref) | Secondary Structure code of a residue or atom | `String` |
| [`resid`](@ref) | Residue ID of an atom or residue (`full=true` includes chain) | `String` |
| [`atomnames`](@ref) | Atom names of the atoms in a residue, sorted by serial | `Array{String,1}` |
| [`atoms`](@ref) | Dictionary of atoms in a residue | `Dict{String,AbstractAtom}` |
Expand Down Expand Up @@ -174,8 +174,9 @@ The selectors available are:
| [`helixselector`](@ref) | `Atom` or `Residue` | Atoms/residues arising from Helix |
| [`sheetselector`](@ref) | `Atom` or `Residue` | Atoms/residues arising from Sheet |
| [`coilselector`](@ref) | `Atom` or `Residue` | Atoms/residues arising from Coil |
| [`sscodeselector`](@ref) | `Atom` or `Residue` | Atoms/residues with ss_code in a given list |

To create a new [`atomnameselector`](@ref) or [`resnameselector`](@ref):
To create a new [`atomnameselector`](@ref), [`resnameselector`](@ref) or [`sscodeselector`](@ref):
```julia
cdeltaselector(at::AbstractAtom) = atomnameselector(at, ["CD"])
```
Expand Down Expand Up @@ -408,6 +409,39 @@ See the [Graphs docs](https://juliagraphs.org/Graphs.jl/dev) for details on how
Similar to [`ContactMap`](@ref), contacts are found between any element type passed in.
So if you wanted the graph of chain contacts in a protein complex you could give a [`Model`](@ref) as the first argument.

## Assigning Secondary Structure

The secondary structure code can be accessed after assinging the secodnary structure using [DSSP](https://github.com/PDB-REDO/dssp) or [STRIDE](https://webclu.bio.wzw.tum.de/stride/).

To assign the secondary structure when reading the structure
```julia
# Assign secondary structure using DSSP
read("path/to/pdb", PDB, run_dssp=true)

# Assign secondary structure using STRIDE
read("path/to/pdb", PDB, run_strude=true)
```

[`rundssp(struc)`](@ref), [`runstride(struc)`](@ref), [`rundssp!(struc)`](@ref) and [`runstride!(struc)`](@ref) can also be used to assign secondary structure to [`ProteinStructure`](@ref).
```julia
struc = rundssp(struc)

struc = runstride(struc)

rundssp!(struc)

rundssp!(struc)
```
The assigning process may fail if the structure is too large, since we use an intermediate PDB file whose atom serial number cannot exceeds `99999`.

To get access to the secondary structure code of atom/residue
```julia
sscode(at)
sscode(res)
```

The sscode of an atom/residue can be changed using [`sscode!`](@ref).

## Downloading PDB files

To download a PDB file to a specified directory:
Expand Down
6 changes: 4 additions & 2 deletions src/BioStructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ using Graphs
using MetaGraphs
import MMTF: parsemmtf, writemmtf # Imported to avoid clash with MMTF name
using RecipesBase
using STRIDE_jll: STRIDE_jll # for secondary structure prediction
using DSSP_jll: DSSP_jll # for secondary structure prediction
using STRIDE_jll
# STRIDE_jll # for secondary structure prediction
using DSSP_jll
# DSSP_jll # for secondary structure prediction

include("model.jl")
include("pdb.jl")
Expand Down
21 changes: 18 additions & 3 deletions src/mmcif.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ function Base.read(input::IO,
remove_disorder::Bool=false,
read_std_atoms::Bool=true,
read_het_atoms::Bool=true,
gzip::Bool=false)
gzip::Bool=false,
run_dssp::Bool=false,
run_stride::Bool=false,)
mmcif_dict = MMCIFDict()
if gzip
gz = GzipDecompressorStream(input)
Expand All @@ -285,14 +287,18 @@ function Base.read(input::IO,
structure_name=structure_name,
remove_disorder=remove_disorder,
read_std_atoms=read_std_atoms,
read_het_atoms=read_het_atoms)
read_het_atoms=read_het_atoms,
run_dssp=run_dssp,
run_stride=run_stride)
end

function ProteinStructure(mmcif_dict::MMCIFDict;
structure_name::AbstractString="",
remove_disorder::Bool=false,
read_std_atoms::Bool=true,
read_het_atoms::Bool=true)
read_het_atoms::Bool=true,
run_dssp::Bool=false,
run_stride::Bool=false,)
# Define ProteinStructure and add to it incrementally
struc = ProteinStructure(structure_name)
if haskey(mmcif_dict, "_atom_site.id")
Expand All @@ -313,6 +319,15 @@ function ProteinStructure(mmcif_dict::MMCIFDict;
# Generate lists for iteration
fixlists!(struc)
end

# Run DSSP and STRIDE if required
if run_dssp
rundssp!(struc)
end

if run_stride
runstride!(struc)
end
return struc
end

Expand Down
22 changes: 19 additions & 3 deletions src/mmtf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,26 @@ function Base.read(input::IO,
remove_disorder::Bool=false,
read_std_atoms::Bool=true,
read_het_atoms::Bool=true,
gzip::Bool=false)
gzip::Bool=false,
run_dssp::Bool=false,
run_stride::Bool=false,)
d = MMTFDict(parsemmtf(input; gzip=gzip))
ProteinStructure(d;
structure_name=structure_name,
remove_disorder=remove_disorder,
read_std_atoms=read_std_atoms,
read_het_atoms=read_het_atoms)
read_het_atoms=read_het_atoms,
run_dssp=run_dssp,
run_stride=run_stride)
end

function ProteinStructure(d::MMTFDict;
structure_name::AbstractString="",
remove_disorder::Bool=false,
read_std_atoms::Bool=true,
read_het_atoms::Bool=true)
read_het_atoms::Bool=true,
run_dssp::Bool=false,
run_stride::Bool=false)
struc = ProteinStructure(structure_name)
# Extract hetero atom information from entity list
hets = trues(length(d["chainIdList"]))
Expand Down Expand Up @@ -176,6 +182,16 @@ function ProteinStructure(d::MMTFDict;
end
end
fixlists!(struc)

# Run DSSP and STRIDE if required
if run_dssp
rundssp!(struc)

Check warning on line 188 in src/mmtf.jl

View check run for this annotation

Codecov / codecov/patch

src/mmtf.jl#L188

Added line #L188 was not covered by tests
end

if run_stride
runstride!(struc)

Check warning on line 192 in src/mmtf.jl

View check run for this annotation

Codecov / codecov/patch

src/mmtf.jl#L192

Added line #L192 was not covered by tests
end

return struc
end

Expand Down
5 changes: 3 additions & 2 deletions src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ function Residue(name::AbstractString,
number::Integer,
ins_code::Char,
het_res::Bool,
ch::Chain)
return Residue(name, number, ins_code, het_res, [], Dict(), ch, "")
ch::Chain,
ss_code::String="")
return Residue(name, number, ins_code, het_res, [], Dict(), ch, ss_code)
end

"""
Expand Down
12 changes: 11 additions & 1 deletion src/pdb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ function Base.read(input::IO,
structure_name::AbstractString="",
remove_disorder::Bool=false,
read_std_atoms::Bool=true,
read_het_atoms::Bool=true)
read_het_atoms::Bool=true,
run_dssp::Bool=false,
run_stride::Bool=false,)
# Define ProteinStructure and add to it incrementally
struc = ProteinStructure(structure_name)
struc[1] = Model(1, struc)
Expand Down Expand Up @@ -501,6 +503,14 @@ function Base.read(input::IO,
end
# Generate lists for iteration
fixlists!(struc)
# Run DSSP and STRIDE if required
if run_dssp
rundssp!(struc)

Check warning on line 508 in src/pdb.jl

View check run for this annotation

Codecov / codecov/patch

src/pdb.jl#L508

Added line #L508 was not covered by tests
end

if run_stride
runstride!(struc)

Check warning on line 512 in src/pdb.jl

View check run for this annotation

Codecov / codecov/patch

src/pdb.jl#L512

Added line #L512 was not covered by tests
end
return struc
end

Expand Down
Loading

0 comments on commit fb69373

Please sign in to comment.