Package org.moltools.apps.probemaker.seq

Examples of org.moltools.apps.probemaker.seq.ProbeMakerTarget


  /**(Re)calculate the Tm values of the TSSs of this pair*/
  public static void calculateArmTemperatures(TSSPair p, MeltingPointCalculator defaultMpc, MeltingPointCalculator backupMpc) {
    MessageType mt = new MessageType("TEMPERATUR_CALCULATION", //$NON-NLS-1$
    "Temperature calculation"); //$NON-NLS-1$
    ProbeMakerTarget t = null;
    try {
      t = (ProbeMakerTarget) p.getTarget();     
      if (p.getTarget() == null) {
        ProbeMakerPropertyUtils.addMessage(p,new Message(
            "No target found. Calculated hybridization temperature based on full match", //$NON-NLS-1$
            mt, Message.ALERT));
      }           
    }
    catch (ClassCastException ccx) {     
      ProbeMakerPropertyUtils.addMessage(p,new Message(
          "Not a ProbeMakerTarget. Calculated hybridization temperature based on full match", //$NON-NLS-1$
          mt, Message.ALERT));
    }

    try {
      PropertyAcceptorNucleotideSequence five = (PropertyAcceptorNucleotideSequence) p.getSequence(TSSPair.KEY_FIVE_PRIME);
      if (five != null) {       
        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);
View Full Code Here


    int tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
      if (aborted()) break;
      logger.info("Designing TSSs for target " + (tindex+1)); //$NON-NLS-1$*/
      //Get the target
      ProbeMakerTarget target = ti.next();
      //Create a TSS pair
      try {
        pairs[tindex] = td.designTSSPair(target);
      }
      catch (Exception ex) {
        log.printLine("A problem occurred"); //$NON-NLS-1$
        log.printError(ex.getMessage());
        handler.handleError(ex.toString(),ex);       
      }
      tindex++;
    }
   
    fireStatusChange(0,"Creating probes"); //$NON-NLS-1$
   
    //Make new probes and store in a separate list
    ListSequenceDB<Probe> newProbes = new ListSequenceDB<Probe>();
    tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
     
      if (aborted()) return false;       
     
      //Get the target
      ProbeMakerTarget target = ti.next();
      try {
       
        //Create a new probe for the target, with the specified TSS
        logger.info("Creating probe for " + target.getID()); //$NON-NLS-1$
        byte probeAcidType = Byte.parseByte(parameters.get(PROP_PROBE_ACID_TYPE));
        int up = Integer.parseInt(parameters.get(PROP_UPSTREAM_BLOCKS));
        int down = Integer.parseInt(parameters.get(PROP_DOWNSTREAM_BLOCKS));
        String id = namer.getProbeID(project, target);
        Probe p = ProbeMakerSequenceFactory.createProbeSkeleton(id, pairs[tindex],probeAcidType,up,down,probes);                
View Full Code Here

    setStatus("Setting up",0); //$NON-NLS-1$

    //Count the number of target groups
    List<TargetGroup> groups = new ArrayList<TargetGroup>();
    for (Iterator<ProbeMakerTarget> i = proj.getTargets().iterator(); i.hasNext(); ) {
      ProbeMakerTarget t = i.next();
      TargetGroup tg = (TargetGroup) DesignUtils.getGroupWithType(t,TargetGroup.GROUP_TYPE);
      if (tg != null) {
        if (!groups.contains(tg)) {
          groups.add(tg);
        }
      }
    }

    //Create a PrintStream
    PrintWriter p = new PrintWriter(out);

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

    //Print a header line
    Date d = new Date();
    p.println("Project exported " + DateFormat.getDateTimeInstance().format(d)); //$NON-NLS-1$
    p.println(TITLE_DESCRIPTOR + VERSION);
    p.println(version);
    p.println(TITLE_DESCRIPTOR + NAME);
    p.println(proj.getName());

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

    //Print the number of target groups
    p.println(TITLE_DESCRIPTOR + TARGET_GROUPS);
    p.println(groups.size());

    //Print the target type
    p.println(TITLE_DESCRIPTOR + TARGET_TYPE);
    if (proj.getTargets().size() > 0) {
      Sequence target = proj.getTargets().getSequenceAt(0);
      p.println(target.getClass().getName());
    }
    else {
      p.println(""); //$NON-NLS-1$
    }

    //Print the targets - description;sequence;type;variant;group;
    p.println(TITLE_DESCRIPTOR + TARGETS);
    for (Iterator<ProbeMakerTarget> i = proj.getTargets().iterator(); i.hasNext(); ) {
      ProbeMakerTarget t = i.next();
      setStatus(t.getID(),1);
      String descStr = t.getID();
      String seqStr = t instanceof SequenceView ? ((SequenceView) t).getViewSequence() : t.seqString();
      String typeStr = String.valueOf(t.getType());
      String varStr = ""; //$NON-NLS-1$
      if (t instanceof VariantTarget) {
        VariantTarget vt = (VariantTarget) t;
        if (vt.getVariant() != null) {
          String str = vt.getVariant().toString();
          for (int v = 0; v < vt.getVariants().length; v++) {
            if (vt.getVariants()[v].toString().equals(str)) {
              varStr = String.valueOf(v);
              //Break the loop
              break;
            }
          }
        }
      }
      TargetGroup tg = (TargetGroup) DesignUtils.getGroupWithType(t,TargetGroup.GROUP_TYPE);
      String groupStr = String.valueOf(tg == null ? -1 : groups.indexOf(tg));
      p.println(tio.getOutString(new String[] {descStr,seqStr,typeStr,varStr,groupStr}));
    }
    p.println(TITLE_DESCRIPTOR + LISTEND);

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

    //Print the tag libraries - name;mode;allowSequence;allowcomplement;
    p.println(TITLE_DESCRIPTOR + LIBRARIES);

    //Check for a spacer
    TagLibrary[] libraries = proj.getTagSettings().getTagLibraries();
    for (int i = 0, t = 0; i < libraries.length; i++, t++) {
      TagLibrary l = libraries[t];
      p.println(tio.getOutString(new String[] {l.getName(),
          String.valueOf(l.getMode()),
          String.valueOf(true),
          String.valueOf(true)}));
    }

    p.println(TITLE_DESCRIPTOR + LISTEND);

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

      byte type = Byte.parseByte(substrings[2]);

      if (targetBuilder == null) throw new UnsupportedOperationException("Can't read target data if target builder not set"); //$NON-NLS-1$

      //Create and set acid type of target
      ProbeMakerTarget t = targetBuilder.buildObject(m);
      if (t instanceof ChangeableNucleotideSequence)
        ((ChangeableNucleotideSequence) t).setType(type);

      //Get the variant number, or -1 if none
      int varno;
      if (substrings[3].length() == 0)
        varno = -1;
      else
        varno = Integer.parseInt(substrings[3]);

      //Set variant
      if (varno > -1) {
        VariantTarget vt = (VariantTarget) t;
        vt.setVariant(vt.getVariants()[varno]);
      }

      //Set the target group
      int grpno = Integer.parseInt(substrings[4]);
      if (grpno > -1) {
        groups.get(Integer.parseInt(substrings[4])).addMember(t);
      }
      proj.getTargets().addSequence(t);
    }

    increaseProgress();
    setStatus("Reading tags",0);           //$NON-NLS-1$

    //Find the libraries line and create the tag libraries
    searchTitle(r, LIBRARIES);
    List<TagLibrary> libs = new ArrayList<TagLibrary>();
    String libString;
    while (!(libString = r.readLine()).startsWith(String.valueOf(TITLE_DESCRIPTOR))) {

      String[] substrings = tio.getInStrings(libString);
      if (substrings.length != 4)
        throw new UnsupportedOperationException("Error parsing tag library line: " + libString); //$NON-NLS-1$
      TagLibrary l = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(), substrings[0]);
      l.setMode(Byte.parseByte(substrings[1]));
      libs.add(l);
    }
    TagLibrary[] libraries = new TagLibrary[libs.size()];
    for (int l = 0; l < libraries.length; l++) {
      libraries[l] = libs.get(l);
    }

    //Find the library line and read all tags for each library
    for (int l = 0; l < libraries.length; l++) {
      searchTitle(r, LIBRARY);
      String tagString;
      while (! (tagString = r.readLine()).startsWith(String.valueOf(
          TITLE_DESCRIPTOR))) {

        String[] substrings = tio.getInStrings(tagString);
        if (substrings.length != 3)
          throw new UnsupportedOperationException("Error parsing tag line: " + tagString); //$NON-NLS-1$

        NucleotideSequence t = new SimpleNucleotideSequence(
            substrings[0],
            substrings[1],
            Byte.parseByte(substrings[2]));
        libraries[l].addSequence(t);
      }
    }

    //Set the project tag libraries
    int[] order = new int[libraries.length];
    for (int i = 0;i<order.length;i++) order[i] = i;
    proj.setTagSettings(new DefaultTagSettings(libraries,order));

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

    //Read and create all probe groups
    searchTitle(r, PROBE_GROUPS);
    List<ProbeGroup> p_groups = new ArrayList<ProbeGroup>();
    String groupString;
    int tgIndex = 0;
    while (! (groupString = r.readLine()).startsWith(String.valueOf(
        TITLE_DESCRIPTOR))) {
      String[] substrings = tio.getInStrings(groupString);
      if (substrings.length != 3)
        throw new UnsupportedOperationException("Error parsing probe group line: " + groupString); //$NON-NLS-1$

      tgIndex++;
      int pgindex = Integer.parseInt(substrings[0]);
      int libindex = Integer.parseInt(substrings[1]);
      int tagindex = Integer.parseInt(substrings[2]);
      if (pgindex >= 0) {
        ProbeGroup pg = new ProbeGroup(groups.get(pgindex),String.valueOf(pgindex+1));
        if (libindex >= 0)
          proj.getTagAllocationTable().setGroupTagID(pg, libraries[libindex].getSequenceAt(tagindex));
        p_groups.add(pg);
      }
      else {
        ProbeGroup pg = new ProbeGroup(null,"DUMMY"); //$NON-NLS-1$
        p_groups.add(pg);
      }
    }

    //Read and create all probes
    //description;ID;type;upStream;downStream;target;group number;quality;struct;messCount1;messCount2;messCount3;messCount4;5'seq;3'seq;tag 1 lib;tag 1 pos;...;...;tag n lib;tag n pos;
    searchTitle(r, PROBES);
    String probeString;
    while (! (probeString = r.readLine()).startsWith(String.valueOf(
        TITLE_DESCRIPTOR))) {

      String[] substrings = tio.getInStrings(probeString);

      byte type = Byte.parseByte(substrings[2]);

      int target_no = Integer.parseInt(substrings[5]);
      ProbeMakerTarget pt = null;
      if (target_no >= 0) {
        pt = proj.getTargets().getSequenceAt(target_no);
      }

      int gr_no = Integer.parseInt(substrings[6]);

      int messageCount5 = Integer.parseInt(substrings[8]);
      int messageCount3 = Integer.parseInt(substrings[9]);
      int messageCountTSS = Integer.parseInt(substrings[10]);
      int messageCountProbe = Integer.parseInt(substrings[11]);

      PropertyAcceptorNucleotideSequence tss5 = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(
          "5' TSS", substrings[12], type),pt == null ? "" : pt.getID()); //$NON-NLS-1$ //$NON-NLS-2$
      ProbeMakerPropertyUtils.setHybridizationTemp(tss5,Float.parseFloat(substrings[13]));

      PropertyAcceptorNucleotideSequence tss3 = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(
          "3' TSS", substrings[14], type),pt == null ? "" : pt.getID()); //$NON-NLS-1$ //$NON-NLS-2$
      ProbeMakerPropertyUtils.setHybridizationTemp(tss3,Float.parseFloat(substrings[15]));

      Probe p = new DefaultProbe(ProbeMakerSequenceFactory.createTSSPair(tss5, tss3, pt),Integer.parseInt(substrings[3]),Integer.parseInt(substrings[4]),type);
      p.setName(substrings[0]);
      p.setID(substrings[1]);
View Full Code Here

   * padlock probes and gap-fill probes*/
  public boolean checkTemplatingByTarget(Probe p) {
    boolean found = false;
    //Check that target is template in correct position only
    //Can't check ligation on target if no target!
    ProbeMakerTarget t = (ProbeMakerTarget) p.getTarget();   
    if (t != null) {
      boolean correct = false;
      int[] results = isLigationTemplate(t, p, false, true);
      if (results != null) {
        for (int i = 0; i < results.length; i++) {         
View Full Code Here

    proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
    proj.getSettings().addDesignerProperties(DefaultProbeDesigner.defaultParameters);
    proj.getSettings().addDesignerProperties(DefaultTSSConstructor.defaultParameters);
   
    ProbeMakerTarget pt1 = new AlleleSpecificPadlockTarget("T1","CCCCCCCCCCCCCCCCCCCC|AAAAAAAAAAAAAAAAAAAAAAAAA","Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    proj.getTargets().addSequence(pt1);
   
    pm.setProject(proj);
  }
View Full Code Here

  }
 
  @Override
  protected void setUp() throws DuplicateIDException {
    pm = new ProbeMakerPlugIn();
    ProbeMakerTarget t1 = new AlleleSpecificPadlockTarget("T1","ACTACGAGCGACGAGC|ACACGCTACATCGAGC","Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    VariantTarget t2 = new MinisequencingTarget("T2","ACTACGAGCGACGAGCSACACGCTACATCGAGC","Target 2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    t2.setVariant(t2.getVariants()[0]);
    ProbeMakerTarget t3 = new UnchangedTarget("T3","ACGTCAGCGAGCGACGACTACTACGAC","Target 3"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    project = new Project("IOTest"); //$NON-NLS-1$
    pm.setProject(project);
    project.getTargets().addSequence(t1);
    project.getTargets().addSequence(t2);
    project.getTargets().addSequence(t3);
View Full Code Here

    int tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
      if (aborted()) break;
      logger.info("Designing TSSs for target " + (tindex+1)); //$NON-NLS-1$*/
      //Get the target
      ProbeMakerTarget target = ti.next();
      //Create a TSS pair
      try {
        pairs[tindex] = td.designTSSPair(target);
      }
      catch (Exception ex) {
        log.printLine("A problem occurred"); //$NON-NLS-1$
        log.printError(ex.getMessage());
        handler.handleError(ex.toString(),ex);       
      }
      tindex++;
    }
   
    fireStatusChange(0,"Creating probes"); //$NON-NLS-1$
   
    //Make new probes and store in a separate list
    ListSequenceDB<Probe> newProbes = new ListSequenceDB<Probe>();
    tindex = 0;
    for (Iterator<ProbeMakerTarget> ti = targets.iterator(); ti.hasNext(); ) {
     
      if (aborted()) return false;       
     
      //Get the target
      ProbeMakerTarget target = ti.next();
      try {
       
        //Create a new probe for the target, with the specified TSS
        logger.info("Creating probe for " + target.getID()); //$NON-NLS-1$
        byte probeAcidType = Byte.parseByte(parameters.get(PROP_PROBE_ACID_TYPE));
        int up = Integer.parseInt(parameters.get(PROP_UPSTREAM_BLOCKS));
        int down = Integer.parseInt(parameters.get(PROP_DOWNSTREAM_BLOCKS));
        Probe p = ProbeMakerSequenceFactory.createProbeSkeleton(pairs[tindex],probeAcidType,up,down,probes);        
       
View Full Code Here

  public void testTemplatingByTarget() {
   
    TSSConstructor con = new DefaultTSSConstructor();
    DefaultTSSPairDesigner tpd = new DefaultTSSPairDesigner(con);
 
    ProbeMakerTarget target = new PadlockTarget("T1","ATACAGTCGTCCGGGTCGAA|AAGAGCATCGACGCGGATCAAGCCTATCGTCACGCGA","Target 1");
    TSSPair pair = tpd.designTSSPair(target);
   
    Probe p = new DefaultProbe(pair,0,0,NucleotideSequence.DNA);
 
    plc.checkTemplatingByTarget(p);
View Full Code Here

    proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
    proj.getSettings().addDesignerProperties(DefaultProbeDesigner.defaultParameters);
    proj.getSettings().addDesignerProperties(DefaultTSSConstructor.defaultParameters);
   
    ProbeMakerTarget pt1 = new AlleleSpecificPadlockTarget("T1","CCCCCCCCCCCCCCCCCCCC|AAAAAAAAAAAAAAAAAAAAAAAAA","Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    proj.getTargets().addSequence(pt1);
   
    pm.setProject(proj);
  }
View Full Code Here

TOP

Related Classes of org.moltools.apps.probemaker.seq.ProbeMakerTarget

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.