Examples of NucleotideSequence


Examples of org.moltools.lib.seq.NucleotideSequence

   
    boolean foundTIO = false;
    boolean foundOIT = false;
   
    /**This probe's tag*/
    NucleotideSequence tag = thisProbe.getTagAt(tagpos);
    String tagseq = tag.seqString();
    //Check that tag sequence is longer than 0
    if (tagseq.length() > 0) {
      //Go through each tag position of this probe ...
      /**Tag*/
      if (checkSequence) {
        //Search for the tag sequence in the other probe
        occurrences = tsc1.getOccurrences(tagseq, otherSeq, tag.getType(),
            otherProbe.getType(), true);
        int blockStart = otherProbe.getStartOfSequence(thisProbe.getBlockNoOfTag(tagpos));
        //Check each occurrence
        for (int occ = 0; occ < occurrences.length; occ++) {
          int pos = occurrences[occ].intValue() + 1;
          boolean add;
          switch (mode) {
            case TagLibrary.USE_SAME_TAG:
            case TagLibrary.USE_ANY_TAG:
             
              //Add only if tag is present in other position. If index is the
              //starting position of the block with the same block index as the tag, OK.
              add = (pos != blockStart);
              break;
            case TagLibrary.USE_UNIQUE_IN_GROUP:
             
              //Add if present in other position or if in same group
              add = (pos != blockStart) || sameGroup;
              break;
            case TagLibrary.USE_PER_GROUP:
             
              //Add if present in other position or target is in different group
              add = (pos != blockStart) || !sameGroup;
              break;
            default:
             
              //Always add
              add = true;
          }
         
          //If we're supposed to add a warning, do so now
          if (add) {
            foundTIO = true;
            ProbeMakerPropertyUtils.addMessage(thisProbe,new Message(tag.getID() +
                " found in " + otherProbe.getName(), //$NON-NLS-1$
                TAG_ELSEWHERE_EXTERNAL,
                Message.ERROR));
          }
        }
      }
      //Check the complement too
      /**Complement*/
      if (checkComplement) {
        occurrences = tsc1.getOccurrences(NucleotideSequenceHandler.getRevComp(
            tag, otherProbe.getType()), otherSeq, tag.getType(),
            otherProbe.getType(), true);
        //Check each occurrence
        for (int occ = 0; occ < occurrences.length; occ++) {
          foundTIO = true;
          ProbeMakerPropertyUtils.addMessage(thisProbe,new Message("Complement of " + //$NON-NLS-1$
              tag.getID() +
              " found in " + otherProbe.getName(), //$NON-NLS-1$
              TAG_COMPLEMENT_EXTERNAL,
              Message.ERROR));
        }
      }
    }
   
    /**Other probe's tag*/
    //Check number of tag libraries in other probe
    if (otherProbe.getTags().size() > tagpos) {
      //Get the tag from the other probe
      tag = otherProbe.getTagAt(tagpos);
      tagseq = tag.seqString();
      //Check that tag sequence is longer than 0
      if (tagseq.length() > 0) {
        /**Tag*/
        if (checkSequence) {
          //search for the tag sequence in this probe
          occurrences = tsc1.getOccurrences(tagseq, thisSeq, tag.getType(),
              otherProbe.getType(), true);
        }
        else {
          occurrences = new Integer[0];
        }
        //Check each occurrence
        for (int occ = 0; occ < occurrences.length; occ++) {
          int pos = occurrences[occ].intValue() + 1;
          int blockStart = thisProbe.getStartOfSequence(otherProbe.getBlockNoOfTag(
              tagpos));
          boolean add;
         
          switch (mode) {
            case TagLibrary.USE_SAME_TAG:
            case TagLibrary.USE_ANY_TAG:
             
              //Add only if present in other position
              add = (pos != blockStart);
              break;
            case TagLibrary.USE_UNIQUE_IN_GROUP:
             
              //Add if present in other position or if targets in same group
              add = (pos != blockStart) || sameGroup;
              break;
            case TagLibrary.USE_PER_GROUP:
             
              //Add if present in other position or target is in different group
              add = (pos != blockStart) || !sameGroup;
              break;
            default:
             
              //Always add
              add = true;
          }
          //if we're supposed to add a warning, do so now
          if (add) {
            foundOIT = true;
            ProbeMakerPropertyUtils.addMessage(thisProbe,new Message(tag.getID() +
                " from " + //$NON-NLS-1$
                otherProbe.getName() +
                " found (position " + //$NON-NLS-1$
                pos + ")", //$NON-NLS-1$
                OTHER_TAG_PRESENT, Message.ERROR));
          }
        }
        /**Complement*/
        if (checkComplement) {
          if (otherProbe.getTags().size() > tagpos) {
            //Get the tag from the other probe
            tag = otherProbe.getTagAt(tagpos);
            tagseq = tag.seqString();
            //Search for the tag sequence in this probe
            occurrences = tsc1.getOccurrences(NucleotideSequenceHandler.
                getRevComp(tag,
                    thisProbe.getType()), thisSeq, tag.getType(),
                    otherProbe.getType(), true);
          }
          else {
            occurrences = new Integer[0];
          }
          //Check each occurrence
          for (int occ = 0; occ < occurrences.length; occ++) {
            foundOIT = true;
            ProbeMakerPropertyUtils.addMessage(thisProbe,new Message("Complement of " + //$NON-NLS-1$
                tag.getID() +
                " from " + //$NON-NLS-1$
                otherProbe.getName() +
                " found (position " + //$NON-NLS-1$
                occurrences[occ] + ")", //$NON-NLS-1$
                OTHER_TAG_COMPLEMENT_PRESENT,
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

    if (spacerPosition > -1 && spacerString.length() == 0 &&
        p.getTags().size() > 0) {
      //Spacer used and not first call
      //Shouldn't bother with this if the combination of the other tags is invalid
      if (tagSelector.isValidCombination(tagSelector.getTagIndices(), p)) {
        NucleotideSequence spacer = ( (SpacerLibrary) taglibraries[spacerPosition]).getNext();
        if (spacer != null) {
          p.removeTagAt(spacerPosition);
          p.addTagAt(spacer, spacerPosition);
          return true;
        }
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

        if (p.getTags().size() > spacerPosition) {
          //We have to replace the tag with a copy, otherwise the next probe will adjust the same spacer
          //first remove the old spacer
          p.removeTagAt(spacerPosition);
          int spacerLength = Math.max(0, prefLength - p.length());
          NucleotideSequence spacer;
          if (spacerString.length() > 0) {
            String temp = ""; //$NON-NLS-1$
            //Add a new nucleotide until the correct length is achieved
            for (int i = 0; i < spacerLength; i++) {
              temp += spacerString.charAt(i % spacerString.length());
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

  protected void reserve(Probe p) {
    //Target target = p.getTarget();
    p.setTagsAllocated(true);
    //Iterate through the tag positions
    for (int tagpos = 0; tagpos < p.getTags().size(); tagpos++) {
      NucleotideSequence tag = p.getTagAt(tagpos);
      //Set each tag to used
      tagAllocationTable.use(tag,p,tagpos);  
    }
  }
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

  /**Clears this probe candidate by removing any messages and tags.*/
  protected void clear(Probe p) {
    ProbeMakerPropertyUtils.clearMessages(p);

    for (int i = 0; i < p.getTags().size(); i++) {
      NucleotideSequence t = p.getTagAt(i);
      //This target is no longer associated with this tag
      tagAllocationTable.unuse(t,p);
    }
    p.removeAllTags();
    p.setTagsAllocated(false);
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

        }
      }
    }
   
    //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$
            }
          }
        }
      }
    }
    if (tests[1].perform()) {
      for (Iterator<NucleotideSequence> pi = primerList.iterator();pi.hasNext();) {
        NucleotideSequence other = pi.next();           
        int[] results = getPrimingPositions(primer,other);
        if (results != null) {
          for (int i = 0; i < results.length; i++) {
            ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
                "May prime on " + other.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_PRIMER,
                Message.ERROR));
            log.debug(p.getName() + "/" + other.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

Examples of org.moltools.lib.seq.NucleotideSequence

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

Examples of org.moltools.lib.seq.NucleotideSequence

  public boolean isUsable(int tagpos, int tagno, Group<?> group) {   
    boolean usable = false;
    TagLibrary lib = taglibraries[tagpos];
    Collection<String> usedTagIDs = usedLists[tagpos];
    byte mode = lib.getMode();
    NucleotideSequence tag = lib.getSequenceAt(tagno);
    switch (mode) {
      case TagLibrary.USE_ANY_TAG:
        //All tags are usable
        usable = true;
        break;
      case TagLibrary.USE_SAME_TAG:
        //Only the first tag in usedTags is usable, or any if not set
        if (usedTagIDs.isEmpty()) {
          usable = true;
        }
        else {
          usable = usedTagIDs.contains(tag.getID());
          if (usedTagIDs.size()>1) throw new IllegalStateException("Cannot have two ids in same mode"); //$NON-NLS-1$
        }
        break;
      case TagLibrary.USE_UNIQUE_TAG:
        //Usable if not already used
        usable = !isUsed(tag);
        break;
      case TagLibrary.USE_PER_GROUP:
        //If group tag set, only that one usable, else any unused is usable
        //If no group, all unused usable
        if (group == null) {
          usable = !isUsed(tag);
          //If set, only group tag usable
        }
        else {
          String tagID = getGroupTagID(group);       
          if (tagID != null) {
            usable = (tagID.equals(tag.getID()));
          }
          else {
            //If group tag not set, all unused usable
            usable = !isUsed(tag);
          }
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

      //For all libraries except spacers
      TagLibrary library = libraries[i];
      if (!(library instanceof SpacerLibrary)) {
        //Iterate through each tag...
        for (int tagno = 0; tagno < libraries[i].size(); tagno++) {
          NucleotideSequence t = libraries[i].getSequenceAt(tagno);
          //setStatus(t.getName());
          for (Iterator<CandidateAnalysisModule> m = modules.iterator(); m.hasNext(); ) {
            ProbeAnalysisModule mod = (ProbeAnalysisModule) m.next();
            if (!mod.acceptTag(t, probeset)) {
              //log.printLine(t.getName() + " not accepted by " + PlugInDescriptor.getBriefDescription(mod)); //$NON-NLS-1$
View Full Code Here

Examples of org.moltools.lib.seq.NucleotideSequence

        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
TOP
Copyright © 2018 www.massapi.com. 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.