/** * A method that finds all genes in a dna strand strarting with ATG coden and ending with TAG, TGA * or TAA coden. * * @param dna The dna strand to search for genes. * @return all found genes in StorageResource datatype. */ public StorageResource storeAll(String dna) { StorageResource sr = new StorageResource(); int start = 0; int stop = 0; int loc = 0; String dna1 = dna.toUpperCase(); // System.out.println(dna1); while (true) { loc = dna1.indexOf("ATG", start); if (loc == -1) break; int sloc = stopIndex(dna1, loc + 3); if (sloc > dna.length()) { // continue; // System.out.println(""); } else { sr.add(dna.substring(loc, sloc)); // System.out.println(dna.substring(loc,sloc)); loc = sloc - 3; } // System.out.println(loc); start = loc + 3; } return sr; }