Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anton083 committed Oct 26, 2023
1 parent a9ff417 commit c45d8e1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@

This package provides a to calculate the secondary structure using the [DSSP](https://swift.cmbi.umcn.nl/gv/dssp/) algorithm. The package was ported from the [PyDSSP](https://github.com/ShintaroMinami/PyDSSP) package.

It is not a complete implementation of DSSP, as it only assigns '-' for loops, 'H' for alpha helices, and 'E' for beta strands. In spite of that, it matches the original DSSP to a large extent, with the added advantage of being more than 10x faster. For the full DSSP algorithm, check out [BioStructures.jl](https://github.com/BioJulia/BioStructures.jl) or [ProteinSecondaryStructures.jl](https://github.com/m3g/ProteinSecondaryStructures.jl), which both use the [DSSP_jll.jl](https://docs.juliahub.com/General/DSSP_jll/stable/) package, auto-generated using [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl).
This is not a complete implementation of DSSP, as it only assigns '-' for loops, 'H' for alpha helices, and 'E' for beta strands. In spite of that, it matches the original DSSP to a large extent, with the added advantage of being more than 10x faster. For the full DSSP algorithm, check out [BioStructures.jl](https://github.com/BioJulia/BioStructures.jl) or [ProteinSecondaryStructures.jl](https://github.com/m3g/ProteinSecondaryStructures.jl), which both use the [DSSP_jll.jl](https://docs.juliahub.com/General/DSSP_jll/stable/) package that auto-generated using [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl).

```julia
julia> join(sscodes(dssp("1ASS.pdb")))
julia> ss_nums = dssp("test/data/1ASS.pdb") # 1 chain, returns numeric codes
1-element Vector{Vector{Int64}}:
[1, 1, 1, 3, 3, 3, 1, 1, 1, 1 3, 3, 3, 3, 3, 3, 3, 1, 1, 1]

julia> join.(sscodes.(ss_nums)) # 1 chain, converted to chars with sscodes, joined into string
1-element Vector{String}:
"---EEE-----------EEE-EEEEEE---E" 90 bytes "--------EEE-EEEEEEE--EEEEEEE---"

julia> join.(sscodes.(dssp("test/data/3GOU.pdb"))) # 4 chains
4-element Vector{String}:
"---HHHHHHHHHHHHHH---HHHHHHHHHHH" 79 bytes "HH------HHHHHHHHHHHHHHHHHH-----"
"---HHHHHHHHHHHHHH---HHHHHHHHHHH" 84 bytes "---HHHHHHHHHHHHHHHHHH---------H"
"---HHHHHHHHHHHHHH---HHHHHHHHHHH" 79 bytes "HH------HHHHHHHHHHHHHHHHHH-----"
"---HHHHHHHHHHHHHH---HHHHHHHHHHH" 84 bytes "---HHHHHHHHHHHHHHHHHH---------H"
```

## References
Expand Down
2 changes: 0 additions & 2 deletions src/AssigningSecondaryStructure.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module AssigningSecondaryStructure

export dssp

include("utils.jl")
include("dssp.jl")
include("pdb.jl")
Expand Down
2 changes: 2 additions & 0 deletions src/dssp.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using LinearAlgebra
using PaddedViews

export dssp

const Q1Q2_F = 0.084 * 332
const DEFAULT_CUTOFF = -0.5
const DEFAULT_MARGIN = 1.0
Expand Down
10 changes: 4 additions & 6 deletions src/pdb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export load_atom_coords, load_pdb_coords
_coords(atom::Atom) = [atom.x, atom.y, atom.z]

function collect_residues(atoms)
quadruplets = Vector{Atom}[]
residues = Vector{Atom}[]
residue_atoms = Atom[]
current_residue_number = resnum(atoms[1]) # Assuming residue_number function exists

for atom in atoms
if resnum(atom) != current_residue_number # New residue started
if length(residue_atoms) == 4
push!(quadruplets, copy(residue_atoms))
push!(residues, copy(residue_atoms))
end
empty!(residue_atoms)
current_residue_number = resnum(atom)
Expand All @@ -25,14 +25,12 @@ function collect_residues(atoms)

# Handling the last residue
if length(residue_atoms) == 4
push!(quadruplets, copy(residue_atoms))
push!(residues, copy(residue_atoms))
end

return quadruplets
return residues
end



function load_atom_coords(atoms::AbstractVector{<:Atom})
residues = collect_residues(atoms)
coords = zeros(Float32, (length(residues), 4, 3))
Expand Down

0 comments on commit c45d8e1

Please sign in to comment.