/** * First step of overhang assignment - enforce numeric place holders for overhangs, ie no overhang * redundancy in any step * */ private void assignBioBricksOverhangs( ArrayList<RGraph> optimalGraphs, HashMap<Integer, Vector> stageVectors) { // Initialize fields that record information to save complexity for future steps _rootBasicNodeHash = new HashMap<RNode, ArrayList<RNode>>(); HashMap<Integer, RVector> stageRVectors = new HashMap<Integer, RVector>(); for (Integer stage : stageVectors.keySet()) { RVector vec = ClothoReader.vectorImportClotho(stageVectors.get(stage)); stageRVectors.put(stage, vec); } // If the stageVector hash is empty, make a new default vector if (stageRVectors.size() == 1) { if (stageRVectors.get(1) == null) { stageRVectors.put(0, new RVector("EX", "SP", -1, "pSK1A2", null)); } } // Loop through each optimal graph and grab the root node to prime for the traversal for (RGraph graph : optimalGraphs) { RNode root = graph.getRootNode(); RVector vector = stageRVectors.get(root.getStage() % stageRVectors.size()); RVector rootVector = new RVector("EX", "SP", -1, vector.getName(), null); root.setVector(rootVector); root.setLOverhang("EX"); root.setROverhang("SP"); ArrayList<RNode> l0nodes = new ArrayList<RNode>(); _rootBasicNodeHash.put(root, l0nodes); ArrayList<RNode> neighbors = root.getNeighbors(); assignBioBricksOverhangsHelper(root, neighbors, root, stageRVectors); } // Determine which nodes impact which level to form the stageDirectionAssignHash for (RGraph graph : optimalGraphs) { RNode root = graph.getRootNode(); ArrayList<String> rootDir = new ArrayList<String>(); ArrayList<String> direction = root.getDirection(); rootDir.addAll(direction); ArrayList<RNode> l0Nodes = _rootBasicNodeHash.get(root); // Determine which levels each basic node impacts for (int i = 0; i < l0Nodes.size(); i++) { // Determine direction of basic level 0 nodes RNode l0Node = l0Nodes.get(i); String l0Direction = rootDir.get(0); if (l0Node.getComposition().size() == 1) { ArrayList<String> l0Dir = new ArrayList<String>(); l0Dir.add(l0Direction); l0Node.setDirection(l0Dir); } int size = l0Node.getDirection().size(); rootDir.subList(0, size).clear(); } } }
/** Generation of new BioBricks primers for parts * */ public static String[] generateVectorPrimers( RVector vector, Collector coll, Double meltingTemp, Integer targetLength, Integer maxPrimerLength, Integer minPCRLength) { // initialize primer parameters String[] oligos = new String[2]; String vectorPrimerPrefix = "gaattcgcggccgcttctagag"; String vectorPrimerSuffix = "tactagtagcggccgctgcag"; Vector currentVector = coll.getVector(vector.getUUID(), true); String seq = currentVector.getSeq(); String fwdHomology; String revHomology; if (seq.equals("")) { fwdHomology = "[ VECTOR " + currentVector.getName() + " HOMOLOGY REGION ]"; revHomology = "[ VECTOR " + currentVector.getName() + " HOMOLOGY REGION ]"; } else { fwdHomology = seq.substring( 0, Math.min( seq.length(), PrimerDesign.getPrimerHomologyLength( meltingTemp, targetLength, maxPrimerLength - 23, minPCRLength, seq, true))); revHomology = PrimerDesign.reverseComplement( currentVector .getSeq() .substring( Math.max( 0, seq.length() - PrimerDesign.getPrimerHomologyLength( meltingTemp, targetLength, maxPrimerLength - 22, minPCRLength, PrimerDesign.reverseComplement(seq), true)))); } String forwardOligoSequence = vectorPrimerPrefix + fwdHomology; String reverseOligoSequence = PrimerDesign.reverseComplement(vectorPrimerSuffix) + revHomology; oligos[0] = forwardOligoSequence; oligos[1] = reverseOligoSequence; return oligos; }
/** * This helper method executes the loops necessary to enforce overhangs for each graph in * enforceOverhangRules * */ private void assignBioBricksOverhangsHelper( RNode parent, ArrayList<RNode> children, RNode root, HashMap<Integer, RVector> stageRVectors) { // Loop through each one of the children to assign rule-instructed overhangs... enumerated // numbers currently for (int i = 0; i < children.size(); i++) { RNode child = children.get(i); // Give biobricks overhangs RVector vector = stageRVectors.get(child.getStage() % stageRVectors.size()); RVector newVector = new RVector("EX", "SP", -1, vector.getName(), null); child.setVector(newVector); child.setLOverhang("EX"); child.setROverhang("SP"); // Make recursive call if (child.getStage() > 0) { ArrayList<RNode> grandChildren = new ArrayList<RNode>(); grandChildren.addAll(child.getNeighbors()); // Remove the current parent from the list if (grandChildren.contains(parent)) { grandChildren.remove(parent); } assignBioBricksOverhangsHelper(child, grandChildren, root, stageRVectors); // Or record the level zero parts } else { ArrayList<RNode> l0nodes = _rootBasicNodeHash.get(root); l0nodes.add(child); _rootBasicNodeHash.put(root, l0nodes); } } }