142 |
10 Aug 06 |
enell |
1 |
/* |
875 |
05 Dec 08 |
jari |
* $Id$ |
875 |
05 Dec 08 |
jari |
3 |
* |
142 |
10 Aug 06 |
enell |
* Copyright (C) 2005 Johan Enell |
875 |
05 Dec 08 |
jari |
* Copyright (C) 2008 Jari Häkkinen |
875 |
05 Dec 08 |
jari |
6 |
|
875 |
05 Dec 08 |
jari |
* This file is part of the se.lu.onk.Center plug-in for |
875 |
05 Dec 08 |
jari |
* BASE. Available at http://baseplugins.thep.lu.se/ and BASE web site |
875 |
05 Dec 08 |
jari |
* is http://base.thep.lu.se |
875 |
05 Dec 08 |
jari |
10 |
|
875 |
05 Dec 08 |
jari |
* This is free software; you can redistribute it and/or modify it |
875 |
05 Dec 08 |
jari |
* under the terms of the GNU General Public License as published by |
875 |
05 Dec 08 |
jari |
* the Free Software Foundation; either version 3 of the License, or |
875 |
05 Dec 08 |
jari |
* (at your option) any later version. |
875 |
05 Dec 08 |
jari |
15 |
|
875 |
05 Dec 08 |
jari |
* The software is distributed in the hope that it will be useful, but |
875 |
05 Dec 08 |
jari |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
875 |
05 Dec 08 |
jari |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
875 |
05 Dec 08 |
jari |
* General Public License for more details. |
875 |
05 Dec 08 |
jari |
20 |
|
142 |
10 Aug 06 |
enell |
* You should have received a copy of the GNU General Public License |
875 |
05 Dec 08 |
jari |
* along with this software. If not, see <http://www.gnu.org/licenses/>. |
142 |
10 Aug 06 |
enell |
23 |
*/ |
142 |
10 Aug 06 |
enell |
24 |
|
875 |
05 Dec 08 |
jari |
25 |
package center; |
875 |
05 Dec 08 |
jari |
26 |
|
142 |
10 Aug 06 |
enell |
27 |
class AssayRow |
142 |
10 Aug 06 |
enell |
28 |
{ |
142 |
10 Aug 06 |
enell |
29 |
public int reporter; |
142 |
10 Aug 06 |
enell |
30 |
|
142 |
10 Aug 06 |
enell |
31 |
public int position, assays; |
142 |
10 Aug 06 |
enell |
32 |
|
142 |
10 Aug 06 |
enell |
33 |
public float[] ratio, A; |
142 |
10 Aug 06 |
enell |
34 |
|
142 |
10 Aug 06 |
enell |
35 |
private boolean allNaN = true; |
142 |
10 Aug 06 |
enell |
36 |
|
142 |
10 Aug 06 |
enell |
37 |
public AssayRow(int position, int reporter, int assays) |
142 |
10 Aug 06 |
enell |
38 |
{ |
142 |
10 Aug 06 |
enell |
39 |
this.reporter = reporter; |
142 |
10 Aug 06 |
enell |
40 |
this.position = position; |
142 |
10 Aug 06 |
enell |
41 |
this.assays = assays; |
142 |
10 Aug 06 |
enell |
42 |
ratio = new float[assays]; |
142 |
10 Aug 06 |
enell |
43 |
A = new float[assays]; |
142 |
10 Aug 06 |
enell |
44 |
} |
142 |
10 Aug 06 |
enell |
45 |
|
142 |
10 Aug 06 |
enell |
46 |
public boolean add(int index, float ratio, float A) |
142 |
10 Aug 06 |
enell |
47 |
{ |
142 |
10 Aug 06 |
enell |
48 |
if (index >= 0 && index < assays) |
142 |
10 Aug 06 |
enell |
49 |
{ |
142 |
10 Aug 06 |
enell |
50 |
this.ratio[index] = ratio; |
142 |
10 Aug 06 |
enell |
51 |
this.A[index] = A; |
142 |
10 Aug 06 |
enell |
52 |
if (!Float.isNaN(ratio) && !Float.isNaN(A)) |
142 |
10 Aug 06 |
enell |
53 |
{ |
142 |
10 Aug 06 |
enell |
54 |
allNaN = false; |
142 |
10 Aug 06 |
enell |
55 |
} |
142 |
10 Aug 06 |
enell |
56 |
return true; |
142 |
10 Aug 06 |
enell |
57 |
} |
142 |
10 Aug 06 |
enell |
58 |
return false; |
142 |
10 Aug 06 |
enell |
59 |
} |
142 |
10 Aug 06 |
enell |
60 |
|
142 |
10 Aug 06 |
enell |
61 |
public boolean valid() |
142 |
10 Aug 06 |
enell |
62 |
{ |
142 |
10 Aug 06 |
enell |
63 |
return !allNaN; |
142 |
10 Aug 06 |
enell |
64 |
} |
142 |
10 Aug 06 |
enell |
65 |
|
142 |
10 Aug 06 |
enell |
66 |
@Override |
142 |
10 Aug 06 |
enell |
67 |
public String toString() |
142 |
10 Aug 06 |
enell |
68 |
{ |
142 |
10 Aug 06 |
enell |
69 |
String ret = position + "\t" + reporter; |
142 |
10 Aug 06 |
enell |
70 |
for(int i = 0; i < assays; i++) |
142 |
10 Aug 06 |
enell |
71 |
{ |
142 |
10 Aug 06 |
enell |
72 |
ret += Float.isNaN(ratio[i]) ? "\t\t" : "\t" + ratio[i] + "\t" + A[i]; |
142 |
10 Aug 06 |
enell |
73 |
} |
142 |
10 Aug 06 |
enell |
74 |
return ret; |
142 |
10 Aug 06 |
enell |
75 |
} |
142 |
10 Aug 06 |
enell |
76 |
} |