Package org.moltools.lib.seq

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


        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

    //Create a table
    if (db.isEmpty()) {
      resultsTable = new JTable();
    }
    else {
      NucleotideSequence seq = db.iterator().next();
      if (seq instanceof ProbeMakerTarget) {
        Collection<ProbeMakerTarget> targets = new ArrayList<ProbeMakerTarget>();
        for (NucleotideSequence s : db.getSequenceCollection()) {
          targets.add((ProbeMakerTarget) s);
        }
View Full Code Here

    p1 = proj.getProbes().getSequenceAt(0);
    p2 = proj.getProbes().getSequenceAt(1);
    p3 = proj.getProbes().getSequenceAt(2);

    NucleotideSequence tag1 = libraries2_1_1[0].getSequenceAt(0);
   
    assertEquals(proj.getTagAllocationTable().getUserIDs(tag1).contains(p1.getID()),false);
    assertEquals(proj.getTagAllocationTable().getUserIDs(tag1).contains(p3.getID()),true);
   
    assertEquals(2, task.getCandidatesGenerated());
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

  /**Assemble the parts (subsequences) of the Probe*/
  protected String composeSequence() {
    StringBuffer sequencestring = new StringBuffer();
    for (int i = 1; i <= getSequenceCount(); i++) {
      NucleotideSequence si = getSequence(i);
      sequencestring.append(si == null ? "" : si.seqString()); //$NON-NLS-1$
    }
    return sequencestring.toString();
  }
View Full Code Here

    //Print the tags of each library - id;sequence;type
    for (int i = 0; i < libraries.length; i++) {
      TagLibrary l = libraries[i];
      p.println(TITLE_DESCRIPTOR + LIBRARY);
      for (Iterator<NucleotideSequence> ti = l.iterator(); ti.hasNext(); ) {
        NucleotideSequence t = ti.next();
        p.println(tio.getOutString(new String[] {t.getID(),t.seqString(),String.valueOf(t.getType())}));
      }
      p.println(TITLE_DESCRIPTOR + LISTEND);
    }

    increaseProgress();
    setStatus("Writing probes",0);       //$NON-NLS-1$

    //Make a list of probe groups
    List<ProbeGroup> p_groups = new ArrayList<ProbeGroup>();
    for (Iterator<Probe> i = proj.getProbes().iterator(); i.hasNext(); ) {
      Probe pr = i.next();
      ProbeGroup pg = (ProbeGroup) DesignUtils.getGroupWithType(pr,ProbeGroup.GROUP_TYPE);
      if (pg != null) {
        if (!p_groups.contains(pg)) {
          p_groups.add(pg);
        }
      }
    }

    //Print the probe groups - targetGroup;groupTagLibrary;groupTagNumber;
    p.println(TITLE_DESCRIPTOR + PROBE_GROUPS);
    for (Iterator<ProbeGroup> i = p_groups.iterator(); i.hasNext(); ) {
      ProbeGroup pg = i.next();
      TargetGroup tg = pg.getTargetGroup();
      int tg_no = tg == null ? -1 : groups.indexOf(tg);
      int lib_no = -1;
      int tag_no = -1;
      String tagID = proj.getTagAllocationTable().getGroupTagID(pg);
      if (tagID != null) {
        for (int l = 0; l < libraries.length; l++) {
          try {
            NucleotideSequence s = libraries[l].getSequenceByID(tagID);
            lib_no = l;
            tag_no = libraries[l].indexOfSequence(s);
          }
          catch (IDNotFoundException inx) {
            //do nothing
          }
        }
      }
      p.println(tio.getOutString(new String[] { String.valueOf(tg_no),String.valueOf(lib_no),String.valueOf(tag_no) }));
    }
    p.println(TITLE_DESCRIPTOR + LISTEND);

    //Print the probes - description;ID;type;upStream;downStream;target;group number;quality;messageCountArms;messageCountProbe;;5'seq;Tm;3'seq;Tm;tag 1 lib;tag 1 pos;...;...;tag n lib;tag n pos;
    p.println(TITLE_DESCRIPTOR + PROBES);
    DefiniteSequenceDB<Probe> probes = proj.getProbes();
    for (Iterator<Probe> i = probes.iterator(); i.hasNext(); ) {
      Probe pr = i.next();
      PropertyAcceptorNucleotideSequence fivePrime;
      PropertyAcceptorNucleotideSequence threePrime;
      try {
        fivePrime = (PropertyAcceptorNucleotideSequence) pr.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
      }
      catch (ClusterException e) {
        fivePrime = null;
      }
      try {
        threePrime = (PropertyAcceptorNucleotideSequence) pr.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
      }
      catch (ClusterException e) {
        threePrime = null;
      }

      int targetNo = -1;
      try {
        targetNo = pr.getTarget() == null ? -1 : proj.getTargets().indexOfSequence(proj.getTargets().getSequenceByID(pr.getTarget().getID()));
      }
      catch (IDNotFoundException ix) {
        //let targetNo be -1
      }
      Group<?> pg = DesignUtils.getGroupWithType(pr,ProbeGroup.GROUP_TYPE);

      String outStr = tio.getOutString(new String[] {
          pr.getName().replace(VALUE_SEPARATOR, VALUE_SEPARATOR_REPLACEMENT),
          pr.getID() != null ? pr.getID().replace(VALUE_SEPARATOR, VALUE_SEPARATOR_REPLACEMENT) : "No ID",                            //$NON-NLS-1$
              String.valueOf(pr.getType()),
              String.valueOf(pr.getUpstreamBlockCount()),
              String.valueOf(pr.getDownstreamBlockCount()),
              String.valueOf(targetNo),
              String.valueOf(pg == null ? -1 : p_groups.indexOf(pg)),
              String.valueOf(ProbeMakerPropertyUtils.getRank(pr)),
              String.valueOf(fivePrime == null ? 0 : ProbeMakerPropertyUtils.getAllMessages(fivePrime).size()),
              String.valueOf(threePrime == null ? 0 : ProbeMakerPropertyUtils.getAllMessages(threePrime).size()),
              String.valueOf(ProbeMakerPropertyUtils.getOwnMessages(pr.getTSSPair()).size()),
              String.valueOf(ProbeMakerPropertyUtils.getOwnMessages(pr).size()),
              fivePrime == null ? "" : fivePrime.seqString(), //$NON-NLS-1$
                  String.valueOf(fivePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(fivePrime)),
                  threePrime == null ? "" : threePrime.seqString(), //$NON-NLS-1$
                      String.valueOf(threePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(threePrime))
      });
      for (int t = 0; t < pr.getTags().size(); t++) {
        outStr += VALUE_SEPARATOR;
        NucleotideSequence tag = pr.getTagAt(t);
        //This isn't perfect but will work (if noone calls their tags 'Spacer')
        if (tag.getID().startsWith("Spacer")) { //$NON-NLS-1$
          outStr += "Spacer"; //$NON-NLS-1$
          outStr += VALUE_SEPARATOR;
          outStr += tag.seqString();
        }
        else {
          int lib_no = -1;
          int tag_no = -1;
          for (int l = 0; l < libraries.length; l++) {
            try {
              NucleotideSequence s = libraries[l].getSequenceByID(tag.getID());
              if (s!=null) {
                lib_no = l;
                tag_no = libraries[l].indexOfSequence(s);
              }
            }
            catch (IDNotFoundException inx) {
              //do nothing
            }
          }
          outStr += String.valueOf(lib_no);
          outStr += VALUE_SEPARATOR;
          outStr += String.valueOf(tag_no);
        }
      }
      p.println(outStr);

      if (fivePrime != null) {
        for (Iterator<Message> mi = ProbeMakerPropertyUtils.getAllMessages(fivePrime).iterator();mi.hasNext();) {
          Message m = mi.next();
          MessageType mt = m.getType();
          p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
        }
      }
      if (threePrime != null) {
        for (Iterator<Message> mi = ProbeMakerPropertyUtils.getAllMessages(threePrime).iterator();mi.hasNext();) {
          Message m = mi.next();
          MessageType mt = m.getType();
          p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
        }
      }
      for (Iterator<Message> mi = ProbeMakerPropertyUtils.getOwnMessages(pr.getTSSPair()).iterator();mi.hasNext();) {
        Message m = mi.next();
        MessageType mt = m.getType();
        p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
      }
      for (Iterator<Message> mi = ProbeMakerPropertyUtils.getOwnMessages(pr).iterator();mi.hasNext();) {
        Message m = mi.next();
        MessageType mt = m.getType();
        p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
      }
    }
    p.println(TITLE_DESCRIPTOR + LISTEND);

    increaseProgress();
    setStatus("Writing settings",0);       //$NON-NLS-1$

    //Print the settings of the project
    Settings s = proj.getSettings();

    List<CandidateAnalysisModule> modules1 = s.getArmModules();
    List<CandidateAnalysisModule> modules2 = s.getCandidateModulesStage1();
    List<CandidateAnalysisModule> modules3 = s.getCandidateModulesStage2();
    Properties props = new Properties();
    props.putAll(s.getDesignParameters());

    p.println(TITLE_DESCRIPTOR + MODULES1);
    for (Iterator<CandidateAnalysisModule> i = modules1.iterator();i.hasNext();)
      p.println(getModuleString(i.next(),tio));
    p.println(TITLE_DESCRIPTOR + LISTEND);
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.