X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FParseProperties.java;h=587e501fa877984a76eb7a840a35c56ba60a9f31;hb=cd5b2de469fb4c09242955cb4b74279e2da348d6;hp=c23cb3a39588c493879466cc4a70c21bc8c1c407;hpb=9fe76dc8b685a5a48aeff77c7a9eaf862da3340e;p=jalview.git
diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java
index c23cb3a..587e501 100644
--- a/src/jalview/analysis/ParseProperties.java
+++ b/src/jalview/analysis/ParseProperties.java
@@ -30,14 +30,14 @@ public class ParseProperties
this.al = al;
}
- public int getScoresFromDescription(String ScoreName, String ScoreDescriptions, String regex)
+ public int getScoresFromDescription(String ScoreName, String ScoreDescriptions, String regex, boolean repeat)
{
- return getScoresFromDescription(new String[] { ScoreName }, new String[] { ScoreDescriptions}, regex);
+ return getScoresFromDescription(new String[] { ScoreName }, new String[] { ScoreDescriptions}, regex, repeat);
}
- public int getScoresFromDescription(String[] ScoreNames, String[] ScoreDescriptions, String regex)
+ public int getScoresFromDescription(String[] ScoreNames, String[] ScoreDescriptions, String regex, boolean repeat)
{
- return getScoresFromDescription(al.getSequencesArray(), ScoreNames, ScoreDescriptions, regex);
+ return getScoresFromDescription(al.getSequencesArray(), ScoreNames, ScoreDescriptions, regex, repeat);
}
/**
* Extract scores for sequences by applying regex to description string.
@@ -45,9 +45,10 @@ public class ParseProperties
* @param ScoreNames labels for each numeric field in regex match
* @param ScoreDescriptions description for each numeric field in regex match
* @param regex Regular Expression string for passing to new com.stevesoft.patt.Regex(regex)
+ * @param repeat true means the regex will be applied multiple times along the description string of each sequence
* @return total number of sequences that matched the regex
*/
- public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames, String[] ScoreDescriptions, String regex)
+ public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames, String[] ScoreDescriptions, String regex, boolean repeat)
{
int count=0;
Regex pattern = new Regex(regex);
@@ -76,15 +77,17 @@ public class ParseProperties
String descr = seqs[i].getDescription();
if (descr==null)
continue;
- if (pattern.search(descr))
+ int pos=0;
+ boolean added=false;
+ while ((repeat || pos==0) && pattern.searchFrom(descr, pos))
{
- boolean added=false;
+ pos = pattern.matchedTo();
for (int cols=0; cols