Package org.moltools.lib.seq.impl

Examples of org.moltools.lib.seq.impl.SimpleNucleotideSequence


    //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


    pm.setProject(new Project("test project")); //$NON-NLS-1$
    pm.getProject().getSettings().addCandidateModuleStage1(tom);
    pm.getProject().getTargets().addSequence(t1);
    pm.getProject().getTargets().addSequence(t2);
    pm.getProject().getTagAllocationTable().clearUsed();
    lib1.addSequence(new SimpleNucleotideSequence("TAG_A","AAAAAAAAAAAAA")); //$NON-NLS-1$ //$NON-NLS-2$
    lib1.addSequence(new SimpleNucleotideSequence("TAG_T","TTTTTTTTTTTTT")); //$NON-NLS-1$ //$NON-NLS-2$
    lib1.setMode(TagLibrary.USE_UNIQUE_TAG);
    pm.getProject().setTagSettings(new DefaultTagSettings(new TagLibrary[] {lib1}));

    pm.getProbeDesignTask(false,true, false,new GoodFairAcceptor(),new NoSelector(),pd,new DefaultTSSConstructor(),null).run();
View Full Code Here

            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());
            }
            spacer = new SimpleNucleotideSequence("Spacer " + temp, temp, p.getType()); //$NON-NLS-1$
          }
          else {
            //Create a new spacer lib for the spacer position and get the first tag
            taglibraries[spacerPosition] = new SpacerLibrary(spacerLength,
                p.getType());
View Full Code Here

        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]);
      if (gr_no >= 0)
        DesignUtils.addGroup(p, p_groups.get(gr_no));

      ProbeMakerPropertyUtils.setRank(p,Byte.parseByte(substrings[7]));

      //Read tags from substring 16;
      int t = 0;
      for (int i = 16; i < substrings.length; i+=2, t++) {
        String l_str = substrings[i];
        String t_str = substrings[i+1];
        if (l_str.startsWith("Spacer")) { //$NON-NLS-1$
          NucleotideSequence tag = new SimpleNucleotideSequence("Spacer " + t_str, t_str, p.getType()); //$NON-NLS-1$
          p.addTagAt(tag,t);
        }
        else {
          int lib_no = Integer.parseInt(l_str);
          int tag_no = Integer.parseInt(t_str);
View Full Code Here

      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

        }
        else {
          //Tags not allocated, test arms only (connected in ligation point)
          try {           
            String seqString = other.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME).seqString() + other.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME).seqString();         
            if (isLigationTemplate(new SimpleNucleotideSequence("Arms of " + other.getName(), seqString, //$NON-NLS-1$
                other.getType()), p, false, false) != null) {
              ProbeMakerPropertyUtils.addMessage(p.getTSSPair(),new Message("May be templated by " + //$NON-NLS-1$
                  other.getName(),
                  OTHER_PROBE_IS_TEMPLATE,
                  Message.ERROR));
View Full Code Here

          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

   
    t1 = new AlleleSpecificPadlockTarget("T1","CCCCCCCCCCCCCCCCCCCCCCCCC|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","Target 1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   
    tags = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(),"Tag library 10"); //$NON-NLS-1$
    tags.setMode(TagLibrary.USE_UNIQUE_TAG);
    tags.addSequence(new SimpleNucleotideSequence("Tag1","GAAAAAAAAAAAAAAAAAAT", NucleotideSequence.DNA)); //$NON-NLS-1$ //$NON-NLS-2$
   
    proj = new Project("Test project"); //$NON-NLS-1$
    proj.getSettings().addDesignerProperties(GreedyTagAllocator.defaultParameters);
    pm.setProject(proj);
  }
View Full Code Here

    project.getTargets().addSequence(t1);
    project.getTargets().addSequence(t2);
    project.getTargets().addSequence(t3);
    ListSequenceDB<NucleotideSequence> tags1 = new ListSequenceDB<NucleotideSequence>();
    ListSequenceDB<NucleotideSequence> tags2 = new ListSequenceDB<NucleotideSequence>();
    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);
View Full Code Here

    //Add one target
    pm.getProject().getTargets().clear();
    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}));
   
View Full Code Here

TOP

Related Classes of org.moltools.lib.seq.impl.SimpleNucleotideSequence

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.