Package org.moltools.apps.probemaker.project

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


  }

  public void testTagAllocation() throws DuplicateIDException {

    //New project, single target, single tag lib
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings((libraries1_1)));
    proj.getTargets().addSequence(t1);
    pm.setProject(proj);

    //First design, expected to result in a tag being allocated,
    //and the tag allocation table marking the tag as used
    pm.getProbeDesignTask(false, true, false, new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true)).run();
    Probe p = proj.getProbes().getSequenceAt(0);
   
    assertTrue("Tag allocation failed", p.getTags().size()==1);    //$NON-NLS-1$

    //New design, without tag reset, expected to fail because tag is already used
    pm.getProbeDesignTask(false, false, false, new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true)).run();  
    p = proj.getProbes().getSequenceAt(0);
   
    assertTrue("Tag allocation should have failed due to no tags left, but seems to have succeeded",p.getTags().size() == 0); //$NON-NLS-1$
   
    //New design, with reset. Expected to succeed because no tags should be used now
    pm.getProbeDesignTask(false, true, false, new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true)).run();          
    p = proj.getProbes().getSequenceAt(0);   
   
    assertTrue("Tag allocation failed after reset",p.getTags().size() == 1);     //$NON-NLS-1$

  }
View Full Code Here


  }
 
  public void testAcceptOK() throws DuplicateIDException {

      //New project, single target, single tag lib
      Project proj = new Project("Test project"); //$NON-NLS-1$
      proj.setTagSettings(new DefaultTagSettings(libraries1_1));
      proj.getTargets().addSequence(t1);
      pm.setProject(proj);
     
      proj.getSettings().addArmModule(new AbstractProbeModule(null,null) {
     
      public void reset() {
        //Noop   
      }
   
      public void doConfirmUpdate(Probe p, TagAllocator pd,
          DefiniteSequenceDB<? extends Probe> otherProbes) {
        //Noop   
      }
   
      public void doAnalysis(Probe p, TagAllocator pd,
          DefiniteSequenceDB<? extends Probe> otherProbes) {
        ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
            "Dummy", //$NON-NLS-1$
            new MessageType("DUMMY", "Dummy"),
            Message.WARNING));
   
      }   
    });
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"false");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
     
      //First design, expected to result in failure.
      pm.getProbeDesignTask(false, true, false, new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true)).run();
      Probe p = proj.getProbes().getSequenceAt(0);
              
      assertEquals("Tag allocation should have failed", 0, p.getTags().size());    //$NON-NLS-1$
      assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));     
     
     
    //New design, with accept OK pairs. Expected to generate candidates, but fail.     
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
      ProbeDesignTask task = pm.getProbeDesignTask(false, true, false, new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true));
      task.run();
      long candCount = task.getCandidatesGenerated();
      p = proj.getProbes().getSequenceAt(0);
     
      assertEquals("Tag allocation should have failed", 0, p.getTags().size());    //$NON-NLS-1$
      assertEquals("Candidates expected", libraries1_1[0].size() , candCount);
      assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));     
     
    //New design, with accept OK pairs AND candidates. Expected to generate candidates, and find candidate with warning.     
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"true");
      task = pm.getProbeDesignTask(false, true, true, new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true));
      task.run();
      candCount = task.getCandidatesGenerated();
      p = proj.getProbes().getSequenceAt(0);
      System.out.println("Probe");
      for (Iterator<KeyValue> i = p.getPropertySet().getKeyValueIterator();i.hasNext();) {
        System.out.println(i.next());
      }
      System.out.println("TSS Pair");
View Full Code Here

     
    }
 
  public void testTagAllocationWithWarning() throws DuplicateIDException {
   
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings(libraries1_1));
    proj.getTagAllocationTable().clearUsed();
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);

    pm.setProject(proj);

    //Make a new design after clearing tag usage   
    Task task = pm.getProbeDesignTask(false, true, true, new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true));
    task.run();
    Probe p = proj.getProbes().getSequenceAt(0);
    assertTrue("Tag allocated despite warning message",p.getTags().size() == 0); //$NON-NLS-1$

    proj.getSettings().getCandidateModulesStage1().clear();
  }
View Full Code Here

    pm = new ProbeMakerPlugIn();
    ProbeMakerTarget t1 = new AlleleSpecificPadlockTarget("T1","ACTACGAGCGACGAGC|ACACGCTACATCGAGC","Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    VariantTarget t2 = new MinisequencingTarget("T2","ACTACGAGCGACGAGCSACACGCTACATCGAGC","Target 2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    t2.setVariant(t2.getVariants()[0]);
    ProbeMakerTarget t3 = new UnchangedTarget("T3","ACGTCAGCGAGCGACGACTACTACGAC","Target 3"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    project = new Project("IOTest"); //$NON-NLS-1$
    pm.setProject(project);
    project.getTargets().addSequence(t1);
    project.getTargets().addSequence(t2);
    project.getTargets().addSequence(t3);
    ListSequenceDB<NucleotideSequence> tags1 = new ListSequenceDB<NucleotideSequence>();
View Full Code Here

  }
 
  public void testOne() throws Exception {
   
    pm = new ProbeMakerPlugIn();
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
       
    pm.setProject(proj);
   
    AlleleSpecificPadlockTarget t1 = new AlleleSpecificPadlockTarget("T1", "GGGGGGGGGGGGGGGGGGGGGG|GGGGGGGGGGGGGGGGGGGGGGGG", "Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    AlleleSpecificPadlockTarget t2 = new AlleleSpecificPadlockTarget("T2", "GGGGGGGGGGGGGGGGGGGGGG|GGGGGGGGGGGGGGGGGGGGGGGG", "Target 2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
View Full Code Here

  }

  public void testTagAllocation() throws DuplicateIDException {

    //New project, single target, single tag lib
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings((libraries1_1)));
    proj.getTargets().addSequence(t1);
    pm.setProject(proj);

    //First design, expected to result in a tag being allocated,
    //and the tag allocation table marking the tag as used
    pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
    Probe p = proj.getProbes().getSequenceAt(0);
   
    assertTrue("Tag allocation failed", p.getTags().size()==1);    //$NON-NLS-1$

    //New design, without tag reset, expected to fail because tag is already used
    pm.getProbeDesignTask(false, false, null, new DefaultNamingScheme(), new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();  
    p = proj.getProbes().getSequenceAt(0);
   
    assertTrue("Tag allocation should have failed due to no tags left, but seems to have succeeded",p.getTags().size() == 0); //$NON-NLS-1$
   
    //New design, with reset. Expected to succeed because no tags should be used now
    pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();          
    p = proj.getProbes().getSequenceAt(0);   
   
    assertTrue("Tag allocation failed after reset",p.getTags().size() == 1);     //$NON-NLS-1$

  }
View Full Code Here

  }
 
  public void testAcceptOK() throws DuplicateIDException {

      //New project, single target, single tag lib
      Project proj = new Project("Test project"); //$NON-NLS-1$
      proj.setTagSettings(new DefaultTagSettings(libraries1_1));
      proj.getTargets().addSequence(t1);
      pm.setProject(proj);
     
      proj.getSettings().addArmModule(new AbstractProbeModule(null,null) {
     
      public void reset() {
        //Noop   
      }
   
      public void doConfirmUpdate(Probe p, TagAllocator pd,
          DefiniteSequenceDB<? extends Probe> otherProbes) {
        //Noop   
      }
   
      public void doAnalysis(Probe p, TagAllocator pd,
          DefiniteSequenceDB<? extends Probe> otherProbes) {
        ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
            "Dummy", //$NON-NLS-1$
            new MessageType("DUMMY", "Dummy"),
            Message.WARNING));
   
      }   
    });
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"false");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
     
      //First design, expected to result in failure.
      pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
      Probe p = proj.getProbes().getSequenceAt(0);
              
      assertEquals("Tag allocation should have failed", 0, p.getTags().size());    //$NON-NLS-1$
      assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));     
     
     
    //New design, with accept OK pairs. Expected to generate candidates, but fail.     
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"false");
      ProbeDesignTask task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
      task.run();
      long candCount = task.getCandidatesGenerated();
      p = proj.getProbes().getSequenceAt(0);
     
      assertEquals("Tag allocation should have failed", 0, p.getTags().size());    //$NON-NLS-1$
      assertEquals("Candidates expected", libraries1_1[0].size() , candCount);
      assertEquals("Quality expected to be bad", ProbeMakerConstants.BAD_QUALITY, ProbeMakerPropertyUtils.getRank(p));     
     
    //New design, with accept OK pairs AND candidates. Expected to generate candidates, and find candidate with warning.     
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_ARMS,"true");
      proj.getSettings().getDesignParameters().put(Analyzer.PROP_ACCEPT_OK_CANDIDATES,"true");
      task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodFairAcceptor(), new BestQualitySelector(), new DefaultProbeDesigner(new GreedyTagAllocator()), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
      task.run();
      candCount = task.getCandidatesGenerated();
      p = proj.getProbes().getSequenceAt(0);
      System.out.println("Probe");
      for (Iterator<KeyValue> i = p.getPropertySet().getKeyValueIterator();i.hasNext();) {
        System.out.println(i.next());
      }
      System.out.println("TSS Pair");
View Full Code Here

     
    }
 
  public void testTagAllocationWithWarning() throws DuplicateIDException {
   
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.setTagSettings(new DefaultTagSettings(libraries1_1));
    proj.getTagAllocationTable().clearUsed();
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);

    pm.setProject(proj);

    //Make a new design after clearing tag usage   
    Task 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();
    Probe p = proj.getProbes().getSequenceAt(0);
    assertTrue("Tag allocated despite warning message",p.getTags().size() == 0); //$NON-NLS-1$

    proj.getSettings().getCandidateModulesStage1().clear();
  }
View Full Code Here

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

  public void testCandidateGeneration() throws DuplicateIDException {
   
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
    proj.setTagSettings(new DefaultTagSettings(libraries1_10));
    proj.getTagAllocationTable().clearUsed();
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);
    pm.setProject(proj);
   
    dummy.setData(DummyModule.KEY_WARNING_CHANCE, new Integer(100));
    proj.getSettings().addCandidateModuleStage1(dummy);

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

    //Check the number of candidates tested
    long candCount = task.getCandidatesGenerated();  
    assertTrue("Tag selection, 10 candidates expected, " + candCount + " generated.",candCount==10); //$NON-NLS-1$ //$NON-NLS-2$

    proj.getSettings().getCandidateModulesStage1().clear();   
  }
View Full Code Here

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

  public void testSpacer() throws DuplicateIDException {
   
    Project proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
    proj.setTagSettings(new DefaultTagSettings(libraries1_10));
    proj.getTagAllocationTable().clearUsed();
    proj.getTargets().addSequence(t1);   
    proj.getSettings().addCandidateModuleStage1(dummy);
    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_SPACER_POSITION,"0"); //$NON-NLS-1$
    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_USE_SPACER,"TRUE"); //$NON-NLS-1$
    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_PREFERRED_LENGTH,String.valueOf(61));
    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_SPACER_SEQUENCE,"CT");     //$NON-NLS-1$
    pm.setProject(proj);

    GreedyTagAllocator ta = new GreedyTagAllocator();          
    ProbeDesignTask task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(ta), new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true));
    //task.addListener(new TaskListener());
    task.run();

    long candCount = task.getCandidatesGenerated();

    //Check the number of candidates tested
    assertEquals("Constant spacer, 10 candidates expected, " + candCount + " generated.", candCount, 10); //$NON-NLS-1$ //$NON-NLS-2$

    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_SPACER_SEQUENCE,""); //$NON-NLS-1$

    ta = new GreedyTagAllocator();
    //ta.setDebug(3,System.out);

    task = pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new GoodAcceptor(), new NoSelector(), new DefaultProbeDesigner(ta), new DefaultTSSPairDesigner(new DefaultTSSConstructor()) ,new StreamErrorHandler(System.out,true));
    //task.addListener(new TaskListener());
    task.run();

    //Check the number of candidates tested
    candCount = task.getCandidatesGenerated();

    assertTrue("Variable spacer, 40 candidates expected, " + candCount + " generated.", candCount==40); //$NON-NLS-1$ //$NON-NLS-2$

    proj.getSettings().getDesignParameters().put(TagAllocator.PROP_USE_SPACER,"FALSE"); //$NON-NLS-1$
    proj.getSettings().getCandidateModulesStage1().clear();   
  }
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.