5668 |
15 Oct 19 |
nicklas |
1 |
package net.sf.basedb.reggie.ssp; |
5668 |
15 Oct 19 |
nicklas |
2 |
|
5668 |
15 Oct 19 |
nicklas |
3 |
import net.sf.basedb.reggie.dao.Rawbioassay; |
5668 |
15 Oct 19 |
nicklas |
4 |
|
5668 |
15 Oct 19 |
nicklas |
5 |
/** |
5668 |
15 Oct 19 |
nicklas |
Holds the result for a specified model applied to a raw bioassay. |
5668 |
15 Oct 19 |
nicklas |
@since 4.24 |
5668 |
15 Oct 19 |
nicklas |
8 |
*/ |
5668 |
15 Oct 19 |
nicklas |
9 |
public class SspModelResult |
5668 |
15 Oct 19 |
nicklas |
10 |
{ |
5668 |
15 Oct 19 |
nicklas |
11 |
|
5668 |
15 Oct 19 |
nicklas |
12 |
private final Rawbioassay raw; |
5668 |
15 Oct 19 |
nicklas |
13 |
private final SspModel model; |
5668 |
15 Oct 19 |
nicklas |
14 |
private final String result; |
5668 |
15 Oct 19 |
nicklas |
15 |
|
5937 |
15 May 20 |
nicklas |
16 |
private final String resultClass; |
5937 |
15 May 20 |
nicklas |
17 |
private final String allScores; |
5937 |
15 May 20 |
nicklas |
//private final Map<String, Float> scores; |
5937 |
15 May 20 |
nicklas |
19 |
|
5668 |
15 Oct 19 |
nicklas |
20 |
public SspModelResult(Rawbioassay raw, SspModel model, String result) |
5668 |
15 Oct 19 |
nicklas |
21 |
{ |
5668 |
15 Oct 19 |
nicklas |
22 |
this.raw = raw; |
5668 |
15 Oct 19 |
nicklas |
23 |
this.model = model; |
5668 |
15 Oct 19 |
nicklas |
24 |
this.result = result; |
5937 |
15 May 20 |
nicklas |
25 |
|
5937 |
15 May 20 |
nicklas |
26 |
String[] tmp = result.split("\\;", 2); |
5937 |
15 May 20 |
nicklas |
27 |
this.resultClass = tmp[0]; |
5937 |
15 May 20 |
nicklas |
28 |
this.allScores = tmp[1].strip(); |
5937 |
15 May 20 |
nicklas |
29 |
/* |
5937 |
15 May 20 |
nicklas |
TODO -- extract indivudual scores ?? |
5937 |
15 May 20 |
nicklas |
tmp = allScores.split("\\;"); |
5937 |
15 May 20 |
nicklas |
this.scores = new TreeMap<String, Float>(); |
5937 |
15 May 20 |
nicklas |
for (String t : tmp) |
5937 |
15 May 20 |
nicklas |
34 |
{ |
5937 |
15 May 20 |
nicklas |
String[] s = t.split("\\="); |
5937 |
15 May 20 |
nicklas |
scores.put(s[0], Float.parseFloat(s[1])); |
5937 |
15 May 20 |
nicklas |
37 |
} |
5937 |
15 May 20 |
nicklas |
38 |
*/ |
5668 |
15 Oct 19 |
nicklas |
39 |
} |
5668 |
15 Oct 19 |
nicklas |
40 |
|
5668 |
15 Oct 19 |
nicklas |
41 |
public Rawbioassay getRawbioassay() |
5668 |
15 Oct 19 |
nicklas |
42 |
{ |
5668 |
15 Oct 19 |
nicklas |
43 |
return raw; |
5668 |
15 Oct 19 |
nicklas |
44 |
} |
5668 |
15 Oct 19 |
nicklas |
45 |
|
5668 |
15 Oct 19 |
nicklas |
46 |
public SspModel getModel() |
5668 |
15 Oct 19 |
nicklas |
47 |
{ |
5668 |
15 Oct 19 |
nicklas |
48 |
return model; |
5668 |
15 Oct 19 |
nicklas |
49 |
} |
5668 |
15 Oct 19 |
nicklas |
50 |
|
5668 |
15 Oct 19 |
nicklas |
51 |
public String getResult() |
5668 |
15 Oct 19 |
nicklas |
52 |
{ |
5668 |
15 Oct 19 |
nicklas |
53 |
return result; |
5668 |
15 Oct 19 |
nicklas |
54 |
} |
5668 |
15 Oct 19 |
nicklas |
55 |
|
5937 |
15 May 20 |
nicklas |
56 |
public String getResultClass() |
5937 |
15 May 20 |
nicklas |
57 |
{ |
5937 |
15 May 20 |
nicklas |
58 |
return resultClass; |
5937 |
15 May 20 |
nicklas |
59 |
} |
5937 |
15 May 20 |
nicklas |
60 |
|
5937 |
15 May 20 |
nicklas |
61 |
public String getAllScores() |
5937 |
15 May 20 |
nicklas |
62 |
{ |
5937 |
15 May 20 |
nicklas |
63 |
return allScores; |
5937 |
15 May 20 |
nicklas |
64 |
} |
5937 |
15 May 20 |
nicklas |
65 |
/* |
5937 |
15 May 20 |
nicklas |
public Set<String> getClasses() |
5937 |
15 May 20 |
nicklas |
67 |
{ |
5937 |
15 May 20 |
nicklas |
return Collections.unmodifiableSet(scores.keySet()); |
5937 |
15 May 20 |
nicklas |
69 |
} |
5937 |
15 May 20 |
nicklas |
70 |
|
5937 |
15 May 20 |
nicklas |
public Float getScore(String className) |
5937 |
15 May 20 |
nicklas |
72 |
{ |
5937 |
15 May 20 |
nicklas |
return scores.get(className); |
5937 |
15 May 20 |
nicklas |
74 |
} |
5937 |
15 May 20 |
nicklas |
75 |
*/ |
5668 |
15 Oct 19 |
nicklas |
76 |
} |