X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FFinder.java;h=2dd6a7457d9702f28f4c5592e14173c6b0de8866;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=c584903cdcd91f62f50f6769b0bfa19c93ea49dd;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index c584903..2dd6a74 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -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);