logger.info("Creating probe for " + target.getID()); //$NON-NLS-1$
byte probeAcidType = Byte.parseByte(parameters.get(PROP_PROBE_ACID_TYPE));
int up = Integer.parseInt(parameters.get(PROP_UPSTREAM_BLOCKS));
int down = Integer.parseInt(parameters.get(PROP_DOWNSTREAM_BLOCKS));
String id = namer.getProbeID(project, target);
Probe p = ProbeMakerSequenceFactory.createProbeSkeleton(id, pairs[tindex],probeAcidType,up,down,probes);
p.setName(namer.getProbeName(project, target));
//and add it to the probe db and newProbe list
probes.addSequence(p);
newProbes.addSequence(p);
}
catch (Exception ex) {
log.printLine("A problem occurred"); //$NON-NLS-1$
log.printError(ex.getMessage());
handler.handleError(ex.toString(),ex);
}
tindex++;
}
//The newProbe method has set the group fields of each probe, so we make a
//list of all groups that are new (when appending, it is necessary to
//separate new and old groups).
List<Identifiable> newGroupsAndProbes = new ArrayList<Identifiable>();
for (Iterator<Probe> pi = newProbes.iterator(); pi.hasNext(); ) {
Probe pr = pi.next();
ProbeGroup pg = (ProbeGroup) DesignUtils.getGroupWithType(pr, ProbeGroup.GROUP_TYPE);
if (pg == null) {
//If no group, add the probe instead
newGroupsAndProbes.add(pr);
}
else if (!newGroupsAndProbes.contains(pg)) {
newGroupsAndProbes.add(pg);
}
}
//Screen the tags through the modules
/*if (screentags) {
setStatus(UITexts.getString("ProbeDesignTask.MESSAGE_SCREENING_TAGS")); //$NON-NLS-1$
List allModules = new ArrayList();
allModules.addAll(project.getSettings().getArmModules());
allModules.addAll(project.getSettings().getCandidateModulesStage1());
allModules.addAll(project.getSettings().getCandidateModulesStage2());
pd.screenTags(allModules);
*/
fireStatusChange(0,CoreMessages.getString("ProbeDesignTask.MESSAGE_ALLOCATING_TAGS")); //$NON-NLS-1$
//The probes db now contains all probes with TSSs only.
//Now go through each new probegroup and allocate tags to the probes.
int groupindex = 0; //status marker
for (Iterator<Identifiable> gi = newGroupsAndProbes.iterator(); gi.hasNext(); ) {
if (aborted()) return false;
groupindex++;
logger.info("Designing probes for group " + (groupindex)); //$NON-NLS-1$*/
try {
Object o = gi.next();
if (o instanceof ProbeGroup) {
ProbeGroup pg = (ProbeGroup) o;
fireStatusChange(0,"Group " + (groupindex)); //$NON-NLS-1$
allocator.allocateTagsToGroup(pg);
//When the probes are finished confirm them and increment the progress value
for (Iterator<Probe> pi = pg.getMembers().iterator(); pi.hasNext(); ) {
allocator.confirm(pi.next());
progress++;
fireProgressChange(progress);
}
}
else {
Probe p = (Probe) o;
ProbeGroup pg = new ProbeGroup(null,"DUMMY"); //$NON-NLS-1$
pg.addMember(p);
fireStatusChange(0,"Group " + (groupindex)); //$NON-NLS-1$
allocator.allocateTagsToGroup(pg);
//When the probes are finished confirm them and increment the progress value
for (Iterator<Probe> pi = pg.getMembers().iterator(); pi.hasNext(); ) {
allocator.confirm(pi.next());
progress++;
fireProgressChange(progress);
}
pg.removeMember(p);
}
}
catch (Exception ex) {
log.printLine("A problem occurred"); //$NON-NLS-1$
log.printError(ex.getMessage());
handler.handleError(ex.toString(),ex);
}
}
//Recalculate the probe qualities and finish up the work
for (Iterator<Probe> i = probes.iterator(); i.hasNext(); ) {
if (aborted()) return false;
Probe p = i.next();
Analyzer.calculateAndSetQuality(p);
}
elapsedTime = System.currentTimeMillis() - startTime;