Package org.moltools.apps.probemaker.seq

Examples of org.moltools.apps.probemaker.seq.Probe


        return false;
      }

      setStatus("Selecting probe"); //$NON-NLS-1$
      designlog.printLine("Selecting probe"); //$NON-NLS-1$
      Probe selected = analyzer.selectProbe(tempCandidates);
      if (selected == null) {
        //Nothing
      }
      else {
        //We also have to set the selected probe's group to be the correct one.
View Full Code Here


        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;
   
View Full Code Here

    for (Iterator<Probe> pi = probes.iterator(); pi.hasNext(); ) {
      if (isAborted()) {
        return;
      }
      try {
        Probe p = pi.next();
        setStatus(CoreMessages.getString("ProbeAnalysisTask.MESSAGE_ANALYZING") + p.getName(),0); //$NON-NLS-1$
        reAnalyzeProbe(p);
        increaseProgress();
      }
      catch (Exception ex) {
        //Print the error
        handleError(ex);
      }
    }
    //Recalculate the probe qualities and finish up the work
    for (Iterator<Probe> i = probes.iterator(); i.hasNext(); ) {
      Probe p = i.next();
      Analyzer.calculateAndSetQuality(p);
    }
   
    elapsedTime = new Date().getTime() - startTime;
    setCompleted();
View Full Code Here

      PropertyAcceptorNucleotideSequence tss3 = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(
          "3' TSS", substrings[14], type),pt == null ? "" : pt.getID()); //$NON-NLS-1$ //$NON-NLS-2$
      ProbeMakerPropertyUtils.setHybridizationTemp(tss3,Float.parseFloat(substrings[15]));

      Probe p = new DefaultProbe(ProbeMakerSequenceFactory.createTSSPair(tss5, tss3, pt),Integer.parseInt(substrings[3]),Integer.parseInt(substrings[4]),type);
      p.setName(substrings[0]);
      p.setID(substrings[1]);
      if (gr_no >= 0)
        DesignUtils.addGroup(p, p_groups.get(gr_no));

      ProbeMakerPropertyUtils.setRank(p,Byte.parseByte(substrings[7]));

      //Read tags from substring 16;
      int t = 0;
      for (int i = 16; i < substrings.length; i+=2, t++) {
        String l_str = substrings[i];
        String t_str = substrings[i+1];
        if (l_str.startsWith("Spacer")) { //$NON-NLS-1$
          NucleotideSequence tag = new SimpleNucleotideSequence("Spacer " + t_str, t_str, p.getType()); //$NON-NLS-1$
          p.addTagAt(tag,t);
        }
        else {
          int lib_no = Integer.parseInt(l_str);
          int tag_no = Integer.parseInt(t_str);
          NucleotideSequence tag = libraries[lib_no].getSequenceAt(tag_no);
          p.addTagAt(tag, t);
          proj.getTagAllocationTable().use(tag,p,t);
        }
      }

      //UITexts for 5' TSS
      for (int mess = 0;mess < messageCount5;mess++) {
        String[] messageLine = tio.getInStrings(r.readLine());
        if (messageLine.length != 4)
          throw new UnsupportedOperationException("Error parsing message line: " + messageLine); //$NON-NLS-1$
        MessageType mt = new MessageType(messageLine[0],messageLine[1]);
        ProbeMakerPropertyUtils.addMessage(tss5,new Message(messageLine[2],mt,Byte.parseByte(messageLine[3])));
      }

      //UITexts for 3' TSS
      for (int mess = 0;mess < messageCount3;mess++) {
        String[] messageLine = tio.getInStrings(r.readLine());
        if (messageLine.length != 4)
          throw new UnsupportedOperationException("Error parsing message line: " + messageLine); //$NON-NLS-1$
        MessageType mt = new MessageType(messageLine[0],messageLine[1]);
        ProbeMakerPropertyUtils.addMessage(tss3,new Message(messageLine[2],mt,Byte.parseByte(messageLine[3])));
      }

      //UITexts for TSS Pair
      for (int mess = 0;mess < messageCountTSS;mess++) {
        String[] messageLine = tio.getInStrings(r.readLine());
        if (messageLine.length != 4)
          throw new UnsupportedOperationException("Error parsing message line: " + messageLine); //$NON-NLS-1$
        MessageType mt = new MessageType(messageLine[0],messageLine[1]);
        ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(messageLine[2],mt,Byte.parseByte(messageLine[3])));
      }

      //UITexts for Probe
      for (int mess = 0;mess < messageCountProbe;mess++) {
        String[] messageLine = tio.getInStrings(r.readLine());
View Full Code Here

  /**Check if this probe is templated by other probes or targets*/
  public boolean checkTemplatingByOtherProbes(Probe p, DefiniteSequenceDB<? extends Probe> probes) {
    boolean found = false;
    //Iterate through all probes
    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      //Check for templating and add messages accordingly
      if (other != p) {
        //Does other probe template this probe
        if (other.tagsAllocated()) {
          //Tags allocated, test as circle
          if (isLigationTemplate(other, p, true, false) != null) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May be templated by " + //$NON-NLS-1$
                other.getName(),
                OTHER_PROBE_IS_TEMPLATE,
                Message.ERROR));
            found = true;
          }
        }
        else {
          //Tags not allocated, test arms only (connected in ligation point)
          try {           
            String seqString = other.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME).seqString() + other.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME).seqString();         
            if (isLigationTemplate(new SimpleNucleotideSequence("Arms of " + other.getName(), seqString, //$NON-NLS-1$
                other.getType()), p, false, false) != null) {
              ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May be templated by " + //$NON-NLS-1$
                  other.getName(),
                  OTHER_PROBE_IS_TEMPLATE,
                  Message.ERROR));
              found = true;
            }
          }
View Full Code Here

  /**Check if this probe is templated by other probes or targets*/
  public boolean checkTemplatingByOtherTargets(Probe p, DefiniteSequenceDB<? extends Probe> probes) {
    boolean found = false;
    //Iterate through all probes
    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      //Check for templating and add messages accordingly
      if (other != p) {
        if (other.getTarget() != null) {
          //Does other probe's target template this probe?
          if (isLigationTemplate((NucleotideSequence) other.getTarget(), p, false, true) != null) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May be templated by " + //$NON-NLS-1$
                other.getTarget().getID(),
                OTHER_TARGET_IS_TEMPLATE,
                Message.ERROR));
            found = true;
          }
        }
View Full Code Here

  /**Check if the arms of this probe may template other probes*/
  public boolean checkArmsTemplatingOthers(Probe p, DefiniteSequenceDB<? extends Probe> probes) {
    boolean found = false;
    //Iterate through all probes
    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      //Check for templating and add messages accordingly
      if (other != p) {
        //Does the arms of this probe template other probe?
        NucleotideSequence fp;
        try {
          fp = p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
        }
        catch (ClusterException e) {
          fp = null;
        }
        NucleotideSequence tp;
        try {
          tp = p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
        }
        catch (ClusterException e) {
          tp = null;
        }

        if (tp == null || fp == null) throw new UnsupportedOperationException("Can't perform ligation calculations with missing TSSs"); //$NON-NLS-1$

        if (isLigationTemplate(new SimpleNucleotideSequence(tp.
            seqString() + fp.seqString(),
            "Arms of " + p.getName(), //$NON-NLS-1$
            p.getType()), other, false, false) != null) {
          ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May act as template for " + //$NON-NLS-1$
              other.getName(),
              TSS_IS_TEMPLATE_FOR_OTHER_PROBE,
              Message.ERROR));
          found = true;
        }
      }
View Full Code Here

  /**Check if this probe will template ligation of any other probe*/
  public boolean checkTemplatingOthers(Probe p, DefiniteSequenceDB<? extends Probe> probes) {
    boolean found = false;
    //Iterate through all probes
    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      //Check for templating and add messages accordingly
      if (other != p) {
        //Does this probe (circle) template other probes?
        if (isLigationTemplate(p, other, true, false) != null) {
          ProbeMakerPropertyUtils.addMessage(p,new Message("May act as template for " + //$NON-NLS-1$
              other.getName(),
              TEMPLATE_FOR_OTHER_PROBE,
              Message.ERROR));
          found = true;
        }
      }
View Full Code Here

    PropertyAcceptorNucleotideSequence tss5 = ProbeMakerSequenceFactory.createTSS(seq,target.getID());   
    ProbeMakerPropertyUtils.addMessage(tss5, new Message("Test",new MessageType("test_type","Test type"),Message.ERROR));     //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    TSSPair pair = new TSSPair(tss5,null,target);
    ProbeMakerPropertyUtils.addMessage(pair, new Message("Test",new MessageType("test_type","Test type"),Message.ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    Probe probe = new DefaultProbe(pair,0,0,NucleotideSequence.DNA);

    ProbeMakerPropertyUtils.setRank(probe, ProbeMakerConstants.BAD_QUALITY);
   
    assertTrue("Incorrect rank", ProbeMakerConstants.BAD_QUALITY == ProbeMakerPropertyUtils.getRank(probe)); //$NON-NLS-1$
   
    assertTrue("Incorrect target ID", target.getID().equals(DesignUtils.getTargetID(probe))); //$NON-NLS-1$
    assertTrue("Incorrect target", target.equals(pair.getTarget())); //$NON-NLS-1$
    assertTrue("Incorrect target", target.equals(probe.getTarget())); //$NON-NLS-1$
    assertTrue("Incorrect message count", 2 == ProbeMakerPropertyUtils.getAllMessages(probe).size()); //$NON-NLS-1$
    assertTrue("Wrong tss pair",pair == probe.getTSSPair()); //$NON-NLS-1$
   
    ProbeMakerPropertyUtils.addMessage(probe, new Message("Test",new MessageType("test_type","Test type"),Message.ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   
    assertTrue("Incorrect message count", 3 == ProbeMakerPropertyUtils.getAllMessages(probe).size()); //$NON-NLS-1$
   
View Full Code Here

    proj.getTargets().addSequence(t1);
    proj.setTagSettings(new DefaultTagSettings(new TagLibrary[] { tags }));
   
//  Design without test
    pm.getProbeDesignTask(false, true, true, new AllAcceptor(),new NoSelector(), new DefaultProbeDesigner(new PairwiseTagAllocator()), new DefaultTSSConstructor(), new StreamErrorHandler(System.out,true)).run();   
    Probe p = proj.getProbes().getSequenceAt(0);   
    assertTrue("Hyb. interference, 0 messages expected, " + ProbeMakerPropertyUtils.getAllMessages(p).size() + " generated.",ProbeMakerPropertyUtils.getAllMessages(p).size() == 0); //$NON-NLS-1$ //$NON-NLS-2$
   
   
//  Design again with test
    proj.getSettings().addCandidateModuleStage1(new DefaultHybInterferenceModule());   
View Full Code Here

TOP

Related Classes of org.moltools.apps.probemaker.seq.Probe

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.