Skip to content

Commit

Permalink
fix same_residue when only segname differs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Nov 29, 2024
1 parent 1328b38 commit 95ce601
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Atom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,20 @@ function same_residue(atom1::Atom, atom2::Atom)
return (atom1.resnum == atom2.resnum) &
(atom1.model == atom2.model) &
(atom1.chain == atom2.chain) &
(atom1.resname == atom2.resname)
(atom1.resname == atom2.resname) &
(atom1.segname == atom2.segname)
end

@testitem "same_residue" begin
pdb = read_pdb(PDBTools.TESTPDB, "protein")
import PDBTools: same_residue
@test same_residue(pdb[1], pdb[2])
@test !same_residue(pdb[1], pdb[50])
at1 = Atom()
at2 = Atom()
@test same_residue(at1, at2)
at2.segname = "B"
@test !same_residue(at1, at2)
end

#
Expand Down

0 comments on commit 95ce601

Please sign in to comment.