git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ac82513
)
find incrementally searches ID then subsequence matches.
author
jprocter
<Jim Procter>
Wed, 28 Apr 2010 14:03:21 +0000
(14:03 +0000)
committer
jprocter
<Jim Procter>
Wed, 28 Apr 2010 14:03:21 +0000
(14:03 +0000)
src/jalview/analysis/Finder.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/Finder.java
b/src/jalview/analysis/Finder.java
index
1fa15e3
..
3d1a70c
100644
(file)
--- a/
src/jalview/analysis/Finder.java
+++ b/
src/jalview/analysis/Finder.java
@@
-44,7
+44,7
@@
public class Finder
/**
* hold's last-searched position between calles to find(false)
*/
/**
* hold's last-searched position between calles to find(false)
*/
- int seqIndex = 0, resIndex = 0;
+ int seqIndex = 0, resIndex = -1;
public Finder(AlignmentI alignment, SequenceGroup selection)
{
public Finder(AlignmentI alignment, SequenceGroup selection)
{
@@
-52,6
+52,13
@@
public class Finder
this.selection = selection;
}
this.selection = selection;
}
+ /**
+ * restart search at given sequence and residue on alignment and (optionally) contained in selection
+ * @param alignment
+ * @param selectionGroup
+ * @param seqIndex
+ * @param resIndex
+ */
public Finder(AlignmentI alignment, SequenceGroup selectionGroup,
int seqIndex, int resIndex)
{
public Finder(AlignmentI alignment, SequenceGroup selectionGroup,
int seqIndex, int resIndex)
{
@@
-116,11
+123,24
@@
public class Finder
&& !selection.getSequences(null).contains(seq))
{
seqIndex++;
&& !selection.getSequences(null).contains(seq))
{
seqIndex++;
- resIndex = 0;
+ resIndex = -1;
continue;
}
continue;
}
-
+ if (resIndex<0) {
+ resIndex=0;
+ if (regex.search(seq.getName()))
+ {
+ idMatch.addElement(seq);
+ hasResults = true;
+ if (!findAll)
+ {
+ // stop and return the match
+ found=true;
+ break;
+ }
+ }
+ }
item = seq.getSequenceAsString();
if ((selection != null)
item = seq.getSequenceAsString();
if ((selection != null)
@@
-194,18
+214,20
@@
public class Finder
if (!found)
{
seqIndex++;
if (!found)
{
seqIndex++;
- resIndex = 0;
+ resIndex = -1;
}
}
}
}
- for (int id = 0; id < alignment.getHeight(); id++)
+ /**
+ * We now search the Id string in the main search loop.
+ * for (int id = 0; id < alignment.getHeight(); id++)
{
if (regex.search(alignment.getSequenceAt(id).getName()))
{
idMatch.addElement(alignment.getSequenceAt(id));
hasResults = true;
}
{
if (regex.search(alignment.getSequenceAt(id).getName()))
{
idMatch.addElement(alignment.getSequenceAt(id));
hasResults = true;
}
- }
+ } */
return hasResults;
}
return hasResults;
}