Package org.moltools.lib.seq

Examples of org.moltools.lib.seq.NucleotideSequence


  }

  @Override
  public Object getValueAt(int parm1, int parm2) {
    try {
      NucleotideSequence t = (NucleotideSequence) getSequenceAt(parm1);
      switch (parm2) {
        case 0:
          return t.getID();
        case 1:
          return t.seqString();
        case 2:
          List<String> c = new ArrayList<String>(tagAllocationTable.getUserIDs(t));
          if (c == null) {
            return Collections.EMPTY_LIST;
          }
View Full Code Here


    if (_library != null) {
      ChangeableSequenceDB<NucleotideSequence> templib = new ListSequenceDB<NucleotideSequence>(_library);
      _library.clear();
      Iterator<NucleotideSequence> i = templib.iterator();
      while (i.hasNext()) {
        NucleotideSequence t = i.next();
        _library.addSequence(t);
      }
    }
    super.setLibrary(_library);
  }
View Full Code Here

    /**** Searches are performed as string searches, and thus use string index system.  ******/
    //For a sequence to be a template for a padlock probe, it is
    //necessary for the sequence to be similar to the intended template, and
    //in particular, the sequence near the probes ends must be identical
    try {
      NucleotideSequence tss5 = p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
      NucleotideSequence tss3 = p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
     
//    The sequence of the probe arms (full arms)
      String tssSeq = tss3.seqString() + tss5.seqString();
      NucleotideSequence fullTSS = new SimpleNucleotideSequence("TSS",tssSeq,p.getType()); //$NON-NLS-1$

     
      //Get the sequence to search for in other probes  
      String threeseq = p.subsequence(p.length() - min3Length + 1, p.length());
      String fiveseq = p.subsequence(1, min5Length);
      String query = NucleotideSequenceHandler.getRevComp(threeseq + fiveseq, p.getType(),s.getType());
     
      //Length of 5' TSS
      int TSSlen5 = tss5.length();
      //Length of 3' TSS
      int TSSlen3 = tss3.length();

      //Get the string to search in, extend it if it is to be interpreted as circular,
      //and change any Us to Ts to allow correct interpretation       
      String sequence = s.seqString().replace('U', 'T');
     
      if (circular) {
        sequence += sequence.substring(0, min3Length + min5Length - 1);
      }
     
      //To store the results in
      Stack<Integer> results = new Stack<Integer>();
        
      //Search for occurrences of the query in the sequence
      int index = -1;
      while ((index = sequence.indexOf(query, index + 1)) > -1) {    
             
        //If stipulated, check Tm to be above limit
        if (doTm) {               
          float maxTm = -Float.MAX_VALUE;     
                 
          //Extract a template to check the whole TSS pair against
          int start = Math.max(0,index+min5Length-TSSlen5);
          int end = Math.min(index+min5Length+TSSlen3,sequence.length());

          //Get the template to compare to
          String template = sequence.substring(start,end);
          //Get all possible sequences to match the probe to
          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 {
View Full Code Here

  /**Checks whether the arms of this probe may template ligation of the probe.
   * The arms are linked at the ligation site, open at the linker ends.*/
  public boolean checkTemplatingByArms(Probe p) {
    boolean found = false;
    //Check self-templating
    NucleotideSequence fp;
    try {
      fp = p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
    }
    catch (ClusterException e) {
      fp = null;
    }
    NucleotideSequence tp;
    try {
      tp = p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
    }
    catch (ClusterException e) {
      tp = null;
    }
   
    if (tp == null || fp == null) throw new UnsupportedOperationException("Can't perform ligation calculations with missing TSSs"); //$NON-NLS-1$
   
    int[] results = isLigationTemplate(
        new SimpleChangeableNucleotideSequence(
            "TSS|"+p.getName(), //$NON-NLS-1$
            tp.seqString() + fp.seqString(),
            p.getType()
        ), p, false, false);
    if (results != null) {
      for (int i = 0; i < results.length; i++) {
        ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message(
View Full Code Here

    for (Iterator<? extends Probe> pi = probes.iterator(); pi.hasNext(); ) {
      Probe other = pi.next();
      //Check for templating and add messages accordingly
      if (other != p) {
        //Does the arms of this probe template other probe?
        NucleotideSequence fp;
        try {
          fp = p.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
        }
        catch (ClusterException e) {
          fp = null;
        }
        NucleotideSequence tp;
        try {
          tp = p.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
        }
        catch (ClusterException e) {
          tp = null;
        }
       
        if (tp == null || fp == null) throw new UnsupportedOperationException("Can't perform ligation calculations with missing TSSs"); //$NON-NLS-1$
       
        if (isLigationTemplate(new SimpleNucleotideSequence(tp.
            seqString() + fp.seqString(),
            "Arms of " + p.getName(), //$NON-NLS-1$
            p.getType()), other, false, false) != null) {
          ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May act as template for " + //$NON-NLS-1$
              other.getName(),
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

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.