Skip to content

Commit

Permalink
Add support for short chains
Browse files Browse the repository at this point in the history
  • Loading branch information
anton083 committed Dec 9, 2023
1 parent 08f068c commit fec6169
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dssp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ function dssp(coords::AbstractArray{T, 3}) where T
@assert size(coords, 1) == 3
@assert size(coords, 2) == 4

N = size(coords, 3)
if N < 6
coords = cat(coords, fill(Inf, 3, 4, 6-N), dims=3)
end

coords = permutedims(coords, (3, 2, 1))

hbmap = _get_hbond_map(coords)
Expand Down Expand Up @@ -114,7 +119,7 @@ function dssp(coords::AbstractArray{T, 3}) where T
strand = ladder
loop = .!helix .& .!strand

num_vector = findfirst.(eachrow(hcat(loop, helix, strand)))
num_vector = findfirst.(eachrow(hcat(loop, helix, strand)))[1:N]

return num_vector
end
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ ss_composition(ss::Vector{Char}) = [count(==(code), ss) for code in ['-', 'H', '

@testset "DSSP" begin

@testset "dssp" begin
coords = load_pdb_backbone_coords("data/1ASS.pdb")[1]
@test AssigningSecondaryStructure.dssp(coords[:, :, 35:39]) == [1, 1, 1, 1, 1] # minimum helix length is 4
@test AssigningSecondaryStructure.dssp(coords[:, :, 35:40]) == [1, 2, 2, 2, 2, 1] # ends don't count towards helix length :shrug:
@test AssigningSecondaryStructure.dssp(coords[:, :, 35:41]) == [1, 2, 2, 2, 2, 2, 1]
end

@testset "1ASS" begin
ss = assign_secondary_structure("data/1ASS.pdb")
@test length(ss) == 1
Expand Down

0 comments on commit fec6169

Please sign in to comment.