Examples of Nucleotide


Examples of org.moltools.lib.seq.alphabet.Nucleotide

      TagLibrary spacerLib = new SpacerLibrary(0, NucleotideSequence.DNA);

      //parse the spacer string and check that its valid
      spacerSequence = ""; //$NON-NLS-1$
      for (int i = 0; i < spacerString.length(); i++) {
        Nucleotide nt = NucleotideSequenceHandler.getNucleotide(spacerString.
            charAt(i),
            NucleotideSequence.DNA);
        if (nt == null) {
          throw new UnsupportedOperationException("Invalid spacer sequence"); //$NON-NLS-1$
        }
        spacerSequence += nt.getChar();
      }

      //Increase the length of the libs by one to make room for spacer library
      taglibraries = new TagLibrary[libs.length + 1];     
      tagorder = new int[libs.length + 1];
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

    @return true if string is a valid sequence
    @return false otherwise*/
  public boolean isValidPoly(String seq, byte type1) {
    try {
      for (int i = 0;i<seq.length();i++) {
        Nucleotide nt = NucleotideSequenceHandler.getNucleotide(seq.charAt(i),
            this.getType());
        if (nt == null) return false;
      }
    }
    catch (Exception ex) {
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

          throw new SequenceFormatException("Too many position symbols"); //$NON-NLS-1$
        }
      }
      else if (current == variantSeparator) { //SNP
        //Check the next char, if outofbounds we have an error
        Nucleotide nextnt;
        try {
          nextnt = NucleotideSequenceHandler.getNucleotide(seq.charAt(pos + 1), acidType);
        }
        catch (StringIndexOutOfBoundsException sx) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos + 2)); //$NON-NLS-1$
        }
        //Check previous position, this must be a nucleotide
        Nucleotide prevnt = NucleotideSequenceHandler.getNucleotide(previous, acidType);
        if (prevnt == null) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos)); //$NON-NLS-1$
        }
        if (nextnt == null) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos + 2)); //$NON-NLS-1$
        }
        if (inSNP) { //We are already in the SNP, add the next nucleotide
          SNPNucleotides.push(nextnt);
        }
        else { //Add both the previous and the next
          SNPNucleotides.push(prevnt);
          SNPNucleotides.push(nextnt);
          inSNP = true;
          //and remove the last nucleotide from elements or the top InDel
          SequenceElementContainer e = (SequenceElementContainer) elementStack.peek();
          e.removeFromEnd();
        }
        //Step up one step and check if this was the last separator
        pos++;
        char next = ' ';
        try {
          next = seq.charAt(pos + 1);
        }
        catch (StringIndexOutOfBoundsException sx2) {
          //Don't care
        }
        if (next != variantSeparator) {
          //This was the last separator so make the SNP
          Nucleotide[] nucs = new Nucleotide[SNPNucleotides.size()];
          for (int i = 0; i < nucs.length; i++) {
            nucs[i] = SNPNucleotides.pop();
          }
          SNP snp = new SNP(nucs, "SNP " + (++SNPno)); //$NON-NLS-1$
          //and add it to the element on the stack
          SequenceElementContainer e = (SequenceElementContainer) elementStack.peek();
          e.addToEnd(snp);
          inSNP = false;
        }
      }
      else if (current == inDelBeginSymbol) {
        elementStack.push(new InDel("InDel " + (++InDelno), "", "InDel " + (++InDelno), acidType)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      }
      else if (current == inDelEndSymbol) {
        if (elementStack.size() < 2) {
          throw new SequenceFormatException("Too many InDel end symbols"); //$NON-NLS-1$
        }
        InDel indel = (InDel) elementStack.pop();
        SequenceElementContainer e = (SequenceElementContainer) elementStack.peek();

        e.addToEnd(indel);
      }
      else {
        //No special symbol, so is either nucleotide, degenerate nucleotide or invalid symbol
        Nucleotide n = NucleotideSequenceHandler.getNucleotide(current, acidType);
        if (n == null) { //invalid
          throw new SequenceFormatException(
              "Invalid symbol encountered during sequence parsing: " + current); //$NON-NLS-1$
        }
        if (NucleotideSequenceHandler.isPoly(n)) { //degenerate nucleotide (SNP)
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

        //Get the current char
      }
      current = seq.charAt(pos);
      if (current == variantSeparator) { //SNP
        //Check the next char, if outofbounds we have an error
        Nucleotide nextnt;
        try {
          nextnt = NucleotideSequenceHandler.getNucleotide(seq.charAt(pos + 1),
              acidType);
        }
        catch (StringIndexOutOfBoundsException sx) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos + 2)); //$NON-NLS-1$
        }
        //Check previous position, this must be a nucleotide
        Nucleotide prevnt = NucleotideSequenceHandler.getNucleotide(previous, acidType);
        if (prevnt == null) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos)); //$NON-NLS-1$
        }
        if (nextnt == null) {
          throw new SequenceFormatException(
              "Expected nucleotide at position: " + (pos + 2)); //$NON-NLS-1$
        }
        if (inSNP) { //We are already in the SNP, add the next nucleotide
          SNPNucleotides.push(nextnt);
        }
        else { //Add both the previous and the next
          SNPNucleotides.push(prevnt);
          SNPNucleotides.push(nextnt);
          inSNP = true;
          //and remove the last nucleotide from elements or the top InDel
          SequenceElementContainer e = elementStack.peek();
          e.removeFromEnd();
        }
        //Step up one step and check if this was the last separator
        pos++;
        char next = ' ';
        try {
          next = seq.charAt(pos + 1);
        }
        catch (StringIndexOutOfBoundsException sx2) {
          sx2.printStackTrace();
        }
        if (next != variantSeparator) {
          //This was the last separator so make the SNP
          Nucleotide[] nucs = new Nucleotide[SNPNucleotides.size()];
          for (int i = 0; i < nucs.length; i++) {
            nucs[i] = SNPNucleotides.pop();
          }
          SNP snp = new SNP(nucs, "SNP " + (++SNPno)); //$NON-NLS-1$
          //and add it to the element on the stack
          SequenceElementContainer e = elementStack.peek();
          e.addToEnd(snp);
          inSNP = false;
        }
      }
      else if (current == inDelBeginSymbol) {
        elementStack.push(new InDel("InDel " + (++InDelno),"", "InDel " + (++InDelno), acidType)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      }
      else if (current == inDelEndSymbol) {
        if (elementStack.size() < 2) {
          throw new IllegalArgumentException("Too many InDel end symbols"); //$NON-NLS-1$
        }
        InDel indel = (InDel) elementStack.pop();
        SequenceElementContainer e = elementStack.peek();

        e.addToEnd(indel);
      }
      else {
        //No special symbol, so is either nucleotide, degenerate nucleotide or invalid symbol
        Nucleotide n = NucleotideSequenceHandler.getNucleotide(current, acidType);
        if (n == null) { //invalid
          throw new IllegalArgumentException(
              "Invalid symbol encountered during sequence parsing: " + current); //$NON-NLS-1$
        }
        if (NucleotideSequenceHandler.isPoly(n)) { //degenerate nucleotide (SNP)
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

      TagLibrary spacerLib = new SpacerLibrary(0, NucleotideSequence.DNA);

      //parse the spacer string and check that its valid
      spacerSequence = ""; //$NON-NLS-1$
      for (int i = 0; i < spacerString.length(); i++) {
        Nucleotide nt = NucleotideSequenceHandler.getNucleotide(spacerString.
            charAt(i),
            NucleotideSequence.DNA);
        if (nt == null) {
          throw new UnsupportedOperationException("Invalid spacer sequence"); //$NON-NLS-1$
        }
        spacerSequence += nt.getChar();
      }

      //Increase the length of the libs by one to make room for spacer library
      taglibraries = new TagLibrary[libs.length + 1];     
      tagorder = new int[libs.length + 1];
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

    }
    else { //Target is Poly
      Polymorphism poly = getPolys()[targetPoly - 1];
      if (poly instanceof SNP) {

        Nucleotide n = (Nucleotide) poly.getVariants()[variantIndex];
        if (n == null) {
          throw new UnsupportedOperationException("No target nucleotide found"); //$NON-NLS-1$
        }

        String seq = subsequence(getTargetPosition()+1, length());
        String nt = String.valueOf(n.getChar());
        String full = nt + seq;
       
        template = new SimpleSubSequenceTemplate(tempID, full, getType(),
                               getTargetPosition(), length(), getID());
      }
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

    Polymorphism poly = getPolys()[targetPoly - 1];
    if (poly instanceof SNP) {
      pat3 = new SimpleSubSequenceTemplate(this, "Template for 3' arm", getType(), //$NON-NLS-1$
          getTargetPosition() + 1,
          length(), getID());
      Nucleotide n = (Nucleotide) poly.getVariants()[variantIndex];
      if (n == null) {
        throw new UnsupportedOperationException("No target nucleotide found"); //$NON-NLS-1$
      }
    }
    else if (poly instanceof InDel) {
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

    }
    else { //Target is Poly
      Polymorphism poly = getPolys()[targetPoly - 1];
      if (poly instanceof SNP) {
       
        Nucleotide n = (Nucleotide) poly.getVariants()[variantIndex];
        if (n == null) {
          throw new UnsupportedOperationException("No target nucleotide found"); //$NON-NLS-1$
        }
       
        String full = n.getChar() + subsequence(getTargetPosition(),length());
       
        template = new SimpleSubSequenceTemplate(tempID,full, getType(),
                               getTargetPosition(), length(), getID());
       
      }
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

      TagLibrary spacerLib = new SpacerLibrary(0, NucleotideSequence.DNA);

      //parse the spacer string and check that its valid
      spacerSequence = ""; //$NON-NLS-1$
      for (int i = 0; i < spacerString.length(); i++) {
        Nucleotide nt = NucleotideSequenceHandler.getNucleotide(spacerString.
            charAt(i),
            NucleotideSequence.DNA);
        if (nt == null) {
          throw new UnsupportedOperationException("Invalid spacer sequence"); //$NON-NLS-1$
        }
        spacerSequence += nt.getChar();
      }

      //Increase the length of the libs by one to make room for spacer library
      taglibraries = new TagLibrary[libs.length + 1];     
      tagorder = new int[libs.length + 1];
View Full Code Here

Examples of org.moltools.lib.seq.alphabet.Nucleotide

      spacerString = ""; //$NON-NLS-1$

    //parse the spacer string and check that its valid
    String spacerSequence = ""; //$NON-NLS-1$
    for (int i = 0; i < spacerString.length(); i++) {
      Nucleotide nt = NucleotideSequenceHandler.getNucleotide(spacerString.
          charAt(i),
          NucleotideSequence.DNA);
      if (nt == null) {
        throw new UnsupportedOperationException("Invalid spacer sequence"); //$NON-NLS-1$
      }
      spacerSequence += nt.getChar();
    }
    //Ok, now either move or create new spacer lib
    List<TagLibrary> libs = new ArrayList<TagLibrary>(Arrays.asList(taglibraries));
    List<Object> used = new ArrayList<Object>(Arrays.asList(usedLists));
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.