Changeset 833
- Timestamp:
- Nov 28, 2008, 2:15:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/plugins/DetectionPValue.java
r700 r833 63 63 import net.sf.basedb.core.query.SqlResult; 64 64 import net.sf.basedb.core.signal.SignalHandler; 65 import net.sf.basedb.core.signal.SignalReceivedException;66 65 import net.sf.basedb.core.signal.SignalTarget; 67 66 import net.sf.basedb.core.signal.ThreadSignalHandler; … … 123 122 "Illumina Focused Arrays (not yet implemented)", 124 123 new StringParameterType(255, "Whole Genome BeadChip", true, 1, 0, 0, 125 Arrays.asList( 126 new String[] { "Whole Genome BeadChip" , 127 "Focused Array (not yet implemented)" } 128 ) 124 Arrays.asList( 125 new String[] { "Whole Genome BeadChip", "Focused Array (not yet implemented)" } 129 126 ) 130 ); 127 ) 128 ); 131 129 132 130 private static final String defaultChildName="Detection P-value"; … … 167 165 { 168 166 response.setError(errors.size() + 169 " invalid parameter(s) were found in the request", 170 errors); 167 " invalid parameter(s) were found in the request", errors); 171 168 return; 172 169 } … … 186 183 Job.ExecutionTime execTime = Job.ExecutionTime.SHORT; 187 184 DbControl dc = sc.newDbControl(); 188 try { 185 try 186 { 189 187 BioAssaySet source = getSourceBioAssaySet(dc); 190 188 int nofAssays = source.getBioAssays().list(dc).size(); 191 189 if (nofAssays>10 && nofAssays<30) 190 { 192 191 execTime = Job.ExecutionTime.MEDIUM; 192 } 193 193 else if (nofAssays>=30) 194 { 194 195 execTime = Job.ExecutionTime.LONG; 196 } 195 197 } 196 finally {197 if (dc != null)198 198 finally 199 { 200 if (dc != null) dc.close(); 199 201 } 200 202 response.setDone("Job configuration complete", execTime); 201 203 } 202 }203 catch (SignalReceivedException ex)204 {205 response.setError("Aborted by user", Arrays.asList(ex));206 204 } 207 205 catch (Throwable ex) … … 259 257 if (permissions.size() == 0) 260 258 { 261 permissions.add(new Permissions(Item.EXPERIMENT, null, 262 EnumSet.of(Permission.USE))); 263 permissions.add(new Permissions(Item.EXTRAVALUETYPE, null, 264 EnumSet.of(Permission.USE))); 265 permissions.add(new Permissions(Item.JOB, null, 266 EnumSet.of(Permission.READ))); 259 permissions.add(new Permissions(Item.EXPERIMENT, null, EnumSet.of(Permission.USE))); 260 permissions.add(new Permissions(Item.EXTRAVALUETYPE, null, EnumSet.of(Permission.USE))); 261 permissions.add(new Permissions(Item.JOB, null, EnumSet.of(Permission.READ))); 267 262 } 268 263 return permissions; … … 276 271 { 277 272 if (cmd.equals(Request.COMMAND_CONFIGURE_JOB)) 273 { 278 274 return getConfigureJobParameters(); 275 } 279 276 return null; 280 277 } … … 303 300 DbControl dc = null; 304 301 Experiment experiment = null; 305 try { 302 try 303 { 306 304 dc = sc.newDbControl(); 307 305 experiment=getCurrentExperiment(dc); … … 309 307 finally 310 308 { 311 if (dc != null) 312 dc.close(); 309 if (dc != null) dc.close(); 313 310 } 314 311 if (Illumina.getBeadSummaryType() != experiment.getRawDataType()) 315 312 { 316 message = ("The experiment (" + experiment + 317 ") is not Illumina expression data"); 313 message = "The experiment (" + experiment + ") is not Illumina expression data"; 318 314 } 319 315 } … … 328 324 float[] absMedianDistance=new float[sortedIntensity.length]; 329 325 for (int i=0; i<absMedianDistance.length; ++i) 326 { 330 327 absMedianDistance[i]=Math.abs(sortedIntensity[i]-controlMedian); 328 } 331 329 Arrays.sort(absMedianDistance); 332 330 float MAD=median(absMedianDistance); … … 335 333 int controlstart=0; 336 334 while ((controlMedian-sortedIntensity[controlstart]) > MADcut) 335 { 337 336 controlstart++; 337 } 338 338 int controlend=sortedIntensity.length; 339 339 while ((sortedIntensity[--controlend]-controlMedian) > MADcut); … … 380 380 dc = sc.newDbControl(); 381 381 BioAssaySet source = getSourceBioAssaySet(dc); 382 String childName = Values.getString((String)job.getValue(CHILD_NAME), 383 source.getName()); 382 String childName = Values.getString((String)job.getValue(CHILD_NAME), source.getName()); 384 383 String childDescription = (String)job.getValue(CHILD_DESCRIPTION); 385 384 … … 421 420 { 422 421 // Batcher for inserting child data 423 SpotExtraValueBatcher<Float> batcher =424 child.getSpotExtraValueBatcher(Float.class,425 ExtraValueType.getByExternalId(dc,Illumina.DETECTION_PVALUE_ID),426 422 SpotExtraValueBatcher<Float> batcher = child.getSpotExtraValueBatcher( 423 Float.class, 424 ExtraValueType.getByExternalId(dc, Illumina.DETECTION_PVALUE_ID), 425 thisJob); 427 426 428 427 // Caluclate one bioassay at a time … … 435 434 if (progress != null) 436 435 { 437 progress.display(100*assayNo/nofAssays, "Treating assay " +438 436 progress.display(100*assayNo/nofAssays, 437 "Treating assay " + (assayNo+1) + " of " + nofAssays + "."); 439 438 } 440 439 … … 454 453 } 455 454 dri.close(); 456 int[] controlStartStop= 457 locateOutlierBoundary(sortedControlIntensity, 458 (Float)job.getValue(outlierParameter.getName())); 455 int[] controlStartStop = locateOutlierBoundary(sortedControlIntensity, 456 (Float)job.getValue(outlierParameter.getName())); 459 457 460 458 checkInterrupted(); … … 471 469 SqlResult result = dri.next(); 472 470 batcher.insert(result.getShort(columnIndex), result.getInt(positionIndex), 473 474 471 pvalue(sortedControlIntensity, controlStartStop[0], 472 controlStartStop[1], result.getFloat(ch1Index))); 475 473 } 476 474 dri.close();
Note: See TracChangeset
for help on using the changeset viewer.