Package org.moltools.apps.probemaker.project

Examples of org.moltools.apps.probemaker.project.Project


    proj.getSettings().getCandidateModulesStage1().clear();   
  }

  public void testPairwise() throws DuplicateIDException  {

    Project proj = new Project("Test project");     //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings((libraries1_10)));
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);
    pm.setProject(proj);

    //Run test to fail all    
    ProbeDesignTask task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(),
        new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));

    task.run();
    long candCount = task.getCandidatesGenerated();

    assertTrue("Pairwise allocation (Stage 1 module), 10 candidates expected, " + candCount + " generated.",candCount == 10); //$NON-NLS-1$ //$NON-NLS-2$

    //Move dummy to arm stage, check that there are no candidates generated
    proj.getSettings().getCandidateModulesStage1().clear();
    proj.getSettings().getArmModules().add(dummy);

    task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(),
        new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
    task.run();   
    candCount = task.getCandidatesGenerated();

    assertTrue("Pairwise allocation (TSS module), 0 candidates expected, " + candCount + " generated.",candCount==0); //$NON-NLS-1$ //$NON-NLS-2$

//  Expand target and test use unique mode, 2 candidates expected
    TargetHandler.expandTargets(pm.getProject().getTargets());
    proj.getSettings().getArmModules().clear();   

    task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(),
        new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
    task.run();
    candCount = task.getCandidatesGenerated();
    Probe p1 = pm.getProject().getProbes().getSequenceAt(0);
    Probe p2 = pm.getProject().getProbes().getSequenceAt(1);

    assertTrue("2 candidates expected, " + candCount + " generated.",candCount == 2); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue("Same tags allocated in unique mode!",p1.getTagAt(0)!=p2.getTagAt(0)); //$NON-NLS-1$

//  Expand target and test use per group, no modules, 2 candidates expected       
    libraries1_10[0].setMode(TagLibrary.USE_PER_GROUP);          

    task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(),
        new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
    task.run();
    candCount = task.getCandidatesGenerated();
    p1 = pm.getProject().getProbes().getSequenceAt(0);
    p2 = pm.getProject().getProbes().getSequenceAt(1);

    assertTrue("2 candidates expected, " + candCount + " generated.",candCount == 2); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue("Different tags allocated in group mode!",p1.getTagAt(0)==p2.getTagAt(0)); //$NON-NLS-1$

//  Still expanded targets, per group mode, greedy allocator, dummy module in stage 1.
    //Expect 20 candidates generated
    libraries1_10[0].setMode(TagLibrary.USE_PER_GROUP);          
    proj.getSettings().getCandidateModulesStage1().add(dummy);   
      
    task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(),
        new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
    task.run();
   
View Full Code Here


    candCount = task.getCandidatesGenerated();   
    assertTrue("20 candidates expected, " + candCount + " generated.",candCount == 20);      //$NON-NLS-1$ //$NON-NLS-2$
  }

  public void testTwoProbesDesign() throws Exception {
    Project proj = new Project("Test project");     //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings(libraries1_1));
   
    //Two probes, single uniqe tag. One good one failed expected.
    proj.getTagAllocationTable().clearUsed();   
    proj.getTargets().addSequence(t1);   
    proj.getTargets().addSequence(t2);   
    pm.setProject(proj);
   
    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();

    Probe p1 = proj.getProbes().getSequenceAt(0);
    Probe p2 = proj.getProbes().getSequenceAt(1);

    assertEquals(ProbeMakerPropertyUtils.getRank(p1),ProbeMakerConstants.GOOD_QUALITY);
    assertEquals(ProbeMakerPropertyUtils.getRank(p2),ProbeMakerConstants.BAD_QUALITY);

    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);
    libraries2_1_1[1].setMode(TagLibrary.USE_UNIQUE_TAG);
    proj.getTagAllocationTable().clearUsed();   
   
  }
View Full Code Here

            CoreMessages.getString("ProbeMakerPlugIn.MESSAGE_DEFAULT_SETTINGS_NOT_READ"),                                       //$NON-NLS-1$
            iox);
      }
    }

    final Project newp = new Project(name);
    newp.setSettings(s);

    //If template was selected, get template properties
    if (template != null) {
      final String fileName = template.getSettingsFileName();
      if (fileName == null || fileName.length() == 0) {
        platform.getUI().sendMessage("No settings file set for this template. Using default settings.", "No settings file", PlatformUI.NO_QUERY);
      }
      else {
        final File f = new File(fileName);
        try {
          final Reader in = new FileReader(f);
          newp.setSettings(SettingsIO.inputSettings(in));
        }
        catch (final FileNotFoundException e) {
          platform.handleError("Template settings file not found: " + f.getAbsolutePath(),e); //$NON-NLS-1$
        }
        catch (final Exception e) {
View Full Code Here

  }
 
  public void testPairwiseWarnings() throws Exception {


    Project proj = new Project("Test project");     //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings(libraries1_10));
    proj.getTagAllocationTable().clearUsed();
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);
    pm.setProject(proj);
    TargetHandler.expandTargets(pm.getProject().getTargets());

    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();

    Probe p = proj.getProbes().getSequenceAt(0);
    Probe p2 = proj.getProbes().getSequenceAt(1);

    //Move dummy to arm stage
    proj.getSettings().getCandidateModulesStage1().clear();
    proj.getSettings().addCandidateModuleStage2(dummy);
    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();

    Probe p3 = proj.getProbes().getSequenceAt(0);
    Probe p4 = proj.getProbes().getSequenceAt(1);

//  Check that both probes of fair rank  
    assertTrue("Probe 1 (stage 1) expected to be of fair quality",ProbeMakerPropertyUtils.getRank(p)==ProbeMakerConstants.OK_QUALITY); //$NON-NLS-1$
    assertTrue("Probe 2 (stage 1) expected to be of fair quality",ProbeMakerPropertyUtils.getRank(p2)==ProbeMakerConstants.OK_QUALITY); //$NON-NLS-1$
View Full Code Here

    Probe[] probes = pm.getProject().getProbes().getSequenceList().toArray(new Probe[5]);
    return probes;
  }
 
  public void testModes() throws DuplicateIDException {
    Project proj = new Project("Test project");     //$NON-NLS-1$
    pm.setProject(proj);
    proj.setTagSettings(new DefaultTagSettings(libraries1_10));
    proj.getTargets().addSequence(t1);
    proj.getTargets().addSequence(t2);
    TargetHandler.expandTargets(pm.getProject().getTargets());
    pm.setProject(proj);
  
    TagLibrary lib = libraries1_10[0];
View Full Code Here

  }
 
  @Override
  protected void setUp() throws DuplicateIDException, FileNotFoundException, IOException, SequenceFormatException {
    pm = new ProbeMakerPlugIn();
    project = new Project("Mfold_test"); //$NON-NLS-1$
    pm.setProject(project);
    m = new DINAMeltSecStructModule();   
    project.getSettings().addCandidateModuleStage1(m);   
    Collection<Probe> seqs = SequenceIO.readSequences(new InputStreamReader(getClass().getResourceAsStream("mfold_test.lib")),new IDAndNameFastaFormatter<Probe>(),DefaultProbe.getSequenceBuilder()); //$NON-NLS-1$
    project.getProbes().addSequences(seqs);
View Full Code Here

TOP

Related Classes of org.moltools.apps.probemaker.project.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.