Skip to content

Commit 944e1ca

Browse files
committed
brackets round ternary expressions
1 parent 27e02c7 commit 944e1ca

File tree

6 files changed

+17
-18
lines changed

6 files changed

+17
-18
lines changed

ext/BioStructuresMMTFExt.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function BioStructures.writemmtf(output::Union{AbstractString, IO},
197197
atom_selectors::Function...;
198198
expand_disordered::Bool=true,
199199
gzip::Bool=false)
200-
loop_el = isa(el, MolecularStructure) ? collectmodels(el) : el
200+
loop_el = (isa(el, MolecularStructure) ? collectmodels(el) : el)
201201
ats = sort(sort(sort(collectatoms(loop_el, atom_selectors...;
202202
expand_disordered=expand_disordered)),
203203
by=residue), by=model)
@@ -251,7 +251,7 @@ function BioStructures.writemmtf(output::Union{AbstractString, IO},
251251
"chainIndexList" => Any[length(d["chainIdList"]) - 1],
252252
"description" => "",
253253
"sequence" => "", # This is changed later
254-
"type" => ishetero(res) ? "non-polymer" : "polymer",
254+
"type" => (ishetero(res) ? "non-polymer" : "polymer"),
255255
))
256256
end
257257
if !ishetero(res)
@@ -286,7 +286,7 @@ function BioStructures.writemmtf(output::Union{AbstractString, IO},
286286
"bondAtomList" => Any[],
287287
"elementList" => Any[element(at) for at in ats_res],
288288
# MMTF specifies missing charges as zero
289-
"formalChargeList" => Any[charge(at) == "" ? 0 : parse(Int64, charge(at)) for at in ats_res],
289+
"formalChargeList" => Any[(charge(at) == "" ? 0 : parse(Int64, charge(at))) for at in ats_res],
290290
"singleLetterCode" => "",
291291
"chemCompType" => "",
292292
"atomNameList" => Any[at_names...],
@@ -295,17 +295,17 @@ function BioStructures.writemmtf(output::Union{AbstractString, IO},
295295
end
296296

297297
push!(d["groupIdList"], resnumber(res))
298-
push!(d["groupTypeList"], group_i == 0 ? length(d["groupList"]) - 1 : group_i - 1)
299-
push!(d["insCodeList"], inscode(res) == ' ' ? '\0' : inscode(res))
298+
push!(d["groupTypeList"], (group_i == 0 ? length(d["groupList"]) - 1 : group_i - 1))
299+
push!(d["insCodeList"], (inscode(res) == ' ' ? '\0' : inscode(res)))
300300
push!(d["secStructList"], -1)
301-
push!(d["sequenceIndexList"], ishetero(res) ? -1 : length(sequence) - 1)
301+
push!(d["sequenceIndexList"], (ishetero(res) ? -1 : length(sequence) - 1))
302302

303303
prev_resname = resname(res)
304304
prev_het = ishetero(res)
305305
last_res = res
306306
end
307307

308-
push!(d["altLocList"], altlocid(at) == ' ' ? '\0' : altlocid(at))
308+
push!(d["altLocList"], (altlocid(at) == ' ' ? '\0' : altlocid(at)))
309309
push!(d["atomIdList"], serial(at))
310310
push!(d["bFactorList"], tempfactor(at))
311311
push!(d["occupancyList"], occupancy(at))

extractdata/bonding.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function parsexmlline(f, line, tag, keyname)
3838
return key => (; vals...)
3939
end
4040

41-
4241
atomtypes, residues = open("protein.ff14SB.xml", "r") do io
4342
line = readline(io)
4443
@assert line == "<ForceField>"

src/mmcif.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ function writemmcif(output::IO,
573573
atom_selectors::Function...;
574574
expand_disordered::Bool=true, gzip::Bool=false)
575575
# Ensure multiple models get written out correctly
576-
loop_el = isa(el, MolecularStructure) ? collectmodels(el) : el
576+
loop_el = (isa(el, MolecularStructure) ? collectmodels(el) : el)
577577
ats = collectatoms(loop_el, atom_selectors...;
578578
expand_disordered=expand_disordered)
579579
if length(ats) > 0
@@ -590,7 +590,7 @@ function writemmcif(output::IO,
590590
appendatom!(atom_dict, at, string(modelnumber(at)),
591591
strip(chainid(at)) == "" ? "." : chainid(at),
592592
string(resnumber(at)), resname(at),
593-
ishetero(at) ? "HETATM" : "ATOM")
593+
(ishetero(at) ? "HETATM" : "ATOM"))
594594
end
595595

596596
# Now the MMCIFDict has been generated, write it out to the file

src/model.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function Residue(r::Residue, ch::StructuralElement)
152152
rnew = Residue(r.name, r.number, r.ins_code, r.het_res, [name for name in r.atom_list],
153153
atom_dict, ch, r.ss_code)
154154
for (name, atom) in r.atoms
155-
atom_dict[name] = isa(atom, Atom) ? Atom(atom, rnew) : DisorderedAtom(atom, rnew)
155+
atom_dict[name] = (isa(atom, Atom) ? Atom(atom, rnew) : DisorderedAtom(atom, rnew))
156156
end
157157
return rnew
158158
end
@@ -182,7 +182,7 @@ function Chain(c::Chain, mo::StructuralElement)
182182
res_dict = Dict{String, AbstractResidue}()
183183
cnew = Chain(c.id, [id for id in c.res_list], res_dict, mo)
184184
for (id, res) in c.residues
185-
res_dict[id] = isa(res, Residue) ? Residue(res, cnew) : DisorderedResidue(res, cnew)
185+
res_dict[id] = (isa(res, Residue) ? Residue(res, cnew) : DisorderedResidue(res, cnew))
186186
end
187187
return cnew
188188
end
@@ -1411,7 +1411,7 @@ function collectresidues(el::Union{Chain, Vector{<:AbstractResidue}};
14111411
end
14121412
return res_list
14131413
else
1414-
return isa(el, Chain) ? collect(el) : el
1414+
return (isa(el, Chain) ? collect(el) : el)
14151415
end
14161416
end
14171417

@@ -1505,7 +1505,7 @@ function collectatoms(el::Union{Residue, Vector{<:AbstractAtom}};
15051505
end
15061506
return at_list
15071507
else
1508-
return isa(el, Residue) ? collect(el) : el
1508+
return (isa(el, Residue) ? collect(el) : el)
15091509
end
15101510
end
15111511

src/pdb.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ end
201201

202202
function parseoccupancy(line::String)
203203
ret = tryparse(Float64, line[55:60])
204-
return ret === nothing ? 1.0 : ret
204+
return (ret === nothing ? 1.0 : ret)
205205
end
206206

207207
function parsetempfac(line::String)
208208
ret = tryparse(Float64, line[61:66])
209-
return ret === nothing ? 0.0 : ret
209+
return (ret === nothing ? 0.0 : ret)
210210
end
211211

212212
function parseelement(line::String)

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,7 @@ end
24262426
]
24272427
# Read from file - write a small multicif manually and read it back
24282428
for gzip in (false, true)
2429-
transcoder = gzip ? (GzipCompressorStream,) : ()
2429+
transcoder = (gzip ? (GzipCompressorStream,) : ())
24302430
open(transcoder..., temp_filename, "w") do f_out
24312431
open(testfilepath("mmCIF", "1AKE.cif")) do f_in
24322432
write(f_out, f_in)
@@ -3192,7 +3192,7 @@ end
31923192
@test isapprox(omegas[10], omegaangle(struc_1AKE['A'], 10), atol=1e-5)
31933193

31943194
# Test that the entries in `chitables` are bonded
3195-
sortt((a, b)) = a < b ? (a, b) : (b, a)
3195+
sortt((a, b)) = (a < b ? (a, b) : (b, a))
31963196
rd = BioStructures.residuedata
31973197
for ct in BioStructures.chitables
31983198
for (rname, alist) in ct

0 commit comments

Comments
 (0)