Skip to content

Commit

Permalink
Consistent properties
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Oct 24, 2024
1 parent a56ebec commit 02266bf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/io/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ end

function ProteinChain{T}(chain::BioStructures.Chain) where T
residues = BioStructures.collectresidues(chain, backbone_residue_selector)
isempty(residues) && return ProteinChain(BioStructures.chainid(chain), Vector{Atom{T}}[], "", Int[])
id = only(unique(map(BioStructures.chainid, residues)))
atoms = get_atoms(Atom{T}, residues)
sequence = get_sequence(residues)
numbering = map(BioStructures.resnumber, residues)
return addproperties(ProteinChain(id, atoms, sequence, numbering);
proteinchain = if isempty(residues)
ProteinChain(BioStructures.chainid(chain), Vector{Atom{T}}[], "", Int[])
else
id = only(unique(map(BioStructures.chainid, residues)))
atoms = get_atoms(Atom{T}, residues)
sequence = get_sequence(residues)
numbering = map(BioStructures.resnumber, residues)
ProteinChain(id, atoms, sequence, numbering)
end
return addproperties(proteinchain;
modelnum = BioStructures.modelnumber(chain),
ins_codes = IndexableProperty(map(Int8 BioStructures.inscode, residues)),
)
Expand Down

0 comments on commit 02266bf

Please sign in to comment.