From 9ba5c46b6fb472ffa1a9299e98d1825f61557c53 Mon Sep 17 00:00:00 2001 From: jprocter Date: Sun, 27 Feb 2011 18:37:45 +0000 Subject: [PATCH] patch for JAL-780 --- src/jalview/analysis/Finder.java | 45 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 41d3185..1179435 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -82,31 +82,11 @@ public class Finder Sequence seq; String item = null; boolean found = false; + int end = alignment.getHeight(); - // //// is the searchString a residue number? - try - { - int res = Integer.parseInt(searchString); - found = true; - if (selection == null || selection.getSize() < 1) - { - seq = (Sequence) alignment.getSequenceAt(0); - } - else - { - seq = (Sequence) (selection.getSequenceAt(0)); - } - - searchResults.addResult(seq, res, res); - hasResults = true; - } catch (NumberFormatException ex) - { - } // ///////////////////////////////////////////// - int end = alignment.getHeight(); - if (selection != null) { if ((selection.getSize() < 1) @@ -119,7 +99,7 @@ public class Finder while (!found && (seqIndex < end)) { seq = (Sequence) alignment.getSequenceAt(seqIndex); - + if ((selection != null && selection.getSize() > 0) && !selection.getSequences(null).contains(seq)) { @@ -131,6 +111,27 @@ public class Finder if (resIndex < 0) { resIndex = 0; + // test for one off matches - sequence position and sequence ID + // //// is the searchString a residue number? + try + { + int res = Integer.parseInt(searchString); + // possibly a residue number - check if valid for seq + if (seq.getEnd() >= res) + { + searchResults.addResult(seq, res, res); + hasResults = true; + //resIndex=seq.getLength(); + // seqIndex++; + if (!findAll) { + found = true; + break; + } + } + } catch (NumberFormatException ex) + { + } + if (regex.search(seq.getName())) { idMatch.addElement(seq); -- 1.7.10.2