Package org.moltools.lib.struct

Examples of org.moltools.lib.struct.NAHybridStructure


            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


          String[] sequences = NucleotideSequenceHandler.getPossibleSequences(template,s.getType());

          for (int sc = 0;sc<sequences.length;sc++) {

            NucleotideSequence s2 = new SimpleNucleotideSequence("S2",sequences[sc],s.getType());                       //$NON-NLS-1$
            NAHybridStructure hs = ((FractionalMeltingPointCalculator) fmpc).calculateHybridStructure(fullTSS,s2);       

            if (hs != null) {
              float Tm;
              try {
                Tm = fmpc.getMeltingPoint(fullTSS,s2,hs);
View Full Code Here

  public NAHybridStructure calculateStructure(String seq1, String seq2, byte type1, byte type2) {
    lac.doAlignment(seq1, SequenceHandler.getRev(seq2));
    Alignment la = lac.getNextAlignment();
    if (la == null) return null;
    NAHybridStructure s = new DefaultNAHybridStructure(la, seq2.length());
    return s;
  }
View Full Code Here

          //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

            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

  static byte NO_RISK = 0;
  static byte RISK = 1;
  static byte HI_RISK = 2;
 
  byte compare(NucleotideSequence p, NucleotideSequence other) {
    NAHybridStructure struct = fmpc.calculateHybridStructure(p,other);
    float Tm; 
    if (struct == null)
      Tm = - MeltingPointCalculator.T0;
    else
      Tm = fmpc.getMeltingPoint(p,other,struct);
View Full Code Here

     
      //Get all sequences to match the primer to
      String[] sequences = NucleotideSequenceHandler.getPossibleSequences(sequence.substring(index,Math.min(index + primer.length(),sequence.length()-1)),target.getType());
     
      float maxTm = -Float.MAX_VALUE;
      NAHybridStructure top = null;
      NucleotideSequence s1 = new SimpleNucleotideSequence(primer.getID(),primer.seqString(),primer.getType());
      //int tops = -1;
      for (int s = 0;s<sequences.length;s++) {
             
        NucleotideSequence s2 = new SimpleNucleotideSequence("S2",sequences[s],target.getType());              //$NON-NLS-1$

        log.debug(s + ":  " + s1.seqString()); //$NON-NLS-1$
        log.debug("    " + SequenceHandler.getRev(s2)); //$NON-NLS-1$
       
        NAHybridStructure hs = fmpc.calculateHybridStructure(s1,s2);       
       
        if (hs != null) {
         
          log.debug("      " + hs.getFirstString()); //$NON-NLS-1$
          log.debug("      " + SequenceHandler.getRev(hs.getSecondString()));           //$NON-NLS-1$
         
          float Tm;
          Tm = fmpc.getMeltingPoint(s1,s2,hs);
         
         
View Full Code Here

            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

          String[] sequences = NucleotideSequenceHandler.getPossibleSequences(template,s.getType());
         
          for (int sc = 0;sc<sequences.length;sc++) {
                 
            NucleotideSequence s2 = new SimpleNucleotideSequence("S2",sequences[sc],s.getType());                       //$NON-NLS-1$
            NAHybridStructure hs = ((FractionalMeltingPointCalculator) fmpc).calculateHybridStructure(fullTSS,s2);       
           
            if (hs != null) {
              float Tm;
              try {
                Tm = fmpc.getMeltingPoint(fullTSS,s2,hs);
View Full Code Here

  static byte NO_RISK = 0;
  static byte RISK = 1;
  static byte HI_RISK = 2;
 
  byte compare(NucleotideSequence p, NucleotideSequence other) {
    NAHybridStructure struct = fmpc.calculateHybridStructure(p,other);
    float Tm; 
    if (struct == null)
      Tm = - MeltingPointCalculator.T0;
    else
      Tm = fmpc.getMeltingPoint(p,other,struct);
View Full Code Here

TOP

Related Classes of org.moltools.lib.struct.NAHybridStructure

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.