Package org.moltools.lib.seq

Examples of org.moltools.lib.seq.NucleotideSequence


        }
        else if (subEs[pos].getName().equals(TAG_ID)) {
          String tagID = subEs[pos].getAttributeValue(ID,ns);
          KeyValue kv = getLibraryTag(tagSettings.getTagLibraries(),tagID);
          if (kv != null) {
            NucleotideSequence tag = (NucleotideSequence) kv.getKey();
            SequenceDB<NucleotideSequence> lib = (SequenceDB<NucleotideSequence>) kv.getValue();
            tags.put(tag,lib);
          }
          else
            throw new IllegalArgumentException("Could not find a tag named: " + tagID); //$NON-NLS-1$
        }
        else if (subEs[pos].getName().equals(TAG)) {
          NucleotideSequence tag = getTag(subEs[pos]);
          tags.put(tag,null);
        }
      }     

      Probe p = new DefaultProbe(tssP,upstream,downstream,type);
      p.setID(id);
      p.setName(probeName);
      ProbeMakerPropertyUtils.setRank(p,rank);
      if (pg!=null)
        DesignUtils.addGroup(p,pg);

      //Go through and add tags
      int pos = 0;
      for (Iterator ti = tags.keySet().iterator();ti.hasNext();pos++) {
        NucleotideSequence t = (NucleotideSequence) ti.next();
        p.addTagAt(t,pos);       
        project.getTagAllocationTable().use(t,p,pos);       
      }
      tags.clear();
View Full Code Here


    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

        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

  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

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

  public static String getLongDescription() {
    return "This constructor generates empty target-specific sequences"; //$NON-NLS-1$
  }

  public PropertyAcceptorNucleotideSequence get3PrimeTSS(ProbeMakerTarget target, byte type) {
    NucleotideSequence seq = new SimpleNucleotideSequence("3'","",type); //$NON-NLS-1$ //$NON-NLS-2$
    return ProbeMakerSequenceFactory.createTSS(seq,target.getID());
  }
View Full Code Here

    NucleotideSequence seq = new SimpleNucleotideSequence("3'","",type); //$NON-NLS-1$ //$NON-NLS-2$
    return ProbeMakerSequenceFactory.createTSS(seq,target.getID());
  }

  public PropertyAcceptorNucleotideSequence get5PrimeTSS(ProbeMakerTarget target, byte type) {
    NucleotideSequence seq = new SimpleNucleotideSequence("5'","",type); //$NON-NLS-1$ //$NON-NLS-2$
    return ProbeMakerSequenceFactory.createTSS(seq,target.getID());
  }
View Full Code Here

        if (compPositions[pos] == i+1)
          allowsComp = false;
      }
     
      //Get the tag from the probe
      NucleotideSequence tag = p.getTagAt(i);
      int block = p.getBlockNoOfTag(i);
      int blockStart = p.getStartOfSequence(block);
      //If the tag is of 0 length don't do anything
      if (tag.length() > 0) {
        //Search for the tag sequence in the probe
        if (!allowsSeq) {
         
          occurrences = tsc.getOccurrences(tag.seqString(), p.seqString(),
              tag.getType(), p.getType(), true);
          //Go through each of the occurrences
          for (int occ = 0; occ < occurrences.length; occ++) {           
            int pos = occurrences[occ].intValue() + 1;
            if (pos != blockStart) {
              ProbeMakerPropertyUtils.addMessage(p,new Message(tag.getID() +
                  " found elsewhere in probe (position " + //$NON-NLS-1$
                  (pos) + ")", //$NON-NLS-1$
                  TAG_ELSEWHERE_INTERNAL,
                  Message.ERROR));
            }
          }
        }
        //search for the tag sequence complement in the probe
        if (!allowsComp) {
          occurrences = tsc.getOccurrences(NucleotideSequenceHandler.getRevComp(
              tag, p.getType()), p.seqString(), tag.getType(),
              p.getType(), true);
          for (int occ = 0; occ < occurrences.length; occ++) {
            int pos = occurrences[occ].intValue() + 1;
            if (pos != blockStart) {
              ProbeMakerPropertyUtils.addMessage(p,new Message("Complement of " + //$NON-NLS-1$
                  tag.getID() + " found (position " + //$NON-NLS-1$
                  (pos) + ")", //$NON-NLS-1$
                  TAG_COMPLEMENT_INTERNAL,
                  Message.ERROR));
            }
          }
View Full Code Here

   
    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

    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

TOP

Related Classes of org.moltools.lib.seq.NucleotideSequence

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.