diff --git a/README.md b/README.md index 8d0dc50..500d16f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/AssigningSecondaryStructure.jl b/src/AssigningSecondaryStructure.jl index 608049f..d8e2f37 100644 --- a/src/AssigningSecondaryStructure.jl +++ b/src/AssigningSecondaryStructure.jl @@ -1,7 +1,5 @@ module AssigningSecondaryStructure -export dssp - include("utils.jl") include("dssp.jl") include("pdb.jl") diff --git a/src/dssp.jl b/src/dssp.jl index c26ff94..33166a6 100644 --- a/src/dssp.jl +++ b/src/dssp.jl @@ -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 diff --git a/src/pdb.jl b/src/pdb.jl index ee4ba3f..9bae0e8 100644 --- a/src/pdb.jl +++ b/src/pdb.jl @@ -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) @@ -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))