546 |
18 Jan 08 |
nicklas |
1 |
/** |
566 |
01 Feb 08 |
nicklas |
$Id$ |
546 |
18 Jan 08 |
nicklas |
3 |
|
646 |
10 Apr 08 |
jari |
Copyright (C) 2008 Nicklas Nordborg |
546 |
18 Jan 08 |
nicklas |
5 |
|
546 |
18 Jan 08 |
nicklas |
This file is part of Illumina plug-in package for BASE. |
546 |
18 Jan 08 |
nicklas |
Available at http://baseplugins.thep.lu.se/ |
546 |
18 Jan 08 |
nicklas |
BASE main site: http://base.thep.lu.se/ |
546 |
18 Jan 08 |
nicklas |
9 |
|
941 |
27 Jan 09 |
martin |
This is a free software; you can redistribute it and/or modify it |
940 |
27 Jan 09 |
martin |
under the terms of the GNU General Public License as published by |
940 |
27 Jan 09 |
martin |
the Free Software Foundation; either version 3 of the License, or |
940 |
27 Jan 09 |
martin |
(at your option) any later version. |
940 |
27 Jan 09 |
martin |
14 |
|
941 |
27 Jan 09 |
martin |
This software is distributed in the hope that it will be useful, but |
940 |
27 Jan 09 |
martin |
WITHOUT ANY WARRANTY; without even the implied warranty of |
940 |
27 Jan 09 |
martin |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
940 |
27 Jan 09 |
martin |
General Public License for more details. |
940 |
27 Jan 09 |
martin |
19 |
|
546 |
18 Jan 08 |
nicklas |
You should have received a copy of the GNU General Public License |
940 |
27 Jan 09 |
martin |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
546 |
18 Jan 08 |
nicklas |
22 |
*/ |
546 |
18 Jan 08 |
nicklas |
23 |
package net.sf.basedb.illumina.install; |
546 |
18 Jan 08 |
nicklas |
24 |
|
1385 |
02 Sep 11 |
martin |
25 |
import java.util.ArrayList; |
1385 |
02 Sep 11 |
martin |
26 |
import java.util.Arrays; |
1385 |
02 Sep 11 |
martin |
27 |
import java.util.Collection; |
1385 |
02 Sep 11 |
martin |
28 |
import java.util.Collections; |
1385 |
02 Sep 11 |
martin |
29 |
import java.util.EnumSet; |
1385 |
02 Sep 11 |
martin |
30 |
import java.util.HashMap; |
1385 |
02 Sep 11 |
martin |
31 |
import java.util.HashSet; |
1385 |
02 Sep 11 |
martin |
32 |
import java.util.Iterator; |
1385 |
02 Sep 11 |
martin |
33 |
import java.util.List; |
1385 |
02 Sep 11 |
martin |
34 |
import java.util.Map; |
1385 |
02 Sep 11 |
martin |
35 |
import java.util.Set; |
1385 |
02 Sep 11 |
martin |
36 |
|
546 |
18 Jan 08 |
nicklas |
37 |
import net.sf.basedb.core.BaseException; |
626 |
12 Mar 08 |
nicklas |
38 |
import net.sf.basedb.core.Coloring; |
551 |
24 Jan 08 |
martin |
39 |
import net.sf.basedb.core.DataFileType; |
551 |
24 Jan 08 |
martin |
40 |
import net.sf.basedb.core.DbControl; |
681 |
29 Apr 08 |
jari |
41 |
import net.sf.basedb.core.ExtraValueType; |
1385 |
02 Sep 11 |
martin |
42 |
import net.sf.basedb.core.File; |
626 |
12 Mar 08 |
nicklas |
43 |
import net.sf.basedb.core.Formula; |
577 |
08 Feb 08 |
martin |
44 |
import net.sf.basedb.core.Hardware; |
551 |
24 Jan 08 |
martin |
45 |
import net.sf.basedb.core.InvalidDataException; |
546 |
18 Jan 08 |
nicklas |
46 |
import net.sf.basedb.core.Item; |
551 |
24 Jan 08 |
martin |
47 |
import net.sf.basedb.core.ItemAlreadyExistsException; |
554 |
25 Jan 08 |
martin |
48 |
import net.sf.basedb.core.ItemNotFoundException; |
1385 |
02 Sep 11 |
martin |
49 |
import net.sf.basedb.core.ItemSubtype; |
583 |
12 Feb 08 |
nicklas |
50 |
import net.sf.basedb.core.Job; |
551 |
24 Jan 08 |
martin |
51 |
import net.sf.basedb.core.Permission; |
551 |
24 Jan 08 |
martin |
52 |
import net.sf.basedb.core.Platform; |
1386 |
06 Sep 11 |
nicklas |
53 |
import net.sf.basedb.core.PlatformFileType; |
551 |
24 Jan 08 |
martin |
54 |
import net.sf.basedb.core.PlatformVariant; |
546 |
18 Jan 08 |
nicklas |
55 |
import net.sf.basedb.core.PluginDefinition; |
551 |
24 Jan 08 |
martin |
56 |
import net.sf.basedb.core.PluginParameter; |
546 |
18 Jan 08 |
nicklas |
57 |
import net.sf.basedb.core.ProgressReporter; |
551 |
24 Jan 08 |
martin |
58 |
import net.sf.basedb.core.RawDataType; |
546 |
18 Jan 08 |
nicklas |
59 |
import net.sf.basedb.core.RequestInformation; |
583 |
12 Feb 08 |
nicklas |
60 |
import net.sf.basedb.core.Software; |
551 |
24 Jan 08 |
martin |
61 |
import net.sf.basedb.core.StringParameterType; |
555 |
28 Jan 08 |
martin |
62 |
import net.sf.basedb.core.SystemItems; |
681 |
29 Apr 08 |
jari |
63 |
import net.sf.basedb.core.Type; |
546 |
18 Jan 08 |
nicklas |
64 |
import net.sf.basedb.core.plugin.AbstractPlugin; |
546 |
18 Jan 08 |
nicklas |
65 |
import net.sf.basedb.core.plugin.GuiContext; |
546 |
18 Jan 08 |
nicklas |
66 |
import net.sf.basedb.core.plugin.InteractivePlugin; |
551 |
24 Jan 08 |
martin |
67 |
import net.sf.basedb.core.plugin.Permissions; |
546 |
18 Jan 08 |
nicklas |
68 |
import net.sf.basedb.core.plugin.Plugin; |
546 |
18 Jan 08 |
nicklas |
69 |
import net.sf.basedb.core.plugin.Request; |
546 |
18 Jan 08 |
nicklas |
70 |
import net.sf.basedb.core.plugin.Response; |
556 |
28 Jan 08 |
nicklas |
71 |
import net.sf.basedb.illumina.Illumina; |
546 |
18 Jan 08 |
nicklas |
72 |
|
546 |
18 Jan 08 |
nicklas |
73 |
/** |
546 |
18 Jan 08 |
nicklas |
74 |
|
546 |
18 Jan 08 |
nicklas |
Installation program for the Illumina plug-ins package. The installation |
623 |
10 Mar 08 |
martin |
will perform the following steps, which most of them are optional: |
546 |
18 Jan 08 |
nicklas |
77 |
|
546 |
18 Jan 08 |
nicklas |
<ul> |
546 |
18 Jan 08 |
nicklas |
<li>Register the following data file types: |
551 |
24 Jan 08 |
martin |
<ul> |
814 |
19 Nov 08 |
nicklas |
<li>Illumina Sentrix Array binary manifest(BGX). |
572 |
06 Feb 08 |
martin |
<li>Illumina Bead Summary(IBS). |
623 |
10 Mar 08 |
martin |
<li>Illumina SNP manifest file (CVS) |
623 |
10 Mar 08 |
martin |
<li>Illumina SNP data file |
623 |
10 Mar 08 |
martin |
<li>Illumina SNP split data file |
546 |
18 Jan 08 |
nicklas |
86 |
|
572 |
06 Feb 08 |
martin |
<li>Create the <code>Illumina</code> platform with three |
572 |
06 Feb 08 |
martin |
variants <code>Expression1</code>, <code>Expression2</code> |
623 |
10 Mar 08 |
martin |
and <code>SNP</code>. The first two variants is then set to require one |
572 |
06 Feb 08 |
martin |
BGX data file type and at least one IBS data file type. The amount of |
623 |
10 Mar 08 |
martin |
IBS files depends on how many strips there are on one array slide.<br> |
623 |
10 Mar 08 |
martin |
The SNP variant is set to require the manifest file and split data file. |
623 |
10 Mar 08 |
martin |
Original SNP data file is set to be optional. |
623 |
10 Mar 08 |
martin |
94 |
|
626 |
12 Mar 08 |
nicklas |
<li>Optionally, hardwares, softwares and other items, that in some way are associated with |
623 |
10 Mar 08 |
martin |
one or more of the variants, will be created next. |
626 |
12 Mar 08 |
nicklas |
97 |
|
681 |
29 Apr 08 |
jari |
<li>Create <code>IlluminaDetectionPValue</code> ExtraValueType |
681 |
29 Apr 08 |
jari |
required for the 'Illumina detection P-value calculation' plug-in. |
681 |
29 Apr 08 |
jari |
100 |
|
626 |
12 Mar 08 |
nicklas |
<li>Create formulas for the 3 SNP channels: |
626 |
12 Mar 08 |
nicklas |
<ul> |
626 |
12 Mar 08 |
nicklas |
<li>GType = ch(1) |
626 |
12 Mar 08 |
nicklas |
<li>Log R Ratio = ch(2) |
626 |
12 Mar 08 |
nicklas |
<li>B Allele Freq = ch(2) |
626 |
12 Mar 08 |
nicklas |
</ul> |
626 |
12 Mar 08 |
nicklas |
107 |
|
546 |
18 Jan 08 |
nicklas |
</ul> |
546 |
18 Jan 08 |
nicklas |
109 |
*/ |
546 |
18 Jan 08 |
nicklas |
110 |
public class Install |
546 |
18 Jan 08 |
nicklas |
111 |
extends AbstractPlugin |
546 |
18 Jan 08 |
nicklas |
112 |
implements InteractivePlugin |
546 |
18 Jan 08 |
nicklas |
113 |
{ |
546 |
18 Jan 08 |
nicklas |
114 |
|
546 |
18 Jan 08 |
nicklas |
115 |
private static final Set<GuiContext> guiContexts = |
546 |
18 Jan 08 |
nicklas |
116 |
Collections.singleton(new GuiContext(Item.PLUGINDEFINITION, GuiContext.Type.ITEM)); |
551 |
24 Jan 08 |
martin |
117 |
|
551 |
24 Jan 08 |
martin |
118 |
private RequestInformation configureJob = null; |
546 |
18 Jan 08 |
nicklas |
119 |
|
551 |
24 Jan 08 |
martin |
120 |
private static final Set<Permissions> permissions = new HashSet<Permissions>(); |
572 |
06 Feb 08 |
martin |
121 |
|
589 |
20 Feb 08 |
martin |
122 |
private PluginParameter<String> installSnpVariantParameter; |
577 |
08 Feb 08 |
martin |
123 |
private PluginParameter<String> installExp1VariantParameter; |
577 |
08 Feb 08 |
martin |
124 |
private PluginParameter<String> installExp2VariantParameter; |
577 |
08 Feb 08 |
martin |
125 |
|
681 |
29 Apr 08 |
jari |
126 |
private PluginParameter<String> installDetectionPValueParameter; |
681 |
29 Apr 08 |
jari |
127 |
|
577 |
08 Feb 08 |
martin |
128 |
private PluginParameter<String> installScannerParameter; |
577 |
08 Feb 08 |
martin |
129 |
private PluginParameter<String> scannerNameParameter; |
577 |
08 Feb 08 |
martin |
130 |
private PluginParameter<String> scannerVersionParameter; |
583 |
12 Feb 08 |
nicklas |
131 |
private PluginParameter<String> scannerDescriptionParameter; |
583 |
12 Feb 08 |
nicklas |
132 |
private PluginParameter<String> installSoftwareParameter; |
583 |
12 Feb 08 |
nicklas |
133 |
private PluginParameter<String> softwareNameParameter; |
583 |
12 Feb 08 |
nicklas |
134 |
private PluginParameter<String> softwareVersionParameter; |
583 |
12 Feb 08 |
nicklas |
135 |
private PluginParameter<String> softwareDescriptionParameter; |
577 |
08 Feb 08 |
martin |
136 |
|
577 |
08 Feb 08 |
martin |
137 |
|
577 |
08 Feb 08 |
martin |
//Parameter section headers |
577 |
08 Feb 08 |
martin |
139 |
private static final PluginParameter<String> variantSection = new PluginParameter<String> |
551 |
24 Jan 08 |
martin |
140 |
( |
577 |
08 Feb 08 |
martin |
141 |
"variantSection", |
583 |
12 Feb 08 |
nicklas |
142 |
"Illumina platform variants", |
577 |
08 Feb 08 |
martin |
143 |
"Variants available to be installed", |
577 |
08 Feb 08 |
martin |
144 |
null |
577 |
08 Feb 08 |
martin |
145 |
); |
681 |
29 Apr 08 |
jari |
146 |
private static final PluginParameter<String> extraValueTypeSection = new PluginParameter<String> |
681 |
29 Apr 08 |
jari |
147 |
( |
681 |
29 Apr 08 |
jari |
148 |
"extraValueTypeSection", |
681 |
29 Apr 08 |
jari |
149 |
"ExtraValueTypes", |
681 |
29 Apr 08 |
jari |
150 |
"Extra values required by some Illumina plug-ins", |
681 |
29 Apr 08 |
jari |
151 |
null |
681 |
29 Apr 08 |
jari |
152 |
); |
577 |
08 Feb 08 |
martin |
153 |
private static final PluginParameter<String> hardwareSection = new PluginParameter<String> |
551 |
24 Jan 08 |
martin |
154 |
( |
577 |
08 Feb 08 |
martin |
155 |
"hardwareSection", |
583 |
12 Feb 08 |
nicklas |
156 |
"Scanner & Software", |
583 |
12 Feb 08 |
nicklas |
157 |
"The scanner and software used with the Illumina platform", |
577 |
08 Feb 08 |
martin |
158 |
null |
551 |
24 Jan 08 |
martin |
159 |
); |
577 |
08 Feb 08 |
martin |
160 |
private static final PluginParameter<String> errorSection = new PluginParameter<String> |
577 |
08 Feb 08 |
martin |
161 |
( |
577 |
08 Feb 08 |
martin |
162 |
"errorSection", |
577 |
08 Feb 08 |
martin |
163 |
"Error handling", |
577 |
08 Feb 08 |
martin |
164 |
"Settings how to handling when errors occur", |
577 |
08 Feb 08 |
martin |
165 |
null |
577 |
08 Feb 08 |
martin |
166 |
); |
551 |
24 Jan 08 |
martin |
167 |
|
551 |
24 Jan 08 |
martin |
168 |
public static final String SKIP_OPTION = "skip"; |
551 |
24 Jan 08 |
martin |
169 |
public static final String ABORT_OPTION = "abort"; |
551 |
24 Jan 08 |
martin |
170 |
|
577 |
08 Feb 08 |
martin |
171 |
private static final String YES_OPTION = "yes"; |
577 |
08 Feb 08 |
martin |
172 |
private static final String NO_OPTION = "no"; |
577 |
08 Feb 08 |
martin |
173 |
|
551 |
24 Jan 08 |
martin |
174 |
private static final String BGX_FILEYTPE_EXTENSION = "bgx"; |
572 |
06 Feb 08 |
martin |
175 |
private static final String BEAD_SUMMARY_FILETYPE_EXTENSION = "csv"; |
589 |
20 Feb 08 |
martin |
176 |
private static final String SNP_MF_FILETYPE_EXTENSION = "csv"; |
589 |
20 Feb 08 |
martin |
177 |
private static final String SNP_SPLITDATA_FILETYPE_EXTENSION = "split"; |
589 |
20 Feb 08 |
martin |
178 |
|
551 |
24 Jan 08 |
martin |
179 |
private static final PluginParameter<String> alreadyInstalledErrorParameter = new PluginParameter<String>( |
551 |
24 Jan 08 |
martin |
180 |
"alreadyInstalledError", |
555 |
28 Jan 08 |
martin |
181 |
"Item already exists.", |
583 |
12 Feb 08 |
nicklas |
182 |
"How to act when an external id is taken for either the platform or " + |
583 |
12 Feb 08 |
nicklas |
183 |
"any of the selected variants.\n\n" + |
551 |
24 Jan 08 |
martin |
184 |
"abort = Abort the installation, nothing will be created.\n" + |
555 |
28 Jan 08 |
martin |
185 |
"skip = The installation will skip the existing item " + |
555 |
28 Jan 08 |
martin |
186 |
"and try to proceed.", |
551 |
24 Jan 08 |
martin |
187 |
new StringParameterType(255, SKIP_OPTION, true, 1, 0, 0, |
551 |
24 Jan 08 |
martin |
188 |
Arrays.asList( new String[] { ABORT_OPTION, SKIP_OPTION})) |
551 |
24 Jan 08 |
martin |
189 |
); |
551 |
24 Jan 08 |
martin |
190 |
|
546 |
18 Jan 08 |
nicklas |
191 |
public Install() |
546 |
18 Jan 08 |
nicklas |
192 |
{} |
546 |
18 Jan 08 |
nicklas |
193 |
|
546 |
18 Jan 08 |
nicklas |
194 |
/* |
546 |
18 Jan 08 |
nicklas |
From the Plugin interface |
546 |
18 Jan 08 |
nicklas |
196 |
------------------------------------------- |
546 |
18 Jan 08 |
nicklas |
197 |
*/ |
546 |
18 Jan 08 |
nicklas |
198 |
@Override |
551 |
24 Jan 08 |
martin |
199 |
public Collection<Permissions> getPermissions() |
551 |
24 Jan 08 |
martin |
200 |
{ |
551 |
24 Jan 08 |
martin |
201 |
if (permissions.size() == 0) |
551 |
24 Jan 08 |
martin |
202 |
{ |
815 |
19 Nov 08 |
martin |
203 |
permissions.add(new Permissions(Item.PLATFORM, null, EnumSet.of(Permission.CREATE, Permission.WRITE))); |
815 |
19 Nov 08 |
martin |
204 |
permissions.add(new Permissions(Item.DATAFILETYPE, null, EnumSet.of(Permission.WRITE, Permission.CREATE))); |
681 |
29 Apr 08 |
jari |
205 |
permissions.add(new Permissions(Item.EXTRAVALUETYPE, null, EnumSet.of(Permission.CREATE))); |
815 |
19 Nov 08 |
martin |
206 |
permissions.add(new Permissions(Item.PLUGINDEFINITION, null, EnumSet.of(Permission.READ))); |
1385 |
02 Sep 11 |
martin |
207 |
permissions.add(new Permissions(Item.ITEMSUBTYPE, null, EnumSet.of(Permission.READ))); |
1385 |
02 Sep 11 |
martin |
208 |
permissions.add(new Permissions(Item.HARDWARE, null, EnumSet.of(Permission.CREATE))); |
815 |
19 Nov 08 |
martin |
209 |
permissions.add(new Permissions(Item.SOFTWARE, null, EnumSet.of(Permission.CREATE))); |
815 |
19 Nov 08 |
martin |
210 |
permissions.add(new Permissions(Item.FORMULA, null, EnumSet.of(Permission.CREATE))); |
551 |
24 Jan 08 |
martin |
211 |
} |
551 |
24 Jan 08 |
martin |
212 |
return permissions; |
551 |
24 Jan 08 |
martin |
213 |
} |
551 |
24 Jan 08 |
martin |
214 |
@Override |
546 |
18 Jan 08 |
nicklas |
215 |
public boolean supportsConfigurations() |
546 |
18 Jan 08 |
nicklas |
216 |
{ |
546 |
18 Jan 08 |
nicklas |
217 |
return false; |
546 |
18 Jan 08 |
nicklas |
218 |
} |
546 |
18 Jan 08 |
nicklas |
219 |
@Override |
546 |
18 Jan 08 |
nicklas |
220 |
public boolean requiresConfiguration() |
546 |
18 Jan 08 |
nicklas |
221 |
{ |
546 |
18 Jan 08 |
nicklas |
222 |
return false; |
546 |
18 Jan 08 |
nicklas |
223 |
} |
1386 |
06 Sep 11 |
nicklas |
224 |
@Override |
546 |
18 Jan 08 |
nicklas |
225 |
public Plugin.MainType getMainType() |
546 |
18 Jan 08 |
nicklas |
226 |
{ |
546 |
18 Jan 08 |
nicklas |
227 |
return Plugin.MainType.OTHER; |
546 |
18 Jan 08 |
nicklas |
228 |
} |
1386 |
06 Sep 11 |
nicklas |
229 |
@Override |
546 |
18 Jan 08 |
nicklas |
230 |
public void run(Request request, Response response, ProgressReporter progress) |
546 |
18 Jan 08 |
nicklas |
231 |
{ |
546 |
18 Jan 08 |
nicklas |
232 |
String command = request.getCommand(); |
551 |
24 Jan 08 |
martin |
233 |
if (command.equals(Request.COMMAND_EXECUTE)) |
551 |
24 Jan 08 |
martin |
234 |
{ |
583 |
12 Feb 08 |
nicklas |
235 |
DbControl dc = sc.newDbControl(); |
551 |
24 Jan 08 |
martin |
236 |
try |
551 |
24 Jan 08 |
martin |
237 |
{ |
583 |
12 Feb 08 |
nicklas |
238 |
boolean installExp1 = YES_OPTION.equals(job.getValue("installExp1")); |
589 |
20 Feb 08 |
martin |
239 |
boolean installExp2 = YES_OPTION.equals(job.getValue("installExp2")); |
589 |
20 Feb 08 |
martin |
240 |
boolean installSnp = YES_OPTION.equals(job.getValue("installSnp")); |
681 |
29 Apr 08 |
jari |
241 |
boolean installDetectionPValue = |
681 |
29 Apr 08 |
jari |
242 |
YES_OPTION.equals(job.getValue("installDetectionPValue")); |
583 |
12 Feb 08 |
nicklas |
243 |
boolean installScanner = YES_OPTION.equals(job.getValue("installScanner")); |
583 |
12 Feb 08 |
nicklas |
244 |
boolean installSoftware = YES_OPTION.equals(job.getValue("installSoftware")); |
681 |
29 Apr 08 |
jari |
245 |
boolean ignoreExistingItems = SKIP_OPTION.equals(job.getValue("alreadyInstalledError")); |
555 |
28 Jan 08 |
martin |
246 |
|
566 |
01 Feb 08 |
nicklas |
247 |
Set<Integer> expressionTypes = new HashSet<Integer>(); |
551 |
24 Jan 08 |
martin |
248 |
if (installExp1) expressionTypes.add(1); |
551 |
24 Jan 08 |
martin |
249 |
if (installExp2) expressionTypes.add(2); |
626 |
12 Mar 08 |
nicklas |
250 |
|
681 |
29 Apr 08 |
jari |
251 |
installIlluminaItems(dc, installSnp, expressionTypes, ignoreExistingItems, progress); |
681 |
29 Apr 08 |
jari |
252 |
if (installDetectionPValue) |
681 |
29 Apr 08 |
jari |
253 |
{ |
686 |
30 Apr 08 |
jari |
254 |
createExtraValueType(dc,Illumina.DETECTION_PVALUE_ID,Illumina.DETECTION_PVALUE_TYPE, |
686 |
30 Apr 08 |
jari |
255 |
"ExtraValueType required for Illumina detection P-value calculations", |
686 |
30 Apr 08 |
jari |
256 |
ignoreExistingItems); |
681 |
29 Apr 08 |
jari |
257 |
} |
583 |
12 Feb 08 |
nicklas |
258 |
if (installScanner) |
583 |
12 Feb 08 |
nicklas |
259 |
{ |
583 |
12 Feb 08 |
nicklas |
260 |
String name = (String)job.getValue("scannerName"); |
583 |
12 Feb 08 |
nicklas |
261 |
String version = (String)job.getValue("scannerVersion"); |
583 |
12 Feb 08 |
nicklas |
262 |
String description = (String)job.getValue("scannerDescription"); |
583 |
12 Feb 08 |
nicklas |
263 |
createScanner(dc, name, version, description); |
583 |
12 Feb 08 |
nicklas |
264 |
} |
583 |
12 Feb 08 |
nicklas |
265 |
if (installSoftware) |
583 |
12 Feb 08 |
nicklas |
266 |
{ |
583 |
12 Feb 08 |
nicklas |
267 |
String name = (String)job.getValue("softwareName"); |
583 |
12 Feb 08 |
nicklas |
268 |
String version = (String)job.getValue("softwareVersion"); |
583 |
12 Feb 08 |
nicklas |
269 |
String description = (String)job.getValue("softwareDescription"); |
583 |
12 Feb 08 |
nicklas |
270 |
createSoftware(dc, name, version, description); |
583 |
12 Feb 08 |
nicklas |
271 |
} |
583 |
12 Feb 08 |
nicklas |
272 |
dc.commit(); |
626 |
12 Mar 08 |
nicklas |
273 |
if (installSnp) |
626 |
12 Mar 08 |
nicklas |
274 |
{ |
626 |
12 Mar 08 |
nicklas |
275 |
dc = sc.newDbControl(); |
626 |
12 Mar 08 |
nicklas |
276 |
|
626 |
12 Mar 08 |
nicklas |
277 |
Coloring gTypeColor = createColoring(false, -1f, 0f, 1f); |
626 |
12 Mar 08 |
nicklas |
278 |
Coloring ratioColor = createColoring(false, -1f, 0f, 1f); |
626 |
12 Mar 08 |
nicklas |
279 |
RawDataType snpRawData = Illumina.getSnpType(); |
626 |
12 Mar 08 |
nicklas |
280 |
createFormula(dc, "GType", Formula.Type.COLUMN_EXPRESSION, |
626 |
12 Mar 08 |
nicklas |
281 |
snpRawData, Formula.AverageMethod.NONE, gTypeColor, "ch(1)"); |
626 |
12 Mar 08 |
nicklas |
282 |
createFormula(dc, "Log R Ratio", Formula.Type.COLUMN_EXPRESSION, |
626 |
12 Mar 08 |
nicklas |
283 |
snpRawData, Formula.AverageMethod.GEOMETRIC_MEAN, ratioColor, "ch(2)"); |
626 |
12 Mar 08 |
nicklas |
284 |
createFormula(dc, "B Allele Freq", Formula.Type.COLUMN_EXPRESSION, |
626 |
12 Mar 08 |
nicklas |
285 |
snpRawData, Formula.AverageMethod.NONE, null, "ch(3)"); |
626 |
12 Mar 08 |
nicklas |
286 |
dc.commit(); |
626 |
12 Mar 08 |
nicklas |
287 |
} |
551 |
24 Jan 08 |
martin |
288 |
} |
551 |
24 Jan 08 |
martin |
289 |
catch(Throwable ex) |
551 |
24 Jan 08 |
martin |
290 |
{ |
551 |
24 Jan 08 |
martin |
291 |
response.setError(ex.getMessage(), Arrays.asList(ex)); |
551 |
24 Jan 08 |
martin |
292 |
return; |
551 |
24 Jan 08 |
martin |
293 |
} |
583 |
12 Feb 08 |
nicklas |
294 |
finally |
583 |
12 Feb 08 |
nicklas |
295 |
{ |
583 |
12 Feb 08 |
nicklas |
296 |
if (dc != null) dc.close(); |
583 |
12 Feb 08 |
nicklas |
297 |
} |
551 |
24 Jan 08 |
martin |
298 |
response.setDone("Illumina items were installed successfully"); |
551 |
24 Jan 08 |
martin |
299 |
} |
551 |
24 Jan 08 |
martin |
300 |
else |
551 |
24 Jan 08 |
martin |
301 |
{ |
551 |
24 Jan 08 |
martin |
302 |
response.setError("Unknown command: " + command, null); |
551 |
24 Jan 08 |
martin |
303 |
} |
546 |
18 Jan 08 |
nicklas |
304 |
} |
546 |
18 Jan 08 |
nicklas |
305 |
// ------------------------------------------- |
546 |
18 Jan 08 |
nicklas |
306 |
/* |
546 |
18 Jan 08 |
nicklas |
From the InteractivePlugin interface |
546 |
18 Jan 08 |
nicklas |
308 |
------------------------------------------- |
546 |
18 Jan 08 |
nicklas |
309 |
*/ |
1386 |
06 Sep 11 |
nicklas |
310 |
@Override |
546 |
18 Jan 08 |
nicklas |
311 |
public Set<GuiContext> getGuiContexts() |
546 |
18 Jan 08 |
nicklas |
312 |
{ |
546 |
18 Jan 08 |
nicklas |
313 |
return guiContexts; |
546 |
18 Jan 08 |
nicklas |
314 |
} |
1386 |
06 Sep 11 |
nicklas |
315 |
@Override |
546 |
18 Jan 08 |
nicklas |
316 |
public String isInContext(GuiContext context, Object item) |
546 |
18 Jan 08 |
nicklas |
317 |
{ |
546 |
18 Jan 08 |
nicklas |
318 |
String message = null; |
546 |
18 Jan 08 |
nicklas |
319 |
if (guiContexts.contains(context)) |
546 |
18 Jan 08 |
nicklas |
320 |
{ |
546 |
18 Jan 08 |
nicklas |
321 |
PluginDefinition plugin = (PluginDefinition)item; |
546 |
18 Jan 08 |
nicklas |
322 |
if (plugin == null || !this.getClass().getName().equals(plugin.getClassName())) |
546 |
18 Jan 08 |
nicklas |
323 |
{ |
546 |
18 Jan 08 |
nicklas |
324 |
message = "Can only be used when this is the selected plug-in."; |
546 |
18 Jan 08 |
nicklas |
325 |
} |
572 |
06 Feb 08 |
martin |
326 |
RawDataType beadSummaryType = Illumina.getBeadSummaryType(); |
572 |
06 Feb 08 |
martin |
327 |
if (beadSummaryType == null) |
566 |
01 Feb 08 |
nicklas |
328 |
{ |
572 |
06 Feb 08 |
martin |
329 |
throw new InvalidDataException("The '" + Illumina.BEAD_SUMMARY_ID + "' raw data type is " + |
572 |
06 Feb 08 |
martin |
330 |
"missing. It must be added to BASE before running this plug-in, see the " + |
566 |
01 Feb 08 |
nicklas |
331 |
"Illumina plug-in manual."); |
566 |
01 Feb 08 |
nicklas |
332 |
} |
546 |
18 Jan 08 |
nicklas |
333 |
} |
546 |
18 Jan 08 |
nicklas |
334 |
else |
546 |
18 Jan 08 |
nicklas |
335 |
{ |
546 |
18 Jan 08 |
nicklas |
336 |
message = "Unsupported context: " + context; |
546 |
18 Jan 08 |
nicklas |
337 |
} |
546 |
18 Jan 08 |
nicklas |
338 |
return message; |
546 |
18 Jan 08 |
nicklas |
339 |
} |
546 |
18 Jan 08 |
nicklas |
340 |
|
1386 |
06 Sep 11 |
nicklas |
341 |
@Override |
546 |
18 Jan 08 |
nicklas |
342 |
public void configure(GuiContext context, Request request, Response response) |
546 |
18 Jan 08 |
nicklas |
343 |
{ |
551 |
24 Jan 08 |
martin |
344 |
String command = request.getCommand(); |
551 |
24 Jan 08 |
martin |
345 |
if (command.equals(Request.COMMAND_CONFIGURE_JOB)) |
551 |
24 Jan 08 |
martin |
346 |
{ |
551 |
24 Jan 08 |
martin |
347 |
List<Throwable> errors = validateRequestParameters( |
551 |
24 Jan 08 |
martin |
348 |
getConfigureJobParameters().getParameters(), |
551 |
24 Jan 08 |
martin |
349 |
request); |
551 |
24 Jan 08 |
martin |
350 |
|
551 |
24 Jan 08 |
martin |
351 |
if (errors != null) |
551 |
24 Jan 08 |
martin |
352 |
{ |
551 |
24 Jan 08 |
martin |
353 |
response.setError(errors.size() + " invalid parameters were found in the request", errors); |
551 |
24 Jan 08 |
martin |
354 |
return; |
551 |
24 Jan 08 |
martin |
355 |
} |
583 |
12 Feb 08 |
nicklas |
356 |
if (YES_OPTION.equals(request.getParameterValue(installScannerParameter.getName())) && |
583 |
12 Feb 08 |
nicklas |
357 |
request.getParameterValue(scannerNameParameter.getName()) == null) |
577 |
08 Feb 08 |
martin |
358 |
{ |
577 |
08 Feb 08 |
martin |
359 |
response.setError("The scanner to create must have a name. Please specify a name in 'Scanner name'-parameter", null); |
577 |
08 Feb 08 |
martin |
360 |
return; |
577 |
08 Feb 08 |
martin |
361 |
} |
583 |
12 Feb 08 |
nicklas |
362 |
if (YES_OPTION.equals(request.getParameterValue(installSoftwareParameter.getName())) && |
583 |
12 Feb 08 |
nicklas |
363 |
request.getParameterValue(softwareNameParameter.getName()) == null) |
583 |
12 Feb 08 |
nicklas |
364 |
{ |
583 |
12 Feb 08 |
nicklas |
365 |
response.setError("The software to create must have a name. Please specify a name in 'Software name'-parameter", null); |
583 |
12 Feb 08 |
nicklas |
366 |
return; |
583 |
12 Feb 08 |
nicklas |
367 |
} |
583 |
12 Feb 08 |
nicklas |
368 |
|
551 |
24 Jan 08 |
martin |
369 |
storeValue(job, request, alreadyInstalledErrorParameter); |
551 |
24 Jan 08 |
martin |
370 |
storeValue(job, request, installExp1VariantParameter); |
551 |
24 Jan 08 |
martin |
371 |
storeValue(job, request, installExp2VariantParameter); |
551 |
24 Jan 08 |
martin |
372 |
storeValue(job, request, installSnpVariantParameter); |
681 |
29 Apr 08 |
jari |
373 |
|
681 |
29 Apr 08 |
jari |
374 |
storeValue(job, request, installDetectionPValueParameter); |
681 |
29 Apr 08 |
jari |
375 |
|
577 |
08 Feb 08 |
martin |
376 |
storeValue(job, request, installScannerParameter); |
577 |
08 Feb 08 |
martin |
377 |
storeValue(job, request, scannerNameParameter); |
577 |
08 Feb 08 |
martin |
378 |
storeValue(job, request, scannerVersionParameter); |
583 |
12 Feb 08 |
nicklas |
379 |
storeValue(job, request, scannerDescriptionParameter); |
577 |
08 Feb 08 |
martin |
380 |
|
583 |
12 Feb 08 |
nicklas |
381 |
storeValue(job, request, installSoftwareParameter); |
583 |
12 Feb 08 |
nicklas |
382 |
storeValue(job, request, softwareNameParameter); |
583 |
12 Feb 08 |
nicklas |
383 |
storeValue(job, request, softwareVersionParameter); |
583 |
12 Feb 08 |
nicklas |
384 |
storeValue(job, request, softwareDescriptionParameter); |
583 |
12 Feb 08 |
nicklas |
385 |
|
583 |
12 Feb 08 |
nicklas |
386 |
if (request.isAllowedImmediateExecution()) |
583 |
12 Feb 08 |
nicklas |
387 |
{ |
583 |
12 Feb 08 |
nicklas |
388 |
response.setExecuteImmediately("Installing Illumina items", Job.ExecutionTime.SHORTEST, false); |
583 |
12 Feb 08 |
nicklas |
389 |
} |
583 |
12 Feb 08 |
nicklas |
390 |
else |
583 |
12 Feb 08 |
nicklas |
391 |
{ |
583 |
12 Feb 08 |
nicklas |
392 |
response.setDone("The job configuration is complete.", Job.ExecutionTime.SHORTEST); |
583 |
12 Feb 08 |
nicklas |
393 |
} |
551 |
24 Jan 08 |
martin |
394 |
} |
551 |
24 Jan 08 |
martin |
395 |
else |
551 |
24 Jan 08 |
martin |
396 |
{ |
551 |
24 Jan 08 |
martin |
397 |
response.setError("Unknown command: " + command, null); |
551 |
24 Jan 08 |
martin |
398 |
} |
546 |
18 Jan 08 |
nicklas |
399 |
} |
546 |
18 Jan 08 |
nicklas |
400 |
|
1386 |
06 Sep 11 |
nicklas |
401 |
@Override |
546 |
18 Jan 08 |
nicklas |
402 |
public RequestInformation getRequestInformation(GuiContext context, String command) |
546 |
18 Jan 08 |
nicklas |
403 |
throws BaseException |
546 |
18 Jan 08 |
nicklas |
404 |
{ |
546 |
18 Jan 08 |
nicklas |
405 |
RequestInformation requestInformation = null; |
546 |
18 Jan 08 |
nicklas |
406 |
if (command.equals(Request.COMMAND_CONFIGURE_JOB)) |
546 |
18 Jan 08 |
nicklas |
407 |
{ |
546 |
18 Jan 08 |
nicklas |
408 |
requestInformation = getConfigureJobParameters(); |
546 |
18 Jan 08 |
nicklas |
409 |
} |
546 |
18 Jan 08 |
nicklas |
410 |
return requestInformation; |
546 |
18 Jan 08 |
nicklas |
411 |
} |
546 |
18 Jan 08 |
nicklas |
412 |
// ------------------------------------------- |
551 |
24 Jan 08 |
martin |
413 |
|
551 |
24 Jan 08 |
martin |
414 |
/** |
551 |
24 Jan 08 |
martin |
Creates items that are required when working with the Illumina platform in BASE. |
572 |
06 Feb 08 |
martin |
416 |
|
551 |
24 Jan 08 |
martin |
This method gives options on which platform variants to create and how already |
551 |
24 Jan 08 |
martin |
existing items should be handled. |
551 |
24 Jan 08 |
martin |
@param installSNP TRUE if the SNP variant should be created, FALSE otherwise |
551 |
24 Jan 08 |
martin |
@param expressionTypes A set of numbers. A expression variant will be created for each object in the set |
551 |
24 Jan 08 |
martin |
and the number itself represent the number of strip(s) in an array of the variant to create. |
551 |
24 Jan 08 |
martin |
@param ignoreExistingItems TRUE if items already existing should be ignored and the rest should be installed. |
551 |
24 Jan 08 |
martin |
FALSE if NO items should be created when there is one or more already existing in BASE. |
551 |
24 Jan 08 |
martin |
@throws ItemAlreadyExistsException If ignoreInstalledItems = FALSE and one of the |
551 |
24 Jan 08 |
martin |
425 |
*/ |
626 |
12 Mar 08 |
nicklas |
426 |
public void installIlluminaItems(DbControl dc, boolean installSNP, Set<Integer> expressionTypes, boolean ignoreExistingItems, ProgressReporter progress) |
551 |
24 Jan 08 |
martin |
427 |
throws ItemAlreadyExistsException |
555 |
28 Jan 08 |
martin |
428 |
{ |
572 |
06 Feb 08 |
martin |
429 |
RawDataType beadSummaryType = Illumina.getBeadSummaryType(); |
572 |
06 Feb 08 |
martin |
430 |
if (beadSummaryType == null) |
555 |
28 Jan 08 |
martin |
431 |
{ |
572 |
06 Feb 08 |
martin |
432 |
throw new InvalidDataException("Raw data type[" + Illumina.BEAD_SUMMARY_ID + "] is " + |
566 |
01 Feb 08 |
nicklas |
433 |
"missing. This must exist before the items can be installed, see the " + |
566 |
01 Feb 08 |
nicklas |
434 |
"Illumina plug-in manual."); |
555 |
28 Jan 08 |
martin |
435 |
} |
551 |
24 Jan 08 |
martin |
436 |
int largestNumOfStrips = 0; |
572 |
06 Feb 08 |
martin |
437 |
|
583 |
12 Feb 08 |
nicklas |
438 |
String jarPath = PluginDefinition.getByClassName(dc, this.getClass().getName()).getJarPath(); |
583 |
12 Feb 08 |
nicklas |
439 |
|
551 |
24 Jan 08 |
martin |
440 |
String expExternalIdPrefix = "illumina.exp"; |
572 |
06 Feb 08 |
martin |
441 |
String beadSummaryTypePrefix = "illlumina.ibs."; |
551 |
24 Jan 08 |
martin |
442 |
|
1385 |
02 Sep 11 |
martin |
443 |
ItemSubtype reporterMapType = null; |
1385 |
02 Sep 11 |
martin |
444 |
ItemSubtype rawDataType = null; |
555 |
28 Jan 08 |
martin |
445 |
|
551 |
24 Jan 08 |
martin |
446 |
Iterator<Integer> expressionTypeIterator = expressionTypes.iterator(); |
551 |
24 Jan 08 |
martin |
447 |
while(expressionTypeIterator.hasNext()) |
551 |
24 Jan 08 |
martin |
448 |
{ |
551 |
24 Jan 08 |
martin |
449 |
int next = expressionTypeIterator.next(); |
551 |
24 Jan 08 |
martin |
450 |
largestNumOfStrips = largestNumOfStrips < next ? next : largestNumOfStrips; |
551 |
24 Jan 08 |
martin |
451 |
} |
551 |
24 Jan 08 |
martin |
452 |
|
1385 |
02 Sep 11 |
martin |
453 |
reporterMapType = ItemSubtype.getById(dc, SystemItems.getId(File.REPORTER_MAP)); |
1385 |
02 Sep 11 |
martin |
454 |
rawDataType = ItemSubtype.getById(dc, SystemItems.getId(File.RAW_DATA)); |
583 |
12 Feb 08 |
nicklas |
455 |
|
583 |
12 Feb 08 |
nicklas |
//Data file types |
583 |
12 Feb 08 |
nicklas |
457 |
Map<String, DataFileType> dataFileTypes = new HashMap<String, DataFileType>(); |
736 |
05 Aug 08 |
martin |
458 |
DataFileType bgx = null; |
736 |
05 Aug 08 |
martin |
//Create bgx-datafile type if there are one or more expression platforms. |
736 |
05 Aug 08 |
martin |
460 |
if (largestNumOfStrips > 0) |
736 |
05 Aug 08 |
martin |
461 |
{ |
736 |
05 Aug 08 |
martin |
462 |
bgx = createDataFileType(dc, |
736 |
05 Aug 08 |
martin |
463 |
Illumina.BGX_FILE_ID, "BGX file", "Illumina Sentrix Array binary manifest file", |
736 |
05 Aug 08 |
martin |
464 |
Item.ARRAYDESIGN, BGX_FILEYTPE_EXTENSION, reporterMapType, |
1386 |
06 Sep 11 |
nicklas |
465 |
ignoreExistingItems); |
736 |
05 Aug 08 |
martin |
466 |
} |
583 |
12 Feb 08 |
nicklas |
467 |
for (int i = 1; i <= largestNumOfStrips; i++ ) |
551 |
24 Jan 08 |
martin |
468 |
{ |
583 |
12 Feb 08 |
nicklas |
469 |
String name = "Illumina Bead Summary file " + i; |
583 |
12 Feb 08 |
nicklas |
470 |
DataFileType dft = createDataFileType(dc, |
583 |
12 Feb 08 |
nicklas |
471 |
beadSummaryTypePrefix + i, name, |
583 |
12 Feb 08 |
nicklas |
472 |
"Illumina Bead Summary file for strip #" + i + " in an array.", |
583 |
12 Feb 08 |
nicklas |
473 |
Item.RAWBIOASSAY, BEAD_SUMMARY_FILETYPE_EXTENSION, rawDataType, |
1386 |
06 Sep 11 |
nicklas |
474 |
ignoreExistingItems); |
583 |
12 Feb 08 |
nicklas |
475 |
dataFileTypes.put(dft.getExternalId(), dft); |
583 |
12 Feb 08 |
nicklas |
476 |
} |
583 |
12 Feb 08 |
nicklas |
477 |
|
589 |
20 Feb 08 |
martin |
478 |
|
583 |
12 Feb 08 |
nicklas |
//Platform and variants |
583 |
12 Feb 08 |
nicklas |
480 |
Platform illuminaPlatform = createPlatform(dc, Illumina.PLATFORM_ID, "Illumina", ignoreExistingItems); |
583 |
12 Feb 08 |
nicklas |
481 |
if (illuminaPlatform.getDescription() == null || illuminaPlatform.getDescription().equals("")) |
583 |
12 Feb 08 |
nicklas |
482 |
{ |
583 |
12 Feb 08 |
nicklas |
483 |
illuminaPlatform.setDescription("Illumina platform."); |
583 |
12 Feb 08 |
nicklas |
484 |
} |
583 |
12 Feb 08 |
nicklas |
485 |
|
583 |
12 Feb 08 |
nicklas |
486 |
List<PlatformVariant> platformVariants = new ArrayList<PlatformVariant>(); |
583 |
12 Feb 08 |
nicklas |
487 |
String namePrefix = "Expression "; |
583 |
12 Feb 08 |
nicklas |
488 |
for (int type : expressionTypes) |
583 |
12 Feb 08 |
nicklas |
489 |
{ |
583 |
12 Feb 08 |
nicklas |
490 |
PlatformVariant pfv = createPlatformVariant(dc, expExternalIdPrefix + type, namePrefix + type, |
583 |
12 Feb 08 |
nicklas |
491 |
illuminaPlatform, beadSummaryType, ignoreExistingItems); |
583 |
12 Feb 08 |
nicklas |
492 |
if (pfv.getDescription() == null || pfv.getDescription().equals("")) |
577 |
08 Feb 08 |
martin |
493 |
{ |
583 |
12 Feb 08 |
nicklas |
494 |
pfv.setDescription("Platform variant to use with Illumina expression containing " + type + " strip(s)/array"); |
577 |
08 Feb 08 |
martin |
495 |
} |
1386 |
06 Sep 11 |
nicklas |
496 |
PlatformFileType pft = illuminaPlatform.getFileType(bgx, pfv, true); |
1386 |
06 Sep 11 |
nicklas |
497 |
pft.setRequired(true); |
583 |
12 Feb 08 |
nicklas |
498 |
for (int i = 1; i <= type; i++) |
551 |
24 Jan 08 |
martin |
499 |
{ |
1386 |
06 Sep 11 |
nicklas |
500 |
pft = illuminaPlatform.getFileType(dataFileTypes.get(beadSummaryTypePrefix+i), pfv, true); |
1386 |
06 Sep 11 |
nicklas |
501 |
pft.setRequired(true); |
551 |
24 Jan 08 |
martin |
502 |
} |
583 |
12 Feb 08 |
nicklas |
503 |
platformVariants.add(pfv); |
551 |
24 Jan 08 |
martin |
504 |
} |
583 |
12 Feb 08 |
nicklas |
505 |
|
589 |
20 Feb 08 |
martin |
506 |
|
626 |
12 Mar 08 |
nicklas |
507 |
if (installSNP) |
551 |
24 Jan 08 |
martin |
508 |
{ |
1237 |
06 Sep 10 |
nicklas |
509 |
DataFileType snpManifestType = createDataFileType(dc, |
1237 |
06 Sep 10 |
nicklas |
510 |
Illumina.SNP_MANIFEST_FILE_ID, "SNP manifest file", "Manifest file for Illumina SNP", |
1237 |
06 Sep 10 |
nicklas |
511 |
Item.ARRAYDESIGN, SNP_MF_FILETYPE_EXTENSION, reporterMapType, |
1386 |
06 Sep 11 |
nicklas |
512 |
ignoreExistingItems); |
1237 |
06 Sep 10 |
nicklas |
513 |
DataFileType snpSplitDataType = createDataFileType(dc, |
1237 |
06 Sep 10 |
nicklas |
514 |
Illumina.SNP_SPLITDATA_FILE_ID, "SNP split data file", "Data file for Illumina SNP. Contains data for only one sample", |
1237 |
06 Sep 10 |
nicklas |
515 |
Item.RAWBIOASSAY, SNP_SPLITDATA_FILETYPE_EXTENSION, rawDataType, |
1386 |
06 Sep 11 |
nicklas |
516 |
ignoreExistingItems); |
1237 |
06 Sep 10 |
nicklas |
517 |
DataFileType snpDataType = createDataFileType(dc, |
1237 |
06 Sep 10 |
nicklas |
518 |
Illumina.SNP_DATA_FILE_ID, "SNP original data file", "The original data file exported from Illumina BeadStudio", |
1237 |
06 Sep 10 |
nicklas |
519 |
Item.RAWBIOASSAY, null, rawDataType, |
1386 |
06 Sep 11 |
nicklas |
520 |
ignoreExistingItems); |
1237 |
06 Sep 10 |
nicklas |
521 |
|
583 |
12 Feb 08 |
nicklas |
522 |
PlatformVariant pfv = createPlatformVariant(dc, Illumina.SNP_VARIANT_ID, |
589 |
20 Feb 08 |
martin |
523 |
"SNP", illuminaPlatform, 3, ignoreExistingItems); |
583 |
12 Feb 08 |
nicklas |
524 |
if (pfv.getDescription() == null || pfv.getDescription().equals("")) |
551 |
24 Jan 08 |
martin |
525 |
{ |
589 |
20 Feb 08 |
martin |
526 |
pfv.setDescription("Platform variant to use with Illumina SNP data."); |
551 |
24 Jan 08 |
martin |
527 |
} |
1386 |
06 Sep 11 |
nicklas |
528 |
illuminaPlatform.getFileType(snpManifestType, pfv, true).setRequired(true); |
1386 |
06 Sep 11 |
nicklas |
529 |
illuminaPlatform.getFileType(snpSplitDataType, pfv, true).setRequired(true); |
1386 |
06 Sep 11 |
nicklas |
530 |
illuminaPlatform.getFileType(snpDataType, pfv, true); |
583 |
12 Feb 08 |
nicklas |
531 |
platformVariants.add(pfv); |
589 |
20 Feb 08 |
martin |
532 |
} |
551 |
24 Jan 08 |
martin |
533 |
} |
551 |
24 Jan 08 |
martin |
534 |
|
546 |
18 Jan 08 |
nicklas |
535 |
private RequestInformation getConfigureJobParameters() |
546 |
18 Jan 08 |
nicklas |
536 |
{ |
551 |
24 Jan 08 |
martin |
537 |
if (configureJob == null) |
551 |
24 Jan 08 |
martin |
538 |
{ |
1237 |
06 Sep 10 |
nicklas |
539 |
DbControl dc = null; |
1237 |
06 Sep 10 |
nicklas |
540 |
try |
1237 |
06 Sep 10 |
nicklas |
541 |
{ |
1237 |
06 Sep 10 |
nicklas |
542 |
dc = sc.newDbControl(); |
1237 |
06 Sep 10 |
nicklas |
543 |
boolean firstTimeInstallation = isFirstTimeInstallation(dc); |
1237 |
06 Sep 10 |
nicklas |
544 |
String[] options = {YES_OPTION, NO_OPTION}; |
1237 |
06 Sep 10 |
nicklas |
545 |
StringParameterType installOptionType = new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
546 |
( |
1237 |
06 Sep 10 |
nicklas |
547 |
255, |
1237 |
06 Sep 10 |
nicklas |
548 |
firstTimeInstallation ? YES_OPTION : NO_OPTION, |
1237 |
06 Sep 10 |
nicklas |
549 |
true, |
1237 |
06 Sep 10 |
nicklas |
550 |
1, 0, 0, |
1237 |
06 Sep 10 |
nicklas |
551 |
Arrays.asList(options) |
1237 |
06 Sep 10 |
nicklas |
552 |
); |
1237 |
06 Sep 10 |
nicklas |
553 |
|
1237 |
06 Sep 10 |
nicklas |
554 |
installExp1VariantParameter = new PluginParameter<String> |
1237 |
06 Sep 10 |
nicklas |
555 |
( |
1237 |
06 Sep 10 |
nicklas |
556 |
"installExp1", |
1237 |
06 Sep 10 |
nicklas |
557 |
"Create Expression 1", |
1237 |
06 Sep 10 |
nicklas |
558 |
"Select '" + YES_OPTION + "' to create an Illumina expression variant with one strip/array.", |
1237 |
06 Sep 10 |
nicklas |
559 |
firstTimeInstallation || variantExists(dc, "illumina.exp1") ? YES_OPTION : NO_OPTION, |
1237 |
06 Sep 10 |
nicklas |
560 |
installOptionType |
1237 |
06 Sep 10 |
nicklas |
561 |
); |
1237 |
06 Sep 10 |
nicklas |
562 |
|
1237 |
06 Sep 10 |
nicklas |
563 |
installExp2VariantParameter = new PluginParameter<String> |
1237 |
06 Sep 10 |
nicklas |
564 |
( |
1237 |
06 Sep 10 |
nicklas |
565 |
"installExp2", |
1237 |
06 Sep 10 |
nicklas |
566 |
"Create Expression 2", |
1237 |
06 Sep 10 |
nicklas |
567 |
"Select '" + YES_OPTION + "' to create an Illumina expression variant with two strips/array.", |
1237 |
06 Sep 10 |
nicklas |
568 |
firstTimeInstallation || variantExists(dc, "illumina.exp2") ? YES_OPTION : NO_OPTION, |
1237 |
06 Sep 10 |
nicklas |
569 |
installOptionType |
1237 |
06 Sep 10 |
nicklas |
570 |
); |
1237 |
06 Sep 10 |
nicklas |
571 |
|
1237 |
06 Sep 10 |
nicklas |
572 |
installSnpVariantParameter = new PluginParameter<String> |
1237 |
06 Sep 10 |
nicklas |
573 |
( |
1237 |
06 Sep 10 |
nicklas |
574 |
"installSnp", |
1237 |
06 Sep 10 |
nicklas |
575 |
"Create SNP", |
1237 |
06 Sep 10 |
nicklas |
576 |
"Select '" + YES_OPTION + "' to create an Illumina SNP variant.", |
1237 |
06 Sep 10 |
nicklas |
577 |
firstTimeInstallation || variantExists(dc, "illumina.exp2") ? YES_OPTION : NO_OPTION, |
577 |
08 Feb 08 |
martin |
578 |
installOptionType |
1237 |
06 Sep 10 |
nicklas |
579 |
); |
1237 |
06 Sep 10 |
nicklas |
580 |
|
1237 |
06 Sep 10 |
nicklas |
581 |
installDetectionPValueParameter = new PluginParameter<String> |
1237 |
06 Sep 10 |
nicklas |
582 |
( |
1237 |
06 Sep 10 |
nicklas |
583 |
"installDetectionPValue", |
1237 |
06 Sep 10 |
nicklas |
584 |
"Create " + Illumina.DETECTION_PVALUE_ID, |
1237 |
06 Sep 10 |
nicklas |
585 |
"Select '"+YES_OPTION+"' to create an "+Illumina.DETECTION_PVALUE_ID+" ExtraValueType.", |
577 |
08 Feb 08 |
martin |
586 |
installOptionType |
577 |
08 Feb 08 |
martin |
587 |
); |
1237 |
06 Sep 10 |
nicklas |
588 |
|
1237 |
06 Sep 10 |
nicklas |
589 |
installScannerParameter = new PluginParameter<String> |
577 |
08 Feb 08 |
martin |
590 |
( |
1237 |
06 Sep 10 |
nicklas |
591 |
"installScanner", |
1237 |
06 Sep 10 |
nicklas |
592 |
"Create scanner", |
1237 |
06 Sep 10 |
nicklas |
593 |
"Choose '" + YES_OPTION + "' to create a scanner entry in BASE, or '" + NO_OPTION + "' otherwise", |
1237 |
06 Sep 10 |
nicklas |
594 |
installOptionType |
1237 |
06 Sep 10 |
nicklas |
595 |
); |
1237 |
06 Sep 10 |
nicklas |
596 |
scannerNameParameter = new PluginParameter<String> |
577 |
08 Feb 08 |
martin |
597 |
( |
1237 |
06 Sep 10 |
nicklas |
598 |
"scannerName", |
1237 |
06 Sep 10 |
nicklas |
599 |
"Scanner name", |
1237 |
06 Sep 10 |
nicklas |
600 |
"A name to assign to the scanner if this should be created. " + |
1237 |
06 Sep 10 |
nicklas |
601 |
"This could only be left empty if 'Install scanner' is set to '"+NO_OPTION+"'", |
1237 |
06 Sep 10 |
nicklas |
602 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
603 |
( |
1237 |
06 Sep 10 |
nicklas |
604 |
255, |
1237 |
06 Sep 10 |
nicklas |
605 |
firstTimeInstallation ? "Illumina BeadArray Reader" : null, |
1237 |
06 Sep 10 |
nicklas |
606 |
false, |
1237 |
06 Sep 10 |
nicklas |
607 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
608 |
) |
1237 |
06 Sep 10 |
nicklas |
609 |
); |
1237 |
06 Sep 10 |
nicklas |
610 |
scannerVersionParameter = new PluginParameter<String> |
583 |
12 Feb 08 |
nicklas |
611 |
( |
1237 |
06 Sep 10 |
nicklas |
612 |
"scannerVersion", |
1237 |
06 Sep 10 |
nicklas |
613 |
"Scanner version", |
1237 |
06 Sep 10 |
nicklas |
614 |
"Version of the scanner to create. This has no effect if 'Install scanner' is set to '" + NO_OPTION + "'", |
1237 |
06 Sep 10 |
nicklas |
615 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
616 |
( |
1237 |
06 Sep 10 |
nicklas |
617 |
255, |
1237 |
06 Sep 10 |
nicklas |
618 |
null, |
1237 |
06 Sep 10 |
nicklas |
619 |
false, |
1237 |
06 Sep 10 |
nicklas |
620 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
621 |
) |
1237 |
06 Sep 10 |
nicklas |
622 |
); |
1237 |
06 Sep 10 |
nicklas |
623 |
scannerDescriptionParameter = new PluginParameter<String> |
583 |
12 Feb 08 |
nicklas |
624 |
( |
1237 |
06 Sep 10 |
nicklas |
625 |
"scannerDescription", |
1237 |
06 Sep 10 |
nicklas |
626 |
"Scanner description", |
1237 |
06 Sep 10 |
nicklas |
627 |
"An optional description of the scanner.", |
1237 |
06 Sep 10 |
nicklas |
628 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
629 |
( |
1237 |
06 Sep 10 |
nicklas |
630 |
65535, |
1237 |
06 Sep 10 |
nicklas |
631 |
"The Illumina BeadArray Reader is a " + |
1237 |
06 Sep 10 |
nicklas |
632 |
"scanner that can read arrays including Illumina Sentrix BeadChips and " + |
1237 |
06 Sep 10 |
nicklas |
633 |
"Sentrix Array Matrices (SAMs).", |
1237 |
06 Sep 10 |
nicklas |
634 |
false, |
1237 |
06 Sep 10 |
nicklas |
635 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
636 |
) |
1237 |
06 Sep 10 |
nicklas |
637 |
); |
1237 |
06 Sep 10 |
nicklas |
638 |
installSoftwareParameter = new PluginParameter<String> |
583 |
12 Feb 08 |
nicklas |
639 |
( |
1237 |
06 Sep 10 |
nicklas |
640 |
"installSoftware", |
1237 |
06 Sep 10 |
nicklas |
641 |
"Create software", |
1237 |
06 Sep 10 |
nicklas |
642 |
"Choose '" + YES_OPTION + "' to create a software entry in BASE, or '" + NO_OPTION + "' otherwise", |
1237 |
06 Sep 10 |
nicklas |
643 |
installOptionType |
1237 |
06 Sep 10 |
nicklas |
644 |
); |
1237 |
06 Sep 10 |
nicklas |
645 |
softwareNameParameter = new PluginParameter<String> |
583 |
12 Feb 08 |
nicklas |
646 |
( |
1237 |
06 Sep 10 |
nicklas |
647 |
"softwareName", |
1237 |
06 Sep 10 |
nicklas |
648 |
"Software name", |
1237 |
06 Sep 10 |
nicklas |
649 |
"The name of the sofware if this should be created. " + |
1237 |
06 Sep 10 |
nicklas |
650 |
"This could only be left empty if 'Install software' is set to '"+NO_OPTION+"'", |
1237 |
06 Sep 10 |
nicklas |
651 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
652 |
( |
1237 |
06 Sep 10 |
nicklas |
653 |
255, |
1237 |
06 Sep 10 |
nicklas |
654 |
firstTimeInstallation ? "Illumina BeadScan" : null, |
1237 |
06 Sep 10 |
nicklas |
655 |
false, |
1237 |
06 Sep 10 |
nicklas |
656 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
657 |
) |
1237 |
06 Sep 10 |
nicklas |
658 |
); |
1237 |
06 Sep 10 |
nicklas |
659 |
softwareVersionParameter = new PluginParameter<String> |
551 |
24 Jan 08 |
martin |
660 |
( |
1237 |
06 Sep 10 |
nicklas |
661 |
"softwareVersion", |
1237 |
06 Sep 10 |
nicklas |
662 |
"Software version", |
1237 |
06 Sep 10 |
nicklas |
663 |
"Version of the software to create. This has no effect if 'Install software' is set to '" + NO_OPTION + "'", |
1237 |
06 Sep 10 |
nicklas |
664 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
665 |
( |
1237 |
06 Sep 10 |
nicklas |
666 |
255, |
1237 |
06 Sep 10 |
nicklas |
667 |
null, |
1237 |
06 Sep 10 |
nicklas |
668 |
false, |
1237 |
06 Sep 10 |
nicklas |
669 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
670 |
) |
1237 |
06 Sep 10 |
nicklas |
671 |
); |
1237 |
06 Sep 10 |
nicklas |
672 |
softwareDescriptionParameter = new PluginParameter<String> |
1237 |
06 Sep 10 |
nicklas |
673 |
( |
1237 |
06 Sep 10 |
nicklas |
674 |
"softwareDescription", |
1237 |
06 Sep 10 |
nicklas |
675 |
"Software description", |
1237 |
06 Sep 10 |
nicklas |
676 |
"An optional description of the software.", |
1237 |
06 Sep 10 |
nicklas |
677 |
new StringParameterType |
1237 |
06 Sep 10 |
nicklas |
678 |
( |
1237 |
06 Sep 10 |
nicklas |
679 |
65535, |
1237 |
06 Sep 10 |
nicklas |
680 |
"The Illumina BeadScan software operates the BeadArray Reader and " + |
1237 |
06 Sep 10 |
nicklas |
681 |
"outputs data files resulting from analysis of the scanner images.", |
1237 |
06 Sep 10 |
nicklas |
682 |
false, |
1237 |
06 Sep 10 |
nicklas |
683 |
1,0,0 |
1237 |
06 Sep 10 |
nicklas |
684 |
) |
1237 |
06 Sep 10 |
nicklas |
685 |
); |
1237 |
06 Sep 10 |
nicklas |
686 |
|
1237 |
06 Sep 10 |
nicklas |
687 |
List<PluginParameter<?>> parameters = new ArrayList<PluginParameter<?>>(); |
1237 |
06 Sep 10 |
nicklas |
688 |
|
1237 |
06 Sep 10 |
nicklas |
689 |
parameters.add(variantSection); |
1237 |
06 Sep 10 |
nicklas |
690 |
parameters.add(installExp1VariantParameter); |
1237 |
06 Sep 10 |
nicklas |
691 |
parameters.add(installExp2VariantParameter); |
1237 |
06 Sep 10 |
nicklas |
692 |
parameters.add(installSnpVariantParameter); |
1237 |
06 Sep 10 |
nicklas |
693 |
|
1237 |
06 Sep 10 |
nicklas |
694 |
parameters.add(extraValueTypeSection); |
1237 |
06 Sep 10 |
nicklas |
695 |
parameters.add(installDetectionPValueParameter); |
1237 |
06 Sep 10 |
nicklas |
696 |
|
1237 |
06 Sep 10 |
nicklas |
697 |
parameters.add(hardwareSection); |
1237 |
06 Sep 10 |
nicklas |
698 |
parameters.add(installScannerParameter); |
1237 |
06 Sep 10 |
nicklas |
699 |
parameters.add(scannerNameParameter); |
1237 |
06 Sep 10 |
nicklas |
700 |
parameters.add(scannerVersionParameter); |
1237 |
06 Sep 10 |
nicklas |
701 |
parameters.add(scannerDescriptionParameter); |
1237 |
06 Sep 10 |
nicklas |
702 |
parameters.add(installSoftwareParameter); |
1237 |
06 Sep 10 |
nicklas |
703 |
parameters.add(softwareNameParameter); |
1237 |
06 Sep 10 |
nicklas |
704 |
parameters.add(softwareVersionParameter); |
1237 |
06 Sep 10 |
nicklas |
705 |
parameters.add(softwareDescriptionParameter); |
1237 |
06 Sep 10 |
nicklas |
706 |
|
1237 |
06 Sep 10 |
nicklas |
707 |
|
1237 |
06 Sep 10 |
nicklas |
708 |
parameters.add(errorSection); |
1237 |
06 Sep 10 |
nicklas |
709 |
parameters.add(alreadyInstalledErrorParameter); |
1237 |
06 Sep 10 |
nicklas |
710 |
dc.commit(); |
1237 |
06 Sep 10 |
nicklas |
711 |
configureJob = new RequestInformation |
1237 |
06 Sep 10 |
nicklas |
712 |
( |
1237 |
06 Sep 10 |
nicklas |
713 |
Request.COMMAND_CONFIGURE_JOB, |
1237 |
06 Sep 10 |
nicklas |
714 |
"Select installation options", |
1237 |
06 Sep 10 |
nicklas |
715 |
"Set which parts to install and " + |
1237 |
06 Sep 10 |
nicklas |
716 |
"how to act if items already exists.", |
1237 |
06 Sep 10 |
nicklas |
717 |
parameters |
1237 |
06 Sep 10 |
nicklas |
718 |
); |
1237 |
06 Sep 10 |
nicklas |
719 |
} |
1237 |
06 Sep 10 |
nicklas |
720 |
finally |
1237 |
06 Sep 10 |
nicklas |
721 |
{ |
1237 |
06 Sep 10 |
nicklas |
722 |
if (dc != null) dc.close(); |
1237 |
06 Sep 10 |
nicklas |
723 |
} |
551 |
24 Jan 08 |
martin |
724 |
} |
551 |
24 Jan 08 |
martin |
725 |
return configureJob; |
546 |
18 Jan 08 |
nicklas |
726 |
} |
546 |
18 Jan 08 |
nicklas |
727 |
|
1237 |
06 Sep 10 |
nicklas |
728 |
private boolean isFirstTimeInstallation(DbControl dc) |
577 |
08 Feb 08 |
martin |
729 |
{ |
1237 |
06 Sep 10 |
nicklas |
730 |
Platform illuminaPlatform = null; |
577 |
08 Feb 08 |
martin |
731 |
try |
577 |
08 Feb 08 |
martin |
732 |
{ |
1237 |
06 Sep 10 |
nicklas |
733 |
illuminaPlatform = Platform.getByExternalId(dc, Illumina.PLATFORM_ID); |
577 |
08 Feb 08 |
martin |
734 |
} |
577 |
08 Feb 08 |
martin |
735 |
catch (ItemNotFoundException infex) |
1237 |
06 Sep 10 |
nicklas |
736 |
{} |
1237 |
06 Sep 10 |
nicklas |
737 |
return illuminaPlatform == null; |
1237 |
06 Sep 10 |
nicklas |
738 |
} |
1237 |
06 Sep 10 |
nicklas |
739 |
|
1237 |
06 Sep 10 |
nicklas |
740 |
private boolean variantExists(DbControl dc, String variantId) |
1237 |
06 Sep 10 |
nicklas |
741 |
{ |
1237 |
06 Sep 10 |
nicklas |
742 |
PlatformVariant variant = null; |
1237 |
06 Sep 10 |
nicklas |
743 |
try |
577 |
08 Feb 08 |
martin |
744 |
{ |
1237 |
06 Sep 10 |
nicklas |
745 |
variant = PlatformVariant.getByExternalId(dc, variantId); |
577 |
08 Feb 08 |
martin |
746 |
} |
1237 |
06 Sep 10 |
nicklas |
747 |
catch (ItemNotFoundException infex) |
1237 |
06 Sep 10 |
nicklas |
748 |
{} |
1237 |
06 Sep 10 |
nicklas |
749 |
return variant != null; |
577 |
08 Feb 08 |
martin |
750 |
} |
577 |
08 Feb 08 |
martin |
751 |
|
583 |
12 Feb 08 |
nicklas |
752 |
/** |
736 |
05 Aug 08 |
martin |
Create a new data file type. If an item with the given external ID already exists and ignoreExistingItem=true |
736 |
05 Aug 08 |
martin |
the existing data file type will be updated with new jarPath for validator and metadata reader and then returned, |
736 |
05 Aug 08 |
martin |
otherwise, if ignoreExistingItem=false, an ItemAlreadyExistsException is thrown. |
583 |
12 Feb 08 |
nicklas |
@return The new or existing data file type |
583 |
12 Feb 08 |
nicklas |
757 |
*/ |
551 |
24 Jan 08 |
martin |
758 |
private DataFileType createDataFileType(DbControl dc, String externalId, String name, |
1386 |
06 Sep 11 |
nicklas |
759 |
String description, Item itemType, String extension, ItemSubtype genericType, |
1386 |
06 Sep 11 |
nicklas |
760 |
boolean ignoreExistingItem) |
551 |
24 Jan 08 |
martin |
761 |
throws ItemAlreadyExistsException |
623 |
10 Mar 08 |
martin |
762 |
{ |
551 |
24 Jan 08 |
martin |
763 |
DataFileType dft = null; |
551 |
24 Jan 08 |
martin |
764 |
try |
551 |
24 Jan 08 |
martin |
765 |
{ |
554 |
25 Jan 08 |
martin |
766 |
dft = DataFileType.getByExternalId(dc, externalId); |
554 |
25 Jan 08 |
martin |
767 |
String message = null; |
554 |
25 Jan 08 |
martin |
768 |
if (!ignoreExistingItem) |
554 |
25 Jan 08 |
martin |
769 |
{ |
554 |
25 Jan 08 |
martin |
770 |
throw new ItemAlreadyExistsException(dft.getExternalId()); |
554 |
25 Jan 08 |
martin |
771 |
} |
623 |
10 Mar 08 |
martin |
772 |
if (extension != null && !extension.equals(dft.getExtension())) message += dft.getName() + " has invalid extension.\n"; |
623 |
10 Mar 08 |
martin |
773 |
if (!itemType.equals(dft.getItemType())) message += dft.getName() + " has invalid item type.\n"; |
1385 |
02 Sep 11 |
martin |
774 |
|
736 |
05 Aug 08 |
martin |
775 |
if (message != null) throw new ItemAlreadyExistsException(message + " The existing datafiletype, '" + dft.getName() + "' can not be used."); |
554 |
25 Jan 08 |
martin |
776 |
} |
554 |
25 Jan 08 |
martin |
777 |
catch (ItemNotFoundException infe) |
554 |
25 Jan 08 |
martin |
778 |
{ |
551 |
24 Jan 08 |
martin |
779 |
dft = DataFileType.getNew(dc, externalId, itemType); |
551 |
24 Jan 08 |
martin |
780 |
dc.saveItem(dft); |
551 |
24 Jan 08 |
martin |
781 |
dft.setName(name); |
551 |
24 Jan 08 |
martin |
782 |
dft.setExtension(extension); |
566 |
01 Feb 08 |
nicklas |
783 |
dft.setDescription(description); |
566 |
01 Feb 08 |
nicklas |
784 |
dft.setGenericType(genericType); |
551 |
24 Jan 08 |
martin |
785 |
} |
551 |
24 Jan 08 |
martin |
786 |
return dft; |
551 |
24 Jan 08 |
martin |
787 |
} |
551 |
24 Jan 08 |
martin |
788 |
|
681 |
29 Apr 08 |
jari |
789 |
|
681 |
29 Apr 08 |
jari |
790 |
public ExtraValueType createExtraValueType(DbControl dc, String externalId, Type type, |
808 |
21 Oct 08 |
nicklas |
791 |
String description, boolean ignoreExistingItem) |
681 |
29 Apr 08 |
jari |
792 |
{ |
681 |
29 Apr 08 |
jari |
793 |
ExtraValueType extraValueType = null; |
681 |
29 Apr 08 |
jari |
794 |
try |
681 |
29 Apr 08 |
jari |
795 |
{ |
808 |
21 Oct 08 |
nicklas |
796 |
extraValueType = ExtraValueType.getByExternalId(dc, externalId); |
681 |
29 Apr 08 |
jari |
797 |
if (!ignoreExistingItem) |
681 |
29 Apr 08 |
jari |
798 |
{ |
681 |
29 Apr 08 |
jari |
799 |
throw new ItemAlreadyExistsException(extraValueType.getExternalId()); |
681 |
29 Apr 08 |
jari |
800 |
} |
681 |
29 Apr 08 |
jari |
801 |
} |
681 |
29 Apr 08 |
jari |
802 |
catch (ItemNotFoundException infex) |
681 |
29 Apr 08 |
jari |
803 |
{ |
681 |
29 Apr 08 |
jari |
804 |
extraValueType = ExtraValueType.getNew(dc, externalId, type); |
681 |
29 Apr 08 |
jari |
805 |
extraValueType.setName(externalId); |
681 |
29 Apr 08 |
jari |
806 |
extraValueType.setDescription(description); |
681 |
29 Apr 08 |
jari |
807 |
dc.saveItem(extraValueType); |
681 |
29 Apr 08 |
jari |
808 |
} |
681 |
29 Apr 08 |
jari |
809 |
return extraValueType; |
681 |
29 Apr 08 |
jari |
810 |
} |
681 |
29 Apr 08 |
jari |
811 |
|
681 |
29 Apr 08 |
jari |
812 |
|
583 |
12 Feb 08 |
nicklas |
813 |
public Platform createPlatform(DbControl dc, String externalId, String name, boolean ignoreExistingItem) |
551 |
24 Jan 08 |
martin |
814 |
{ |
551 |
24 Jan 08 |
martin |
815 |
Platform platform = null; |
551 |
24 Jan 08 |
martin |
816 |
try |
551 |
24 Jan 08 |
martin |
817 |
{ |
554 |
25 Jan 08 |
martin |
818 |
platform = Platform.getByExternalId(dc, externalId); |
554 |
25 Jan 08 |
martin |
819 |
if (!ignoreExistingItem) |
554 |
25 Jan 08 |
martin |
820 |
{ |
554 |
25 Jan 08 |
martin |
821 |
throw new ItemAlreadyExistsException(platform.getExternalId()); |
554 |
25 Jan 08 |
martin |
822 |
} |
555 |
28 Jan 08 |
martin |
823 |
String message = null; |
572 |
06 Feb 08 |
martin |
824 |
if (platform.getRawDataType() != null) |
572 |
06 Feb 08 |
martin |
825 |
{ |
623 |
10 Mar 08 |
martin |
826 |
message = "Existing platform has a raw data type that can't be used with " + name + "[" + externalId + "]"; |
572 |
06 Feb 08 |
martin |
827 |
} |
555 |
28 Jan 08 |
martin |
828 |
if (message != null) throw new ItemAlreadyExistsException(message); |
554 |
25 Jan 08 |
martin |
829 |
} |
554 |
25 Jan 08 |
martin |
830 |
catch (ItemNotFoundException infex) |
554 |
25 Jan 08 |
martin |
831 |
{ |
551 |
24 Jan 08 |
martin |
832 |
platform = Platform.getNew(dc, externalId, null); |
551 |
24 Jan 08 |
martin |
833 |
dc.saveItem(platform); |
551 |
24 Jan 08 |
martin |
834 |
platform.setName(name); |
551 |
24 Jan 08 |
martin |
835 |
} |
551 |
24 Jan 08 |
martin |
836 |
return platform; |
551 |
24 Jan 08 |
martin |
837 |
} |
551 |
24 Jan 08 |
martin |
838 |
|
551 |
24 Jan 08 |
martin |
839 |
/* |
551 |
24 Jan 08 |
martin |
Creates variants associated with a raw data type |
551 |
24 Jan 08 |
martin |
841 |
*/ |
583 |
12 Feb 08 |
nicklas |
842 |
public PlatformVariant createPlatformVariant(DbControl dc, String externalId, String name, |
551 |
24 Jan 08 |
martin |
843 |
Platform illuminaPlatform, RawDataType rawDataType, boolean ignoreExistingItem) |
551 |
24 Jan 08 |
martin |
844 |
{ |
551 |
24 Jan 08 |
martin |
845 |
PlatformVariant variant = null; |
551 |
24 Jan 08 |
martin |
846 |
try |
551 |
24 Jan 08 |
martin |
847 |
{ |
554 |
25 Jan 08 |
martin |
848 |
variant = PlatformVariant.getByExternalId(dc, externalId); |
551 |
24 Jan 08 |
martin |
849 |
if (!ignoreExistingItem) |
551 |
24 Jan 08 |
martin |
850 |
{ |
554 |
25 Jan 08 |
martin |
851 |
throw new ItemAlreadyExistsException(variant.getExternalId()); |
551 |
24 Jan 08 |
martin |
852 |
} |
554 |
25 Jan 08 |
martin |
853 |
String message = null; |
572 |
06 Feb 08 |
martin |
854 |
if (variant.isFileOnly()) |
572 |
06 Feb 08 |
martin |
855 |
{ |
572 |
06 Feb 08 |
martin |
856 |
message = "Platform variant " + variant.getExternalId() + " already exists but is file-only"; |
572 |
06 Feb 08 |
martin |
857 |
} |
555 |
28 Jan 08 |
martin |
858 |
else if (variant.getRawDataType() != null && !variant.getRawDataType().equals(rawDataType)) |
555 |
28 Jan 08 |
martin |
859 |
{ |
555 |
28 Jan 08 |
martin |
860 |
message = "Platform variant " + variant.getExternalId() + " already exists but has not the right raw data type"; |
555 |
28 Jan 08 |
martin |
861 |
} |
572 |
06 Feb 08 |
martin |
862 |
else if (!variant.getPlatform().equals(illuminaPlatform)) |
572 |
06 Feb 08 |
martin |
863 |
{ |
572 |
06 Feb 08 |
martin |
864 |
message = "Platform variant " + variant.getExternalId() + " already exists for another platform."; |
572 |
06 Feb 08 |
martin |
865 |
} |
554 |
25 Jan 08 |
martin |
866 |
if (message != null) throw new ItemAlreadyExistsException(message); |
554 |
25 Jan 08 |
martin |
867 |
|
551 |
24 Jan 08 |
martin |
868 |
} |
554 |
25 Jan 08 |
martin |
869 |
catch (ItemNotFoundException infex) |
554 |
25 Jan 08 |
martin |
870 |
{ |
554 |
25 Jan 08 |
martin |
871 |
variant = PlatformVariant.getNew(dc, illuminaPlatform, externalId, rawDataType); |
554 |
25 Jan 08 |
martin |
872 |
dc.saveItem(variant); |
554 |
25 Jan 08 |
martin |
873 |
variant.setName(name); |
554 |
25 Jan 08 |
martin |
874 |
} |
554 |
25 Jan 08 |
martin |
875 |
return variant; |
551 |
24 Jan 08 |
martin |
876 |
} |
546 |
18 Jan 08 |
nicklas |
877 |
|
583 |
12 Feb 08 |
nicklas |
878 |
public Hardware createScanner(DbControl dc, String name, String version, String description) |
583 |
12 Feb 08 |
nicklas |
879 |
{ |
1385 |
02 Sep 11 |
martin |
880 |
ItemSubtype scannerType = ItemSubtype.getById(dc, SystemItems.getId(Hardware.SCANNER)); |
1385 |
02 Sep 11 |
martin |
881 |
Hardware scanner = Hardware.getNew(dc); |
1385 |
02 Sep 11 |
martin |
882 |
scanner.setItemSubtype(scannerType); |
583 |
12 Feb 08 |
nicklas |
883 |
scanner.setName(name); |
583 |
12 Feb 08 |
nicklas |
884 |
scanner.setVersionString(version); |
583 |
12 Feb 08 |
nicklas |
885 |
scanner.setDescription(description); |
583 |
12 Feb 08 |
nicklas |
886 |
dc.saveItem(scanner); |
583 |
12 Feb 08 |
nicklas |
887 |
return scanner; |
583 |
12 Feb 08 |
nicklas |
888 |
} |
583 |
12 Feb 08 |
nicklas |
889 |
|
583 |
12 Feb 08 |
nicklas |
890 |
public Software createSoftware(DbControl dc, String name, String version, String description) |
583 |
12 Feb 08 |
nicklas |
891 |
{ |
1385 |
02 Sep 11 |
martin |
892 |
ItemSubtype featureExtraction = ItemSubtype.getById(dc, SystemItems.getId(Software.FEATURE_EXTRACTION)); |
1385 |
02 Sep 11 |
martin |
893 |
Software software = Software.getNew(dc); |
1385 |
02 Sep 11 |
martin |
894 |
software.setItemSubtype(featureExtraction); |
583 |
12 Feb 08 |
nicklas |
895 |
software.setName(name); |
583 |
12 Feb 08 |
nicklas |
896 |
software.setVersionString(version); |
583 |
12 Feb 08 |
nicklas |
897 |
software.setDescription(description); |
583 |
12 Feb 08 |
nicklas |
898 |
dc.saveItem(software); |
583 |
12 Feb 08 |
nicklas |
899 |
return software; |
583 |
12 Feb 08 |
nicklas |
900 |
} |
583 |
12 Feb 08 |
nicklas |
901 |
|
626 |
12 Mar 08 |
nicklas |
902 |
public Formula createFormula(DbControl dc, String name, Formula.Type type, RawDataType rawDataType, |
626 |
12 Mar 08 |
nicklas |
903 |
Formula.AverageMethod averageMethod, Coloring coloring, String... formulas) |
626 |
12 Mar 08 |
nicklas |
904 |
{ |
626 |
12 Mar 08 |
nicklas |
905 |
Formula formula = Formula.getNew(dc); |
626 |
12 Mar 08 |
nicklas |
906 |
formula.setName(name); |
626 |
12 Mar 08 |
nicklas |
907 |
formula.setRawDataType(rawDataType); |
626 |
12 Mar 08 |
nicklas |
908 |
formula.setFormulaType(type); |
626 |
12 Mar 08 |
nicklas |
909 |
formula.setAverageMethod(averageMethod); |
626 |
12 Mar 08 |
nicklas |
910 |
formula.setFormulas(Arrays.asList(formulas)); |
626 |
12 Mar 08 |
nicklas |
911 |
if (coloring != null) |
626 |
12 Mar 08 |
nicklas |
912 |
{ |
626 |
12 Mar 08 |
nicklas |
913 |
Coloring c = formula.getColoring(); |
626 |
12 Mar 08 |
nicklas |
914 |
c.setUsingColors(coloring.isUsingColors()); |
626 |
12 Mar 08 |
nicklas |
915 |
c.setLogarithmic(coloring.isLogarithmic()); |
626 |
12 Mar 08 |
nicklas |
916 |
c.setMinValue(coloring.getMinValue()); |
626 |
12 Mar 08 |
nicklas |
917 |
c.setMidValue(coloring.getMidValue()); |
626 |
12 Mar 08 |
nicklas |
918 |
c.setMaxValue(coloring.getMaxValue()); |
626 |
12 Mar 08 |
nicklas |
919 |
} |
626 |
12 Mar 08 |
nicklas |
920 |
dc.saveItem(formula); |
626 |
12 Mar 08 |
nicklas |
921 |
return formula; |
626 |
12 Mar 08 |
nicklas |
922 |
} |
626 |
12 Mar 08 |
nicklas |
923 |
|
626 |
12 Mar 08 |
nicklas |
924 |
public Coloring createColoring(boolean logarithmic, Float minValue, Float midValue, Float maxValue) |
626 |
12 Mar 08 |
nicklas |
925 |
{ |
626 |
12 Mar 08 |
nicklas |
926 |
Coloring c = new Coloring(); |
626 |
12 Mar 08 |
nicklas |
927 |
c.setUsingColors(true); |
626 |
12 Mar 08 |
nicklas |
928 |
c.setLogarithmic(logarithmic); |
626 |
12 Mar 08 |
nicklas |
929 |
c.setMinValue(minValue); |
626 |
12 Mar 08 |
nicklas |
930 |
c.setMidValue(midValue); |
626 |
12 Mar 08 |
nicklas |
931 |
c.setMaxValue(maxValue); |
626 |
12 Mar 08 |
nicklas |
932 |
return c; |
626 |
12 Mar 08 |
nicklas |
933 |
} |
626 |
12 Mar 08 |
nicklas |
934 |
|
551 |
24 Jan 08 |
martin |
935 |
/* |
572 |
06 Feb 08 |
martin |
Creates file-only platform variants, eg. SNP |
589 |
20 Feb 08 |
martin |
937 |
*/ |
554 |
25 Jan 08 |
martin |
938 |
private PlatformVariant createPlatformVariant(DbControl dc, String externalId, |
554 |
25 Jan 08 |
martin |
939 |
String name, Platform platform, int channels, boolean ignoreExistingItems) |
551 |
24 Jan 08 |
martin |
940 |
{ |
554 |
25 Jan 08 |
martin |
941 |
PlatformVariant variant = null; |
554 |
25 Jan 08 |
martin |
942 |
try |
554 |
25 Jan 08 |
martin |
943 |
{ |
554 |
25 Jan 08 |
martin |
944 |
variant = PlatformVariant.getByExternalId(dc, externalId); |
554 |
25 Jan 08 |
martin |
945 |
if (!ignoreExistingItems) |
554 |
25 Jan 08 |
martin |
946 |
{ |
554 |
25 Jan 08 |
martin |
947 |
throw new ItemAlreadyExistsException(variant.getExternalId()); |
554 |
25 Jan 08 |
martin |
948 |
} |
554 |
25 Jan 08 |
martin |
949 |
String message = null; |
554 |
25 Jan 08 |
martin |
950 |
if (!variant.isFileOnly()) message = "Platform variant " + variant.getName() + " exists but is not file-only"; |
555 |
28 Jan 08 |
martin |
951 |
else if (!variant.getPlatform().equals(platform)) message = "Platform variant " + variant.getName() + " exists but has not platform: " + platform; |
555 |
28 Jan 08 |
martin |
952 |
else if (variant.getRawDataType().getChannels() != channels) message = "Platform variant " + variant.getName() + " exists but not for " + channels + " data"; |
554 |
25 Jan 08 |
martin |
953 |
if (message != null) throw new InvalidDataException (message); |
554 |
25 Jan 08 |
martin |
954 |
} |
554 |
25 Jan 08 |
martin |
955 |
catch (ItemNotFoundException infex) |
554 |
25 Jan 08 |
martin |
956 |
{ |
554 |
25 Jan 08 |
martin |
957 |
variant = PlatformVariant.getNew(dc, platform, externalId, channels); |
554 |
25 Jan 08 |
martin |
958 |
dc.saveItem(variant); |
554 |
25 Jan 08 |
martin |
959 |
variant.setName(name); |
554 |
25 Jan 08 |
martin |
960 |
} |
554 |
25 Jan 08 |
martin |
961 |
return variant; |
589 |
20 Feb 08 |
martin |
962 |
} |
681 |
29 Apr 08 |
jari |
963 |
} |