proj.getTagAllocationTable().clearUsed();
//Two probes single tag unique, with dummy. Expect first ok, second bad
proj.getSettings().getCandidateModulesStage2().add(dummy);
ProbeDesignTask task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new AllAcceptor(),
new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
task.run();
p1 = proj.getProbes().getSequenceAt(0);
p2 = proj.getProbes().getSequenceAt(1);
assertEquals(ProbeMakerPropertyUtils.getAllMessages(p1).size(),1);
assertEquals(ProbeMakerPropertyUtils.getRank(p1),ProbeMakerConstants.OK_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p2),ProbeMakerConstants.BAD_QUALITY);
assertEquals(task.getCandidatesGenerated(),1);
proj.getTagAllocationTable().clearUsed();
//Test single-tag use same
libraries1_1[0].setMode(TagLibrary.USE_SAME_TAG);
proj.setTagSettings(new DefaultTagSettings(libraries1_1));
proj.getSettings().getCandidateModulesStage2().clear();
pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new AllAcceptor(),
new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
p1 = proj.getProbes().getSequenceAt(0);
p2 = proj.getProbes().getSequenceAt(1);
assertEquals(ProbeMakerPropertyUtils.getRank(p1),ProbeMakerConstants.GOOD_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p2),ProbeMakerConstants.GOOD_QUALITY);
// Test single-tag use unique in group with one expanded
//expect first probe to succeed but be set to bad when second one failed
//Third probe then set to good
proj.getTagAllocationTable().clearUsed();
libraries1_1[0].setMode(TagLibrary.USE_UNIQUE_IN_GROUP);
proj.setTagSettings(new DefaultTagSettings(libraries1_1));
proj.getTargets().clear();
proj.getTargets().addSequence(t1);
TargetHandler.expandTargets(proj.getTargets());
proj.getTargets().addSequence(t2);
task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new AllAcceptor(),
new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
task.run();
p1 = proj.getProbes().getSequenceAt(0);
p2 = proj.getProbes().getSequenceAt(1);
Probe p3 = proj.getProbes().getSequenceAt(2);
assertEquals(ProbeMakerPropertyUtils.getRank(p1),ProbeMakerConstants.BAD_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p2),ProbeMakerConstants.BAD_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p3),ProbeMakerConstants.GOOD_QUALITY);
assertEquals(task.getCandidatesGenerated(),2);
libraries1_1[0].setMode(TagLibrary.USE_UNIQUE_TAG);
// Test single-tag use same with one expanded
libraries2_1_1[0].setMode(TagLibrary.USE_UNIQUE_TAG);
libraries2_1_1[1].setMode(TagLibrary.USE_UNIQUE_IN_GROUP);
proj.setTagSettings(new DefaultTagSettings(libraries2_1_1));
proj.getTargets().clear();
proj.getTargets().addSequence(t1);
TargetHandler.expandTargets(proj.getTargets());
proj.getTargets().addSequence(t2);
task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new AllAcceptor(),
new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
task.run();
p1 = proj.getProbes().getSequenceAt(0);
p2 = proj.getProbes().getSequenceAt(1);
p3 = proj.getProbes().getSequenceAt(2);
NucleotideSequence tag1 = libraries2_1_1[0].getSequenceAt(0);
assertEquals(proj.getTagAllocationTable().getUserIDs(tag1).contains(p1.getID()),false);
assertEquals(proj.getTagAllocationTable().getUserIDs(tag1).contains(p3.getID()),true);
assertEquals(2, task.getCandidatesGenerated());
assertEquals(ProbeMakerPropertyUtils.getRank(p1),ProbeMakerConstants.BAD_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p2),ProbeMakerConstants.BAD_QUALITY);
assertEquals(ProbeMakerPropertyUtils.getRank(p3),ProbeMakerConstants.GOOD_QUALITY);
libraries2_1_1[0].setMode(TagLibrary.USE_UNIQUE_TAG);