From ac160b3302008d5449da5b40248f18bf06563679 Mon Sep 17 00:00:00 2001 From: Daniel Barton Date: Wed, 21 Aug 2013 11:57:21 +0100 Subject: [PATCH] A third commit where there should have been one.... Everything is here now I hope. --- .../data/sequence/RNAStructScoreManager.java | 2 +- datamodel/compbio/data/sequence/ScoreManager.java | 42 ++------------------ 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/datamodel/compbio/data/sequence/RNAStructScoreManager.java b/datamodel/compbio/data/sequence/RNAStructScoreManager.java index 3fb856c..e792969 100644 --- a/datamodel/compbio/data/sequence/RNAStructScoreManager.java +++ b/datamodel/compbio/data/sequence/RNAStructScoreManager.java @@ -38,7 +38,7 @@ public class RNAStructScoreManager extends ScoreManager { this.seqScores = seqScores; } - // I put this in purely because it mirrors a method in ScoreManager, not because I need it :/ + // I put this in purely because it mirrors a method in ScoreManager, not because I need it public static RNAStructScoreManager newInstance(List structs, List> data) { return new RNAStructScoreManager(structs, data); } diff --git a/datamodel/compbio/data/sequence/ScoreManager.java b/datamodel/compbio/data/sequence/ScoreManager.java index c3b6a85..9b1803d 100644 --- a/datamodel/compbio/data/sequence/ScoreManager.java +++ b/datamodel/compbio/data/sequence/ScoreManager.java @@ -36,9 +36,10 @@ public class ScoreManager { @XmlTransient public static final String SINGLE_ENTRY_KEY = "Alignment"; - private List seqScores; + protected List seqScores; - private ScoreManager() { + // Do I have to change this to protected? + protected ScoreManager() { // Default JAXB constructor } @@ -56,27 +57,6 @@ public class ScoreManager { this.seqScores = seqScores; } - /* - * Next constructor added by Daniel - * a constructor for using ScoreManager to represent RNAalifold output - - */ - - public ScoreManager(RNAStruct rnaStruct) { - assert(rnaStruct.getStructs().size() == rnaStruct.getData().size()); - // This had better be used to create a RNAalifold output structure - assert(java.util.regex.Pattern.matches( - "^[\\.)(]*$", rnaStruct.getStructs().get(1))); - List seqScores = new ArrayList(); - - for (int i = 0; i < rnaStruct.getStructs().size(); i++) { - seqScores.add(new ScoreHolder(rnaStruct.getStructs().get(i), - rnaStruct.getData().get(i))); - } - this.seqScores = seqScores; - } - - public static ScoreManager newInstance(Map> data) { return new ScoreManager(data); } @@ -96,19 +76,6 @@ public class ScoreManager { return new ScoreManager(ScoreManager.SINGLE_ENTRY_KEY, new TreeSet(data)); } - - // Also Daniel's. Check this with Jim to make sure that I am not compromising - // the security of this class - public RNAStruct asRNAStruct() { - List structs = new ArrayList(); - List> data = new ArrayList>(); - for (ScoreHolder sch : this.seqScores) { - structs.add(sch.id); - data.add(sch.scores); - } - return new RNAStruct(structs, data); - } - public Map> asMap() { Map> seqScoresMap = new TreeMap>(); @@ -199,8 +166,7 @@ public class ScoreManager { ScoreHolder(String id, Set scores) { this.id = id; - this.scores = new TreeSet(scores); - } + this.scores = new TreeSet(scores); } public void writeOut(Writer writer) throws IOException { writer.write(">" + id + "\n"); -- 1.7.10.2