Package org.moltools.apps.probemaker.design

Examples of org.moltools.apps.probemaker.design.TagLibrary


          File libFile = new File(libFileName);
          if (!libFile.getAbsolutePath().equals(libFile.getPath())) {
            libFile = new File(settingsFile.getAbsoluteFile().getParentFile(),libFile.getPath());
          }
          DefiniteSequenceDB<NucleotideSequence> tagseqs = SequenceIO.readSequenceDB(new FileReader(libFile), new FastaDBFormat<NucleotideSequence>(), null, ListSequenceDB.getDefaultBuilder(),new SimpleDNASequenceBuilder());
          TagLibrary lib = new DefaultTagLibrary(tagseqs,"taglib"+ti); //$NON-NLS-1$
          lib.setMode(mode);
          libs.add(lib);
          ti++;
        }
        TagLibrary[] libraries = libs.toArray(new TagLibrary[libs.size()]);
        int[] order = new int[libraries.length];
View Full Code Here


        throw new IllegalArgumentException("Invalid spacer position"); //$NON-NLS-1$
      }
      spacerPosition = spacerPos;

      //Create and set up a spacer library
      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.
View Full Code Here

          File libFile = new File(libFileName);
          if (!libFile.getAbsolutePath().equals(libFile.getPath())) {
            libFile = new File(settingsFile.getAbsoluteFile().getParentFile(),libFile.getPath());
          }
          DefiniteSequenceDB<NucleotideSequence> tagseqs = SequenceIO.readSequenceDB(new FileReader(libFile), new FastaDBFormat<NucleotideSequence>(), null, ListSequenceDB.getDefaultBuilder(),new SimpleDNASequenceBuilder());
          TagLibrary lib = new DefaultTagLibrary(tagseqs,"taglib"+ti); //$NON-NLS-1$
          lib.setMode(mode);
          libs.add(lib);
          ti++;
        }
        TagLibrary[] libraries = libs.toArray(new TagLibrary[libs.size()]);
        int[] order = new int[libraries.length];
View Full Code Here

    tags1.addSequence(new SimpleNucleotideSequence("ZIP|1","ACTAGCACGGACGAC")); //$NON-NLS-1$ //$NON-NLS-2$
    tags1.addSequence(new SimpleNucleotideSequence("ZIP|2","ACTAGCACGGACGAC")); //$NON-NLS-1$ //$NON-NLS-2$
    tags1.addSequence(new SimpleNucleotideSequence("ZIP|3","ACTAGCACGGACGAC")); //$NON-NLS-1$ //$NON-NLS-2$
    tags2.addSequence(new SimpleNucleotideSequence("PRIMER|1","ACTAGCACGGACGAC")); //$NON-NLS-1$ //$NON-NLS-2$
    project.getSettings().getDesignParameters().put("UPSTREAM_BLOCKS","1"); //$NON-NLS-1$ //$NON-NLS-2$
    TagLibrary lib1 = new DefaultTagLibrary(tags1,"Lib 1"); //$NON-NLS-1$
    TagLibrary lib2 = new DefaultTagLibrary(tags2,"Lib 2"); //$NON-NLS-1$
    lib1.setMode(TagLibrary.USE_UNIQUE_TAG);
    lib2.setMode(TagLibrary.USE_SAME_TAG);
    project.setTagSettings(new DefaultTagSettings(new TagLibrary[] { lib1, lib2 }));
  }
View Full Code Here

    pm.getProject().getTargets().addSequence(t1);
   
    ListSequenceDB<NucleotideSequence> db = new ListSequenceDB<NucleotideSequence>();
    db.addSequence(new SimpleNucleotideSequence("Tag 1","AAAAAAAAAA")); //$NON-NLS-1$ //$NON-NLS-2$
    db.addSequence(new SimpleNucleotideSequence("Tag 2","TTTTTTTTTT")); //$NON-NLS-1$ //$NON-NLS-2$
    TagLibrary tl = new DefaultTagLibrary(db,"Unique"); //$NON-NLS-1$
    tl.setMode(TagLibrary.USE_UNIQUE_TAG);
   
    pm.getProject().setTagSettings(new DefaultTagSettings(new TagLibrary[] {tl}));
   
    //Design
    ProbeDesigner pd = new DefaultProbeDesigner(new PairwiseTagAllocator());
    pm.getProbeDesignTask(false, false, null, new DefaultNamingScheme(), new AllAcceptor(),new NoSelector(), pd, new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
       
//  Store to project file
    File f = new File("temp.pmp"); //$NON-NLS-1$
    f.deleteOnExit();
    new ProjectXMLIOTask(pm,null,new FileWriter(f)).run();
   
    //Read project
    new ProjectXMLIOTask(pm,null,new FileReader(f)).run();
   
    //Add new target
    pm.getProject().getTargets().clear();
    pm.getProject().getTargets().addSequence(t2);
   
//  Design with append       
    pm.getProbeDesignTask(true, false, null, new DefaultNamingScheme(), new AllAcceptor(), new NoSelector(), pd, new DefaultTSSPairDesigner(new DefaultTSSConstructor()), new StreamErrorHandler(System.out,true)).run();
   
        
//  Store to project file
    f = new File("temp2.pmp"); //$NON-NLS-1$
    f.deleteOnExit();
    new ProjectXMLIOTask(pm,eh,new FileWriter(f)).run();
   
    //Read project
    new ProjectXMLIOTask(pm,eh,new FileReader(f)).run();
      
    pm.getProject().getTargets().clear();
    pm.getProject().getTargets().addSequence(t1);
    pm.getProject().getTargets().addSequence(t2);
   
    db = new ListSequenceDB<NucleotideSequence>();
    db.addSequence(new SimpleNucleotideSequence("Tag 1","AAAAAAAAAA")); //$NON-NLS-1$ //$NON-NLS-2$
    db.addSequence(new SimpleNucleotideSequence("Tag 2","TTTTTTTTTT")); //$NON-NLS-1$ //$NON-NLS-2$
    db.addSequence(new SimpleNucleotideSequence("Tag 3","AAAAAAAAAA")); //$NON-NLS-1$ //$NON-NLS-2$
    db.addSequence(new SimpleNucleotideSequence("Tag 4","TTTTTTTTTT")); //$NON-NLS-1$ //$NON-NLS-2$
    tl = new DefaultTagLibrary(db,"Unique"); //$NON-NLS-1$
    tl.setMode(TagLibrary.USE_PER_GROUP);
   
    pm.getProject().setTagSettings(new DefaultTagSettings(new TagLibrary[] {tl, tl}));
   
//  Design
    pm.getProbeDesignTask(false, true, null, new DefaultNamingScheme(), new AllAcceptor(), new NoSelector(), pd, new DefaultTSSPairDesigner(new DefaultTSSConstructor()), eh).run();   
View Full Code Here

              SwingUIMessages.getString("Common.TITLE_IO_ERROR"), //$NON-NLS-1$
              JOptionPane.ERROR_MESSAGE);
          return;
        }
        //Add a label with the taglibrary to the available list
        TagLibrary temptl = new DefaultTagLibrary(temp, tagFiles[i].getName());
        availableModel.addElement(new LibraryLabel(temptl));
      }
    }
  }
View Full Code Here

    }

    public Component getListCellRendererComponent(JList list, Object value,
                                                  int index, boolean isSelected,
                                                  boolean cellHasFocus) {
      TagLibrary lib = ( (LibraryLabel) value).getLibrary();
      setText(lib.getName());
      setToolTipText(lib.size() + (lib.size() == 1 ? SwingUIMessages.getString("TagPanel.LIBRARY_SIZE_SINGLE") : SwingUIMessages.getString("TagPanel.LIBRARY_SIZE_ZERO_OR_MULTIPLE"))); //$NON-NLS-1$ //$NON-NLS-2$
      setBackground(isSelected ? Color.blue : Color.white);
      setForeground(isSelected ? Color.white : Color.black);

      return this;
    }
View Full Code Here

    t1.setVariant(t1.getVariants()[0]);
    t2.setVariant(t2.getVariants()[0]);


    //Make tag library with ten tags
    TagLibrary tags10 = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(),"Tag library 10"); //$NON-NLS-1$
    tags10.setMode(TagLibrary.USE_UNIQUE_TAG);
    for (int i = 1;i <= 10;i++) {
      tags10.addSequence(new SimpleNucleotideSequence("Tag" + i,"AAAAAAAAAAAAAAAAAAAA", NucleotideSequence.DNA)); //$NON-NLS-1$ //$NON-NLS-2$
    }   

    //Make tag library with one tag
    TagLibrary tags1 = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(),"Tag library 1"); //$NON-NLS-1$
    tags1.setMode(TagLibrary.USE_UNIQUE_TAG);
    tags1.addSequence(new SimpleNucleotideSequence("Tag1","AAAAAAAAAAAAAAAAAAAA", NucleotideSequence.DNA)); //$NON-NLS-1$ //$NON-NLS-2$

    TagLibrary tags1b = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(),"Tag library 1b"); //$NON-NLS-1$
    tags1b.setMode(TagLibrary.USE_UNIQUE_TAG);
    tags1b.addSequence(new SimpleNucleotideSequence("Tag1b","AAAAAAAAAAAAAAAAAAAA", NucleotideSequence.DNA)); //$NON-NLS-1$ //$NON-NLS-2$

    libraries1_10 = new TagLibrary[] { tags10 };
    libraries1_1 = new TagLibrary[] { tags1 };
    libraries2_1_1 = new TagLibrary[] { tags1, tags1b };
View Full Code Here

    proj.getTargets().addSequence(t1);
    proj.getTargets().addSequence(t2);
    TargetHandler.expandTargets(pm.getProject().getTargets());
    pm.setProject(proj);
  
    TagLibrary lib = libraries1_10[0];

    Probe[] probes = performModeTest(TagLibrary.USE_ANY_TAG);

    assertEquals(lib.getSequenceAt(0),probes[0].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[1].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[2].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[3].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[4].getTagAt(0));

    probes = performModeTest(TagLibrary.USE_UNIQUE_TAG);

    assertEquals(lib.getSequenceAt(0),probes[0].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[1].getTagAt(0));
    assertEquals(lib.getSequenceAt(2),probes[2].getTagAt(0));
    assertEquals(lib.getSequenceAt(3),probes[3].getTagAt(0));
    assertEquals(lib.getSequenceAt(4),probes[4].getTagAt(0));
   
    probes = performModeTest(TagLibrary.USE_PER_GROUP);

    assertEquals(lib.getSequenceAt(0),probes[0].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[1].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[2].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[3].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[4].getTagAt(0));

    probes = performModeTest(TagLibrary.USE_SAME_TAG);

    assertEquals(lib.getSequenceAt(0),probes[0].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[1].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[2].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[3].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[4].getTagAt(0));
   
    probes = performModeTest(TagLibrary.USE_UNIQUE_IN_GROUP);

    assertEquals(lib.getSequenceAt(0),probes[0].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[1].getTagAt(0));
    assertEquals(lib.getSequenceAt(0),probes[2].getTagAt(0));
    assertEquals(lib.getSequenceAt(1),probes[3].getTagAt(0));
    assertEquals(lib.getSequenceAt(2),probes[4].getTagAt(0));   
  
  }
View Full Code Here

public class TagLibraryViewFactory
    implements HTMLRenderer {

  public String renderHTML(Object obj) {
    TagLibrary library;
    if (obj instanceof TagLibrary) {
      library = (TagLibrary) obj;
    }
    else {
      throw new IllegalArgumentException("Expected tag library, got " + //$NON-NLS-1$
                                         obj.getClass());
    }

    StringBuffer html = new StringBuffer();

    for (Iterator<NucleotideSequence> i = library.iterator(); i.hasNext(); ) {
      NucleotideSequence t = i.next();
      HTMLWriter.appendEnclosed(html,t.getID(),HTMLWriter.B);
      html.append("<br>\n"); //$NON-NLS-1$
      html.append("<tt>" + SequenceHTMLRenderer.getHardWrappedString(t.seqString(),60) + "</tt><br>\n"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

TOP

Related Classes of org.moltools.apps.probemaker.design.TagLibrary

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.