Changeset 1149
- Timestamp:
- Aug 25, 2009, 2:33:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/plugins/BeadSummaryImporter.java
r943 r1149 87 87 import net.sf.basedb.util.ChainedProgressReporter; 88 88 import net.sf.basedb.util.MD5; 89 import net.sf.basedb.util.Values; 89 90 import net.sf.basedb.util.error.ClassMapErrorHandler; 90 91 import net.sf.basedb.util.error.ErrorHandler; … … 146 147 "This can for example happen if an incorrect array design is used.\n\n"+ 147 148 "skip = Skip the current data line and continue\n"+ 149 "auto = Skip and continue unless the threshold is reached\n" + 148 150 "fail = Stop with an error message", 149 new StringParameterType(255, "skip", false, 1, 0, 0, 150 Arrays.asList( new String[] { "skip", "fail"} )) 151 new StringParameterType(255, "auto", false, 1, 0, 0, 152 Arrays.asList( new String[] { "skip", "auto", "fail"} )) 153 ); 154 155 private static final PluginParameter<String> thresholdParameter = 156 new PluginParameter<String>( 157 "featureMismatchThreshold", 158 "Probe not found: threshold", 159 "If the 'Probe not found' options is set to auto the plug-in will skip " + 160 "data lines until the threshold is reached. If the threshold is reached, the " + 161 "plug-in stops with an error message. The threshold can be given as a percentage " + 162 "or as an absolute value.", 163 new StringParameterType(255, "5%", false) 151 164 ); 152 165 … … 170 183 */ 171 184 private ClassMapErrorHandler errorHandler; 185 private boolean useAutoFeatureMismatchErrorHandling; 186 private String featureMismatchThreshold; 172 187 173 188 … … 387 402 storeValue(job, request, ri.getParameter(Parameters.DEFAULT_ERROR)); 388 403 storeValue(job, request, featureMismatchErrorParameter); 404 storeValue(job, request, thresholdParameter); 389 405 storeValue(job, request, ri.getParameter(Parameters.INVALID_USE_OF_NULL_ERROR)); 390 406 storeValue(job, request, ri.getParameter(Parameters.NUMBER_FORMAT_ERROR)); … … 547 563 548 564 parameters.add(featureMismatchErrorParameter); 565 parameters.add(thresholdParameter); 549 566 parameters.add(Parameters.invalidUseOfNullError(null, null, null)); 550 567 parameters.add(Parameters.numberFormatError(null, … … 792 809 done++; 793 810 } 811 812 if (useAutoFeatureMismatchErrorHandling) 813 { 814 int maxSkipped = 0; 815 if (featureMismatchThreshold == null) featureMismatchThreshold = "5%"; 816 if (featureMismatchThreshold.endsWith("%")) 817 { 818 int percentage = Values.getInt(featureMismatchThreshold.substring(0, featureMismatchThreshold.length()-1)); 819 maxSkipped = (numLines * percentage) / 100; 820 } 821 else 822 { 823 maxSkipped = Values.getInt(featureMismatchThreshold); 824 } 825 if (batcher.getNumSkippedMissingFeature() > maxSkipped) 826 { 827 throw new BaseException("Too many 'Not found probes'. " + 828 batcher.getNumSkippedMissingFeature() + 829 " > threshold (" + featureMismatchThreshold + ")"); 830 } 831 } 832 794 833 batcher.flush(); 795 834 batcher.close(); … … 840 879 ErrorHandler defaultErrorHandler = new SimpleErrorHandler("skip".equals(config.getValue("defaultError"))); 841 880 errorHandler = new ClassMapErrorHandler(defaultErrorHandler); 842 addErrorHandler(ItemNotFoundException.class, 843 createErrorHandler((String)config.getValue("featureMismatchError"), defaultErrorHandler)); 881 String featureMismatchError = (String)config.getValue("featureMismatchError"); 882 useAutoFeatureMismatchErrorHandling = "auto".equals(featureMismatchError); 883 if (useAutoFeatureMismatchErrorHandling) 884 { 885 addErrorHandler(ItemNotFoundException.class, 886 createErrorHandler("skip", defaultErrorHandler)); 887 featureMismatchThreshold = (String)config.getValue("featureMismatchThreshold"); 888 } 889 else 890 { 891 addErrorHandler(ItemNotFoundException.class, 892 createErrorHandler(featureMismatchError, defaultErrorHandler)); 893 } 844 894 addErrorHandler(InvalidUseOfNullException.class, 845 895 createErrorHandler((String)config.getValue("invalidUseOfNullError"), defaultErrorHandler));
Note: See TracChangeset
for help on using the changeset viewer.