Package org.moltools.apps.probemaker.seq

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


      h4.addContent(CoreMessages.getString("ProbeMakerHTMLRenderer.TEXT_GROUPED_WITH")); //$NON-NLS-1$
     
      Element list = new Element(HTMLWriter.UL.getTag());
     
      for (Iterator<? extends Target> i = targetGroup.getMembers().iterator(); i.hasNext(); ) {
        ProbeMakerTarget other = (ProbeMakerTarget) i.next();
        if (t != other) {
          Element li = new Element(HTMLWriter.LI.getTag());
          li.addContent(other.getID());
          list.addContent(li);
        }
      }     
      root.addContent(h4);
      root.addContent(list);
View Full Code Here


  }
 
  @Override
  protected void setUp() throws DuplicateIDException {
    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);
View Full Code Here

    int tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
      if (aborted()) break;
      logger.info("Designing TSSs for target " + (tindex+1)); //$NON-NLS-1$*/
      //Get the target
      ProbeMakerTarget target = ti.next();
      //Create a TSS pair
      try {
        pairs[tindex] = td.designTSSPair(target);
      }
      catch (Exception ex) {
        log.printLine("A problem occurred"); //$NON-NLS-1$
        log.printError(ex.getMessage());
        handler.handleError(ex.toString(),ex);       
      }
      tindex++;
    }
   
    fireStatusChange(0,"Creating probes"); //$NON-NLS-1$
   
    //Make new probes and store in a separate list
    ListSequenceDB<Probe> newProbes = new ListSequenceDB<Probe>();
    tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
     
      if (aborted()) return false;       
     
      //Get the target
      ProbeMakerTarget target = ti.next();
      try {
       
        //Create a new probe for the target, with the specified TSS
        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);                
View Full Code Here

  }

  protected Element getTargetListElement(String name, DefiniteSequenceDB<ProbeMakerTarget> targets) {
    Element targetList = new Element(TARGET_LIST,ns);
    for (Iterator<ProbeMakerTarget> i = targets.iterator(); i.hasNext(); ) {
      ProbeMakerTarget t = i.next();
      targetList.addContent(getTargetElement(TARGET,t));
    }  
    return targetList;
  }
View Full Code Here

      //Create target
      Map<String, String> m = new HashMap<String, String>();
      m.put(SequenceBuilder.PROPERTY_ID, id);
      m.put(SequenceBuilder.PROPERTY_SEQUENCE_DATA, seqStr);
      ProbeMakerTarget t = targetBuilder.buildObject(m);

      //set acid type of target     
      if (t instanceof ChangeableNucleotideSequence) {
        byte type = Byte.parseByte(typeStr);
        ((ChangeableNucleotideSequence) t).setType(type);
      }

      //Get the variant number, or -1 if none
      if (t instanceof VariantTarget) {
        int varno;
        if (variantStr.length() == 0)
          varno = -1;
        else
          varno = Integer.parseInt(variantStr);
        //Set variant
        if (varno > -1) {
          VariantTarget vt = (VariantTarget) t;
          vt.setVariant(vt.getVariants()[varno]);
        }
      }

      //Set the target group
      if (groupStr.length() > 0) {
        TargetGroup tg;
        if (targetGroups.containsKey(groupStr)) {
          tg = targetGroups.get(groupStr);
        }
        else {
          tg = new TargetGroup(groupStr);
          targetGroups.put(groupStr,tg);
        }
        tg.addMember(t);
      }      
      project.getTargets().addSequence(t);
    }

    increaseProgress();
    setStatus("Reading settings",0);          //$NON-NLS-1$

    project.setSettings(SettingsXMLHandler.getSettings(projE.getChild(SettingsXMLHandler.SETTINGS,ns)));

    increaseProgress();  
    setStatus("Reading tag libraries",0);           //$NON-NLS-1$

    TagSettings tagSettings = getTagSettings(projE.getChild(LIBRARIES,ns));
    project.setTagSettings(tagSettings);
    project.getTagAllocationTable().setTagLibraries(tagSettings.getTagLibraries(),project.getSettings().getDesignParameters());

    increaseProgress();
    setStatus("Reading probes",0);          //$NON-NLS-1$

    //Read and create all probe groups
    Element probeList = projE.getChild(PROBE_LIST,ns);   
    Map<String, ProbeGroup> probeGroups = new HashMap<String, ProbeGroup>();   
    for (Iterator<?> i = probeList.getChildren().iterator();i.hasNext();) {

      Element probeE = (Element) i.next();
      String id = probeE.getAttributeValue(ID,ns);
      setStatus(id,1);

      String probeName = probeE.getChildText(NAME,ns);
      String typeStr = probeE.getChildText(TYPE,ns);
      String rankStr = probeE.getChildText(RANK,ns);

      byte type = Byte.parseByte(typeStr);
      byte rank = Byte.parseByte(rankStr);

      //Set the probe group, if any
      ProbeGroup pg = null;     
      Element groupE = probeE.getChild(PROBE_GROUP,ns);
      if (groupE != null) {
        String groupID = groupE.getAttributeValue(ID,ns);
        Attribute att = groupE.getAttribute(TARGET_GROUP,ns);
        TargetGroup tg = null;
        if (att!=null) {
          String tGroupID = att.getValue();
          tg = targetGroups.get(tGroupID);
        }
        pg = probeGroups.get(groupID);
        if (pg != null) {
          pg = new ProbeGroup(tg,groupID);
          probeGroups.put(groupID, pg);
        }
      }     

      //TSSPair
      Element tssPairE = probeE.getChild(TSS_PAIR,ns);     
      String targetID = tssPairE.getAttributeValue(TARGET_ID,ns);
      ProbeMakerTarget target = null;
      try {
        target = project.getTargets().getSequenceByID(targetID);
      }
      catch (IDNotFoundException e) {
        //target=null;
View Full Code Here

  /**Checks the parts of the probe that are adjacent to the probe arms for
   * being complementary to the target sequence in that area. Add warnings
   * if not OK*/
  protected void checkHybridizationInterference(Probe p, TagAllocator ta) {   
    ProbeMakerTarget t = (ProbeMakerTarget) p.getTarget();
    if (tests[0].perform()) {
      if (t == null) {
        ProbeMakerPropertyUtils.addMessage(p,new Message(
            "Could not check 5' hybridization: No target found", //$NON-NLS-1$
            FIVE_PRIME_HYBRIDIZATION_INTERFERENCE,
            Message.ALERT));
      }
      else {
        //Check fiveprime part
        PropertyAcceptorNucleotideSequence pa5;
        try {
          pa5 = (PropertyAcceptorNucleotideSequence) p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
        }
        catch (ClusterException e) {
          pa5 = null;
        }

        TargettedSubSequence fiveTemplate = null;
        try {
          fiveTemplate = (TargettedSubSequence) t.getTemplateCluster().getSequence(ProbeMakerTarget.KEY_FIVE_PRIME);
        }
        catch (ClusterException e) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 5' hybridization: No 5' TSS template found", //$NON-NLS-1$
              FIVE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));
       
        catch (ClassCastException cx) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 5' hybridization: 5' TSS template is not a subsequence", //$NON-NLS-1$
              FIVE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));       
        }     
        if (pa5 == null) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 5' hybridization: No 5' TSS found", //$NON-NLS-1$
              FIVE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));
        }
        else if (fiveTemplate != null) {
          int targetLength = t.length();
          String tseq = t.seqString();
          int probeLength = p.length();       
          int[] positions = TemplateHandler.subTemplatePositions(fiveTemplate,pa5.length(),t.getFivePrimeFixedEnd());
          int begin = positions[0];
          int end = positions[1];

          String sequencelong = tseq.substring(begin - length - 1 < 0 ? 0 :
            begin - length - 1,
            end + length > targetLength ?
                targetLength : end + length);

          int block = p.getBlockNoOf5();
          int probebegin = p.getStartOfSequence(block);
          int probeend = p.getEndOfSequence(block);
          int pb = probebegin - length < 1 ? 1 : probebegin - length;
          int pe = probeend + length > probeLength ? probeLength :
            probeend + length;
          String plong = p.subsequence(pb, pe);

          //log.info("Checking hyb of " + sequencelong + " to " + plong);

          NAHybridStructure s1 = complementStructCalc.calculateStructure(sequencelong,
              plong,
              t.getType(), p.getType());
          //If hybridization is interfered with, add message and put tag in badtags
          if (s1.getSecondString().length() > pa5.length()) {
            ProbeMakerPropertyUtils.addMessage(p,new Message("Hybridization temp. of 5' arm may be incorrect. Other part of probe may hybridize to the target.", //$NON-NLS-1$
                FIVE_PRIME_HYBRIDIZATION_INTERFERENCE,
                Message.WARNING));
            //Record as bad only if there are tags
            if (p.getTags().size()>0)
              ta.setCurrentTagBad(0);
          }        
        }
      }
    }
    if (tests[1].perform()) {     
      //Check threeprime part
      if (t == null) {
        ProbeMakerPropertyUtils.addMessage(p,new Message(
            "Could not check 3' hybridization: No target found", //$NON-NLS-1$
            THREE_PRIME_HYBRIDIZATION_INTERFERENCE,
            Message.ALERT));
      }
      else {
        PropertyAcceptorNucleotideSequence pa3;   
        try {
          pa3 = (PropertyAcceptorNucleotideSequence) p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
        }
        catch (ClusterException e) {
          pa3 = null;
        }   
        SimpleSubSequenceTemplate threeTemplate = null;
        try {
          threeTemplate = (SimpleSubSequenceTemplate) t.getTemplateCluster().getSequence(ProbeMakerTarget.KEY_THREE_PRIME);
        }
        catch (ClusterException e) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 3' hybridization: No 3' TSS template found", //$NON-NLS-1$
              THREE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));
       
        catch (ClassCastException cx) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 3' hybridization: 3' TSS template is not a subsequence", //$NON-NLS-1$
              THREE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));       
        }                 
        if (pa3 == null) {
          ProbeMakerPropertyUtils.addMessage(p,new Message(
              "Could not check 3' hybridization: No 3' TSS found", //$NON-NLS-1$
              THREE_PRIME_HYBRIDIZATION_INTERFERENCE,
              Message.ALERT));
        }
        else if (threeTemplate != null) {
          int targetLength = t.length();
          String tseq = t.seqString();      
          int[] positions = TemplateHandler.subTemplatePositions(threeTemplate,pa3.length(),t.getThreePrimeFixedEnd());

          int begin = positions[0];
          int end = positions[1];

          String sequencelong = tseq.substring(begin - length - 1 < 0 ? 0 :
            begin - length - 1,
            end + length > targetLength ?
                targetLength : end + length);

          int block = p.getBlockNoOf3();
          int probebegin = p.getStartOfSequence(block);
          int probeend = p.getEndOfSequence(block);
          String plong = p.subsequence(probebegin - length < 1 ? 1 :
            probebegin - length,
            probeend + length > p.length() ?
                p.length() : end + length);

          //log.info("Checking hyb of " + sequencelong + " to " + plong);

          NAHybridStructure s1 = complementStructCalc.calculateStructure(sequencelong,
              plong,
              t.getType(), p.getType());
          //Structure s2 = complementStructCalc.getStructure(sequence, pa3.getSequence(), t.getType(), pa3.getType(), true, false);
          if (s1.getSecondString().length() > pa3.length()) {
//            if (s1.getLength() > s2.getLength()) {
            ProbeMakerPropertyUtils.addMessage(p,new Message("Hybridization temp. of 3' arm may be incorrect. Other part of probe may hybridize to the target.", //$NON-NLS-1$
                THREE_PRIME_HYBRIDIZATION_INTERFERENCE,
View Full Code Here

    //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);         
        }
      }
    }
   
    //Check the 3' TSS of this probe against all targets
    NucleotideSequence primer;
    try {
      primer = p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
    }
    catch (ClusterException e) {
      primer = null;
    }

    //Debug
    log.debug("Checking probe " + p.getName()); //$NON-NLS-1$
   
    if (tests[0].perform() && primer != null) {
      Group<?> thisGroup = DesignUtils.getGroupWithType((PropertyHolder) p.getTarget(), TargetGroup.GROUP_TYPE);
      for (Iterator<ProbeMakerTarget> ti = targetList.iterator();ti.hasNext();) {
        ProbeMakerTarget t = ti.next();
        Group<?> otherGroup = DesignUtils.getGroupWithType(t, TargetGroup.GROUP_TYPE);
        int[] results = getPrimingPositions(primer,t);
        if (results != null) {
          for (int i = 0; i < results.length; i++) {
            boolean err = true;
            //Special treatment if targets of same group (only valid for minisequencing targets)
                                   
            if (otherGroup != null && thisGroup == otherGroup && t instanceof MinisequencingTarget)
              if (results[i] == ((MinisequencingTarget) t).getTargetPosition())
                err = false;
             
            if (err) {
              ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
                  "May prime on " + t.getID() + " (pos. " + results[i] + ", Tm = " + Math.round((tms.get(i)).floatValue()) + ").", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                  FALSE_PRIME_ON_TARGET,
                  Message.ERROR));
              log.debug(p.getName() + "/" + t.getID() + ": " + results[i] + ", " + Math.round((tms.get(i)).floatValue()) + " �C"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            }
          }
        }
      }
    }
View Full Code Here

  /**(Re)calculate the Tm values of the TSSs of this pair*/
  public static void calculateArmTemperatures(TSSPair p, MeltingPointCalculator defaultMpc, MeltingPointCalculator backupMpc) {
    MessageType mt = new MessageType("TEMPERATUR_CALCULATION", //$NON-NLS-1$
    "Temperature calculation"); //$NON-NLS-1$
    ProbeMakerTarget t = null;
    try {
      t = (ProbeMakerTarget) p.getTarget();     
      if (p.getTarget() == null) {
        ProbeMakerPropertyUtils.addMessage(p,new Message(
            "No target found. Calculated hybridization temperature based on full match", //$NON-NLS-1$
            mt, Message.ALERT));
      }           
    }
    catch (ClassCastException ccx) {     
      ProbeMakerPropertyUtils.addMessage(p,new Message(
          "Not a ProbeMakerTarget. Calculated hybridization temperature based on full match", //$NON-NLS-1$
          mt, Message.ALERT));
    }

    try {
      PropertyAcceptorNucleotideSequence five = (PropertyAcceptorNucleotideSequence) p.getSequence(TSSPair.KEY_FIVE_PRIME);
      if (five != null) {       
        ProbeMakerPropertyUtils.clearMessages(five);
        //Set up the structure for the MPC, 5'
        float Tm;
        if (five.length() > 0) {
          if (t != null) {
            NucleotideSequence temp = p.getTarget().getTemplateCluster().getSequence(ProbeMakerTarget.KEY_FIVE_PRIME);
            if (temp != null) {
              int secstart = t.getFivePrimeFixedEnd() == TemplateHandler.THREEPRIME ? 1 :
                temp.length() - five.length() + 1;
              int secend = t.getFivePrimeFixedEnd() == TemplateHandler.THREEPRIME ? five.length() :
                temp.length();
              NAHybridStructure st = new DefaultNAHybridStructure(five, 1, five.length(),
                  temp,
                  secstart, secend);
              Tm = calculateTm(five, temp, st, defaultMpc, backupMpc);
              ProbeMakerPropertyUtils.setHybridizationTemp(five,Tm);
            }
          }
          else {
            Tm = calculateFullMatchTm(five, defaultMpc, backupMpc);
            ProbeMakerPropertyUtils.setHybridizationTemp(five,Tm);
          }
        }

      }

    }
    catch (ClusterException e) {
//      Do nothing
    }


    try {
      PropertyAcceptorNucleotideSequence three = (PropertyAcceptorNucleotideSequence) p.getSequence(TSSPair.KEY_THREE_PRIME);
      if (three != null) {
        ProbeMakerPropertyUtils.clearMessages(three);
        //Set up the structure for the MPC, 3'
        float Tm;
        if (three.length() > 0) {
          if (t != null) {
            NucleotideSequence temp = p.getTarget().getTemplateCluster().getSequence(ProbeMakerTarget.KEY_THREE_PRIME);
            if (temp != null) {
              int secstart = t.getThreePrimeFixedEnd() == TemplateHandler.THREEPRIME ? 1 :
                temp.length() - three.length() + 1;
              int secend = t.getThreePrimeFixedEnd() == TemplateHandler.THREEPRIME ? three.length() :
                temp.length();
              NAHybridStructure st = new DefaultNAHybridStructure(three, 1, three.length(),
                  temp, secstart,
                  secend);
              Tm = calculateTm(three, temp, st, defaultMpc, backupMpc);
View Full Code Here

    //Store the new target sequences temporarily
    ChangeableSequenceDB<ProbeMakerTarget> temp = new ListSequenceDB<ProbeMakerTarget>();
    //Iterate over each target
    Iterator<? extends ProbeMakerTarget> ti = targets.iterator();
    while (ti.hasNext()) {
      ProbeMakerTarget target = ti.next();
      //Check if target is expandable
      if (target instanceof VariantTarget) {
        VariantTarget vt = (VariantTarget) target;
        //If target is not in a group, expand it and add the new targets to temp
        TargetGroup tg = (TargetGroup) DesignUtils.getGroupWithType(vt,TargetGroup.GROUP_TYPE);
        if (tg == null) {
          tg = new TargetGroup(vt.getID());
          List<? extends ProbeMakerTarget> nts = vt.expand();
          if (nts.size() <= 1) {
            try {
              temp.addSequence(vt);
            }
            catch (DuplicateIDException e) {
              throw new RuntimeException(e);
            }
          }
          else {
            for (Iterator<? extends ProbeMakerTarget> ni = nts.iterator(); ni.hasNext(); ) {
              ProbeMakerTarget nt = ni.next();
              tg.addMember(nt);
              try {
                temp.addSequence(nt);
              }
              catch (DuplicateIDException e) {
View Full Code Here

    int tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
      if (aborted()) break;
      logger.info("Designing TSSs for target " + (tindex+1)); //$NON-NLS-1$*/
      //Get the target
      ProbeMakerTarget target = ti.next();
      //Create a TSS pair
      try {
        pairs[tindex] = td.designTSSPair(target);
      }
      catch (Exception ex) {
        handleError(ex);       
      }
      tindex++;
    }

    fireStatusChange(0,"Creating probes"); //$NON-NLS-1$

    //Make new probes and store in a separate list
    ListSequenceDB<Probe> newProbes = new ListSequenceDB<Probe>();
    tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {

      if (aborted()) return false;       

      //Get the target
      ProbeMakerTarget target = ti.next();
      try {

        //Create a new probe for the target, with the specified TSS
        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);                
View Full Code Here

TOP

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

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.