Package org.moltools.design.data

Examples of org.moltools.design.data.PropertyAcceptorNucleotideSequence


      String armDesc, 
      int minlength, double preftemp,
      byte acidType, byte fixedEnd) {

    //Create a new TSS.   
    PropertyAcceptorNucleotideSequence pa = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(armDesc,"",acidType),temp == null ? "" : DesignUtils.getTargetID(temp)); //$NON-NLS-1$ //$NON-NLS-2$
    ChangeableNucleotideSequence cns = (ChangeableNucleotideSequence) pa;
    if (temp == null) return pa;

    //Set the probe arm sequence to the reverse complement of the template
    try {
      cns.setSequence(NucleotideSequenceHandler.getRevComp(temp,acidType));
    }
    catch (SequenceFormatException e) {
      throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
    }

    //If template is polymorphic
    if (NucleotideSequenceHandler.countPolys(temp) > 0) {
      ProbeMakerPropertyUtils.addMessage(pa,new Message("Could not calculate Tm because of polymorphisms",messagetype,Message.ALERT)); //$NON-NLS-1$
    }
    else {
      //If both ends are fixed, this is the probe arm, so just skip the design
      if (fixedEnd != TemplateHandler.BOTH) {

        //Now cut off one base at a time until we reach either minimum length, or
        //preferred temperature.
        boolean done = false; //are we done yet?
        String oldseq = pa.seqString(); //store old seq here
        float oldTm = 0.0f;
        float Tm = 0.0f; //melting temp

        while (!done) {

          if (pa.length() == 0) {
            ProbeMakerPropertyUtils.addMessage(pa,new Message("Could not calculate Tm because of zero length",messagetype,Message.ALERT)); //$NON-NLS-1$
            return pa;
          }

          //Set up the structure for the MPC
          int secstart = fixedEnd == TemplateHandler.THREEPRIME ? 1 :
            temp.length() - pa.length() + 1;
          int secend = fixedEnd == TemplateHandler.THREEPRIME ? pa.length() :
            temp.length();
          NAHybridStructure st = new DefaultNAHybridStructure(pa, 1, pa.length(),
              temp, secstart,
              secend);
          //calculate the Tm of the probe Arm to the template
          oldTm = Tm;

          Tm = Analyzer.calculateTm(pa,temp,st,defaultMpc,backupMpc);         
          //Tm = defaultMpc.getMeltingPoint(pa);         

          //If minimum length reached, stop and check if further away than last length
          if (pa.length() <= minlength) {
            done = true;
            //if further from temp than last, restore the old seq.
            if (oldTm > 0 && Math.abs(Tm - preftemp) > Math.abs(oldTm - preftemp)) {
              try {
                cns.setSequence(oldseq);
              }
              catch (SequenceFormatException e) {
                throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
              }
            }
            break;
          }
          //If below temp limit, back up one step
          if (Tm <= preftemp) {
            done = true;
            if (oldTm > 0 && Math.abs(Tm - preftemp) > Math.abs(oldTm - preftemp)) {
              try {
                cns.setSequence(oldseq);
              }
              catch (SequenceFormatException e) {
                throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
              }
            }
            break;
          }
          //Here we cut of the sequence at the appropriate end and do all again
          oldseq = pa.seqString(); //but first store the old sequence
          //remove nucleotides form the non-fixed end of the arm
          switch (fixedEnd) {
            case TemplateHandler.THREEPRIME:
              try {
                cns.edit(new SimpleSequenceEdit(1, 1, "")); //$NON-NLS-1$
              }
              catch (SequenceFormatException e) {
                throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
              }

              break;
            case TemplateHandler.FIVEPRIME:
              try {
                cns.edit(new SimpleSequenceEdit(pa.length(), 1, "")); //$NON-NLS-1$
              }
              catch (SequenceFormatException e) {
                throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
              }

              break;
          }
        }
      }

      //Recalculate tm, in case we backed the sequence up.
      //Set up the structure for the MPC
      int secstart = fixedEnd == TemplateHandler.FIVEPRIME ?
          temp.length() - pa.length() + 1 : 1;
          int secend = fixedEnd == TemplateHandler.FIVEPRIME ?
              temp.length() : pa.length();
              NAHybridStructure st = new DefaultNAHybridStructure(pa, 1, pa.length(),
                  temp, secstart, secend);

              ProbeMakerPropertyUtils.clearMessages(pa);
              float Tm = Analyzer.calculateTm(pa,temp,st,defaultMpc,backupMpc);     
              //Set the temperature
View Full Code Here


        sub = temp;
    }



    PropertyAcceptorNucleotideSequence pa = constructTSS(sub, "3-prime arm", //$NON-NLS-1$
        minlength, preftemp, type, fixedEnd);
    return pa;
  }
View Full Code Here

        sub = TemplateHandler.subTemplate(temp, maxlength,fixedEnd);
      else
        sub = temp; 
   

    PropertyAcceptorNucleotideSequence pa = constructTSS(sub, "5-prime arm", minlength, //$NON-NLS-1$
        preftemp, type,fixedEnd);

    return pa;
  }
View Full Code Here

            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,
                Message.WARNING));
            //Record as bad if adjacent sequence is a tag
View Full Code Here

          "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);
              ProbeMakerPropertyUtils.setHybridizationTemp(three,Tm);
            }
View Full Code Here

    byte probeAcidType = Byte.parseByte(parameters.get(ProbeDesigner.PROP_PROBE_ACID_TYPE));
   
//  Generate the 5' TSS
    setStatus("Constructing 5' TSS"); //$NON-NLS-1$
    PropertyAcceptorNucleotideSequence tss5 = tssConstructor.get5PrimeTSS(target, probeAcidType);
//  Generate the 3' TSS
    setStatus("Constructing 3' TSS"); //$NON-NLS-1$
    PropertyAcceptorNucleotideSequence tss3 = tssConstructor.get3PrimeTSS(target, probeAcidType);
   
//  Build the pair
    return ProbeMakerSequenceFactory.createTSSPair(tss5,tss3,target);    
  }
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;
View Full Code Here

TOP

Related Classes of org.moltools.design.data.PropertyAcceptorNucleotideSequence

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.