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


    //If another probe forms dimer with this probe, add message to it.
    //This is only necessary to check if there are dimer messages on this probe
    if (tests[0].perform())
    if (!CollectionUtils.select(ProbeMakerPropertyUtils.getAllMessages(p),new IncludeTypesFilter(new MessageType[] {PROBE_DIMER_FORMATION})).isEmpty()) {
      for (Iterator<? extends Probe> i = otherProbes.iterator(); i.hasNext(); ) {
        Probe other = i.next();
        if (!other.equals(p) && other.tagsAllocated()) {
          byte dimer = compare(p,other);
          if (dimer == HI_RISK)
            ProbeMakerPropertyUtils.addMessage(other,new Message("High risk of hetero-dimer formation with " + p.getName(), //$NON-NLS-1$
                PROBE_DIMER_FORMATION, Message.ERROR));
          else if (dimer == RISK)
View Full Code Here

  public void doAnalysis(Probe p, TagAllocator pd, DefiniteSequenceDB<? extends Probe> probes) {
    //Get a list of all target sequences the first time
    if (targetList == null) {
      targetList = new ArrayList<ProbeMakerTarget>(probes.size());
      for (Iterator<? extends Probe> i = probes.iterator();i.hasNext();) {
        Probe probe = i.next();
        ProbeMakerTarget t = (ProbeMakerTarget) probe.getTarget();
        if (t != null) {
          targetList.add(t);         
        }
      }
    }
   
    //Get a list of all primer sequences the first time
    if (primerList == null) {
      primerList = new ArrayList<NucleotideSequence>(probes.size());
      for (Iterator<? extends Probe> i = probes.iterator();i.hasNext();) {
        Probe probe = i.next();
        if (probe != null) {
          primerList.add(probe);         
        }
      }
    }
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) {
        handleError(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);
     */

    //Analyze all old probes with respect to the new probe TSS set
    for (Probe p : probes.getSequenceCollection()) {     
      if (p.tagsAllocated())
        analyzer.analyzeTSSPair(p,allocator,probes);
    }

    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) {
        handleError(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

            "Could not perform ligation to target test: No target", //$NON-NLS-1$
            SELECTOR_TARGET_LIGATION_5, Message.ALERT));
      }
    }
    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      NucleotideSequence other5;
      NucleotideSequence other3;
      try {
        other5 = other.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
      }
      catch (ClusterException e) {
        other5 = null;
      }
      try {
        other3 = other.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
      }
      catch (ClusterException e) {
        other3 = null;
      }

      if (!other.equals(p)) {
        if (tests[3].perform() && other5 != null) {
          //Selector 5' end ligates to 5' end of other
          if (isMatch(p, other5, false, FIVE_PRIME_END)) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_OTHER_LIGATION_5.getDescription() +
                ": " + other.getName(), //$NON-NLS-1$
                SELECTOR_OTHER_LIGATION_5, Message.WARNING));
          }
        }
        if (tests[4].perform() && other3 != null) {
          //Selector 3' end ligates to 3' end of other
          if (isMatch(p, other3, false, THREE_PRIME_END)) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_OTHER_LIGATION_3.getDescription() +
                ": " + other.getName(), //$NON-NLS-1$
                SELECTOR_OTHER_LIGATION_3, Message.WARNING));
          }
        }
        if (tests[5].perform() && sel5 != null) {
          //Other selector 5' end ligates to 5' end of this
          if (isMatch(other, sel5, false, FIVE_PRIME_END)) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_LIGATION_OTHER_5.getDescription() +
                ": " + other.getName(), //$NON-NLS-1$
                SELECTOR_LIGATION_OTHER_5, Message.WARNING));
          }
        }
        if (tests[6].perform() && sel3 != null) {
          //Other selector 3' end ligates to 3' end of this
          if (isMatch(other,sel3, false, THREE_PRIME_END)) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_LIGATION_OTHER_3.getDescription() +
                ": " + other.getName(), //$NON-NLS-1$
                SELECTOR_LIGATION_OTHER_3, Message.WARNING));
          }
        }
        if (tests[7].perform() && sel5 != null) {
          ValidatingTarget t = (ValidatingTarget) other.getTarget();
          if (t != null) {
            if (t instanceof SelectorTarget) {
              SelectorTarget it = (SelectorTarget) t;
              if (isMatch(it, sel5, true, FIVE_PRIME_END)) {
                ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_TARGET_LIGATION_OTHER_5.
                    getDescription() + ": " + //$NON-NLS-1$
                    other.getName(),
                    SELECTOR_TARGET_LIGATION_OTHER_5,
                    Message.WARNING));
              }
            }
            else {
              ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
                  "Could not perform ligation to target test: Incompatible target", //$NON-NLS-1$
                  SELECTOR_TARGET_LIGATION_OTHER_5, Message.ALERT));
            }
          }
          else {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
                "Could not perform ligation to target test: No target", //$NON-NLS-1$
                SELECTOR_TARGET_LIGATION_OTHER_5, Message.ALERT));

          }
        }
        if (tests[8].perform() && sel3 != null) {
          //Selector 3' end ligates to 3' end of other target
          ValidatingTarget t = (ValidatingTarget) other.getTarget();
          if (t != null) {
            if (t instanceof SelectorTarget) {
              SelectorTarget it = (SelectorTarget) t;
              if (isMatch(it, sel3, true, THREE_PRIME_END)) {
                ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(SELECTOR_TARGET_LIGATION_OTHER_3.
                    getDescription() + ": " + //$NON-NLS-1$
                    other.getName(),
                    SELECTOR_TARGET_LIGATION_OTHER_3,
                    Message.WARNING));
              }
            }
            else {
View Full Code Here

    }

    for (Iterator si = sequences.iterator(); si.hasNext(); ) {
      Object probe = si.next();
      if (probe instanceof Probe) {
        Probe p = (Probe) probe;
        PropertyAcceptorNucleotideSequence fivePrime;
        PropertyAcceptorNucleotideSequence threePrime;
        try {
          fivePrime = (PropertyAcceptorNucleotideSequence) p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
        }
        catch (ClusterException e) {
          fivePrime = null;
        }
        try {
          threePrime = (PropertyAcceptorNucleotideSequence) p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
        }
        catch (ClusterException e) {
          threePrime = null;
        }


        hw.printEnclosed(p.getName(), HTMLWriter.H4);
        hw.println(Messages.getString("HTMLOutputFormat.ID") + p.getID()); //$NON-NLS-1$
        String seqstr = p.seqString();
        //String seq = "";
        int index = 0;
        int width = 60;
        while (index <= seqstr.length() - width) {
          hw.printEnclosed(seqstr.substring(index, index += width), HTMLWriter.TT);
        }
        hw.printEnclosed(seqstr.substring(index), HTMLWriter.TT);
        hw.printTag(HTMLWriter.BR);
        hw.println(p.getTarget() == null ? Messages.getString("HTMLOutputFormat.NO_TARGET") : //$NON-NLS-1$
          Messages.getString("HTMLOutputFormat.TARGET") + p.getTarget().getID()); //$NON-NLS-1$
        hw.printEnclosed(Messages.getString("HTMLOutputFormat.BLOCKS"), HTMLWriter.H5); //$NON-NLS-1$
        for (int i = 1; i <= p.getSequenceCount(); i++) {
          hw.println(p.getSequence(i).getID() + ": " + //$NON-NLS-1$
              p.getSequence(i).seqString());
        }
        hw.println(Messages.getString("HTMLOutputFormat.HYB_TEMPS_5") + //$NON-NLS-1$
            tempFormat.format(fivePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(fivePrime)) +
            Messages.getString("HTMLOutputFormat.HYB_TEMPS_3") + //$NON-NLS-1$
            tempFormat.format(threePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(threePrime)));
View Full Code Here

  public void doConfirmUpdate(Probe p, TagAllocator pd, DefiniteSequenceDB<? extends Probe> probes) {

    if (!CollectionUtils.select(ProbeMakerPropertyUtils.getAllMessages(p),new IncludeTypesFilter(new MessageType[] {PROBE_HETERODIMER_FORMATION})).isEmpty()) {
      for (Iterator<? extends Probe> i = probes.iterator(); i.hasNext(); ) {
        Probe other = i.next();
        //If other is not yet allocated, this will be found when checking other's arms
        if (other != p && other.tagsAllocated()) {
          boolean dimer = dimer(p,other);
          if (dimer)
            ProbeMakerPropertyUtils.addMessage(other,new Message("High risk of hetero-dimer formation with " + other.getName(), //$NON-NLS-1$
                PROBE_HETERODIMER_FORMATION, Message.ERROR));
          /*else if (dimer == RISK)
            other.addMessage(new Message("Risk of hetero-dimer formation with " + other.getName(), //$NON-NLS-1$
                 PROBE_HETERODIMER_FORMATION, Message.WARNING));*/
          Analyzer.calculateAndSetQuality(other);         
View Full Code Here

  }

  public void doAnalysis(Probe p, TagAllocator pd, DefiniteSequenceDB<? extends Probe> probes) {
    if (tests[0].perform())
      for (Iterator<? extends Probe> probeit = probes.iterator(); probeit.hasNext(); ) {
        Probe other = probeit.next();
        //Don't do anything if other is same as probe being analysed
        if (other != p && other.tagsAllocated()) {
          boolean dimer = dimer(p,other);
          if (dimer)
            ProbeMakerPropertyUtils.addMessage(p,new Message("High risk of hetero-dimer formation with " + other.getName(), //$NON-NLS-1$
                PROBE_HETERODIMER_FORMATION, Message.ERROR));
          /*else if (dimer == RISK)
            p.addMessage(new Message("Risk of hetero-dimer formation with " + other.getName(), //$NON-NLS-1$
                 PROBE_HETERODIMER_FORMATION, Message.WARNING));
           */
 
View Full Code Here

    ListSequenceDB<NucleotideSequence> tags = new ListSequenceDB<NucleotideSequence>();
    DefiniteSequenceDB<Probe> probes = probeMaker.project.getProbes();
    Set<NucleotideSequence> tagset = new HashSet<NucleotideSequence>();
   
    for (Iterator<Probe> i = probes.iterator(); i.hasNext(); ) {   
      Probe p = i.next();    
      for (Iterator<NucleotideSequence> ti = p.getTags().iterator(); ti.hasNext(); ) {
        tagset.add(ti.next());
      }
    }

    tags.addSequences(tagset);   
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

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.