From 12ba8429c72ec9428f88adb6ae5338a5df63552e Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 25 Sep 2017 14:44:56 +0100 Subject: [PATCH] JAL-2525 return no features if none matches ontology term! --- src/jalview/datamodel/features/SequenceFeatures.java | 8 ++++++++ test/jalview/datamodel/features/SequenceFeaturesTest.java | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 52da8c7..8d5ba58 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -149,6 +149,14 @@ public class SequenceFeatures implements SequenceFeaturesI } Set featureTypes = getFeatureTypes(ontologyTerm); + if (featureTypes.isEmpty()) + { + /* + * no features of the specified type or any sub-type + */ + return new ArrayList<>(); + } + return getAllFeatures(featureTypes.toArray(new String[featureTypes .size()])); } diff --git a/test/jalview/datamodel/features/SequenceFeaturesTest.java b/test/jalview/datamodel/features/SequenceFeaturesTest.java index a144f03..39d6dce 100644 --- a/test/jalview/datamodel/features/SequenceFeaturesTest.java +++ b/test/jalview/datamodel/features/SequenceFeaturesTest.java @@ -1032,6 +1032,9 @@ public class SequenceFeaturesTest assertEquals(features.size(), 2); assertTrue(features.contains(sf2)); assertTrue(features.contains(sf3)); + + features = store.getFeaturesByOntology("sequence_variant"); + assertTrue(features.isEmpty()); } @Test(groups = "Functional") -- 1.7.10.2