git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debug comment out
[jalview.git]
/
src
/
jalview
/
analysis
/
ParseProperties.java
diff --git
a/src/jalview/analysis/ParseProperties.java
b/src/jalview/analysis/ParseProperties.java
index
38d8371
..
9937a47
100644
(file)
--- a/
src/jalview/analysis/ParseProperties.java
+++ b/
src/jalview/analysis/ParseProperties.java
@@
-20,9
+20,12
@@
*/
package jalview.analysis;
*/
package jalview.analysis;
-import com.stevesoft.pat.Regex;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.util.Platform;
-import jalview.datamodel.*;
+import com.stevesoft.pat.Regex;
public class ParseProperties
{
public class ParseProperties
{
@@
-55,9
+58,9
@@
public class ParseProperties
public int getScoresFromDescription(String ScoreName,
String ScoreDescriptions, String regex, boolean repeat)
{
public int getScoresFromDescription(String ScoreName,
String ScoreDescriptions, String regex, boolean repeat)
{
- return getScoresFromDescription(new String[]
- { ScoreName }, new String[]
- { ScoreDescriptions }, regex, repeat);
+ return getScoresFromDescription(new String[] { ScoreName },
+ new String[]
+ { ScoreDescriptions }, regex, repeat);
}
public int getScoresFromDescription(String[] ScoreNames,
}
public int getScoresFromDescription(String[] ScoreNames,
@@
-84,12
+87,11
@@
public class ParseProperties
* description string of each sequence
* @return total number of sequences that matched the regex
*/
* 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,
- boolean repeat)
+ public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames,
+ String[] ScoreDescriptions, String regex, boolean repeat)
{
int count = 0;
{
int count = 0;
- Regex pattern = new Regex(regex);
+ Regex pattern = Platform.newRegex(regex, null);
if (pattern.numSubs() > ScoreNames.length)
{
// Check that we have enough labels and descriptions for any parsed
if (pattern.numSubs() > ScoreNames.length)
{
// Check that we have enough labels and descriptions for any parsed
@@
-101,7
+103,9
@@
public class ParseProperties
ScoreNames = tnames;
String descrbase = ScoreDescriptions[onamelen - 1];
if (descrbase == null)
ScoreNames = tnames;
String descrbase = ScoreDescriptions[onamelen - 1];
if (descrbase == null)
+ {
descrbase = "Score parsed from (" + regex + ")";
descrbase = "Score parsed from (" + regex + ")";
+ }
tnames = new String[pattern.numSubs() + 1];
System.arraycopy(ScoreDescriptions, 0, tnames, 0,
ScoreDescriptions.length);
tnames = new String[pattern.numSubs() + 1];
System.arraycopy(ScoreDescriptions, 0, tnames, 0,
ScoreDescriptions.length);
@@
-116,7
+120,9
@@
public class ParseProperties
{
String descr = seqs[i].getDescription();
if (descr == null)
{
String descr = seqs[i].getDescription();
if (descr == null)
+ {
continue;
continue;
+ }
int pos = 0;
boolean added = false;
int reps = 0;
int pos = 0;
boolean added = false;
int reps = 0;
@@
-136,11
+142,12
@@
public class ParseProperties
continue;
}
// add score to sequence annotation.
continue;
}
// add score to sequence annotation.
- AlignmentAnnotation an = new AlignmentAnnotation(ScoreNames[cols]
- + ((reps > 0) ? "_" + reps : ""),
+ AlignmentAnnotation an = new AlignmentAnnotation(
+ ScoreNames[cols] + ((reps > 0) ? "_" + reps : ""),
ScoreDescriptions[cols], null);
an.setScore(score);
ScoreDescriptions[cols], null);
an.setScore(score);
- System.out.println("Score: " + ScoreNames[cols] + "=" + score); // DEBUG
+ System.out.println(seqs[i].getName() + " score: '"
+ + ScoreNames[cols] + "' = " + score); // DEBUG
an.setSequenceRef(seqs[i]);
seqs[i].addAlignmentAnnotation(an);
al.addAnnotation(an);
an.setSequenceRef(seqs[i]);
seqs[i].addAlignmentAnnotation(an);
al.addAnnotation(an);