From 5ed9ff1fe7d9c246325a7a84d10c6c6fda6f377a Mon Sep 17 00:00:00 2001 From: "St. Elmo" <stelmozors@gmail.com> Date: Wed, 5 May 2021 15:01:01 +0200 Subject: [PATCH] tests pass, finally! --- src/base/utils/Gene.jl | 7 +------ src/base/utils/Metabolite.jl | 7 +------ src/base/utils/Reaction.jl | 8 ++------ 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/base/utils/Gene.jl b/src/base/utils/Gene.jl index 34e7e2be9..7df6120c6 100644 --- a/src/base/utils/Gene.jl +++ b/src/base/utils/Gene.jl @@ -13,12 +13,7 @@ function check_duplicate_annotations( for (k, gene) in gs if k != check_gene.id for anno in inspect_annotations - if any( - occursin.( - get(gene.annotations, anno, ["c1"]), - get(check_gene.annotations, anno, "c2"), - ), - ) + if !isempty(intersect(get(gene.annotations, anno, ["c1"]), get(check_gene.annotations, anno, "c2"))) return k end end diff --git a/src/base/utils/Metabolite.jl b/src/base/utils/Metabolite.jl index 6c43ec355..be9e444b9 100644 --- a/src/base/utils/Metabolite.jl +++ b/src/base/utils/Metabolite.jl @@ -13,12 +13,7 @@ function check_duplicate_annotations( for (k, met) in mets if met.compartment == cmet.compartment && k != cmet.id for anno in inspect_annotations - if any( - occursin.( - get(met.annotations, anno, ["c1"]), - get(cmet.annotations, anno, ["c2"]), - ), - ) + if !isempty(intersect(get(met.annotations, anno, ["c1"]), get(cmet.annotations, anno, ["c2"]))) return k end end diff --git a/src/base/utils/Reaction.jl b/src/base/utils/Reaction.jl index 0ac095e46..7fb21a5a3 100644 --- a/src/base/utils/Reaction.jl +++ b/src/base/utils/Reaction.jl @@ -42,6 +42,7 @@ end check_duplicate_annotations(rxn::Reaction, rxns::OrderedDict{String, Reaction}; inspect_annotations=_constants.reaction_annotation_checks) Determine if a `rxn` has overlapping annotations in `rxns`. +Only performs check if `id`s do not match. The annotations checked are listed in `COBREXA._constants.reaction_annotation_checks`. Return the `id` of the first hit, otherwise `nothing`. """ @@ -53,12 +54,7 @@ function check_duplicate_annotations( for (k, rxn) in rxns if k != crxn.id for anno in inspect_annotations - if any( - occursin.( - get(crxn.annotations, anno, ["c1"]), - get(rxn.annotations, anno, ["c2"]), - ), - ) + if !isempty(intersect(get(crxn.annotations, anno, ["c1"]), get(rxn.annotations, anno, ["c2"]))) return k end end -- GitLab