- // The coords in the hashtable that is returned are in relative coords\r
- // i.e. start from 0\r
-\r
- Hashtable blocks = new Hashtable();\r
-\r
- boolean prev = false;\r
- int bstart = -1;\r
-\r
- for (int i = start; i <= end ; i++) {\r
- SequenceI seq = (SequenceI)seqs.elementAt(0);\r
-\r
- char c = seq.getCharAt(i);\r
-\r
- boolean found = true;\r
-\r
- int j = 1;\r
-\r
- while (j < seqs.size() && found == true) {\r
-\r
- SequenceI jseq = (SequenceI)seqs.elementAt(j);\r
-\r
- if (!exc.contains(jseq)) {\r
-\r
- char cc = jseq.getCharAt(i);\r
-\r
- if ( cc != c) {\r
- found = false;\r
- }\r
- }\r
- j++;\r
- }\r
-\r
-\r
- if (prev == false && found == true) {\r
- bstart = i;\r
- } else if (prev == true && found == false && bstart != -1) {\r
-\r
- int blockstart = bstart-start;\r
- int blocklen = i-bstart;\r
-\r
- //System.out.println("Start len " + blockstart + " " + blocklen);\r
-\r
- for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
- blocks.put(new Integer(jj),new Integer(blocklen));\r
- }\r
-\r
- bstart = -1;\r
- }\r
- prev = found;\r
- }\r
-\r
- if (bstart != -1) {\r
-\r
- int blockstart = bstart-start;\r
- int blocklen = end-bstart;\r
-\r
- // System.out.println("Start len " + blockstart + " " + blocklen);\r
-\r
- for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
- blocks.put(new Integer(blockstart),new Integer(blocklen));\r
- }\r
-\r
- }\r
- return blocks;\r
- }\r
-\r
-\r
-\r
- public static Hashtable findKmerCount(SequenceI seq, int start, int end,int window, int step,Vector kmers) {\r
-\r
- int tmpstart = start;\r
- Hashtable vals = new Hashtable();\r
-\r
- while (tmpstart <= end) {\r
-\r
- String tmpstr = seq.getSequence().substring(tmpstart-window/2,tmpstart+window/2);\r
-\r
- int count = 0;\r
-\r
- //System.out.println("Str " + tmpstr);\r
-\r
- for (int ii = 0; ii < kmers.size(); ii++) {\r
- String kmer = ((SequenceI)kmers.elementAt(ii)).getSequence();\r
-\r
- int i = -1;\r
-\r
- while (tmpstr.indexOf(kmer,i) != -1) {\r
- i = tmpstr.indexOf(kmer,i);\r
-\r
- i++;\r
- count++;\r
- }\r
- ii++;\r
- }\r
- vals.put(new Integer(tmpstart),new Integer(count));\r
- tmpstart += step;\r
- }\r
- return vals;\r
- }\r
-\r
- public static Hashtable findBlockStarts(Vector seqs, int start, int end,Vector exc) {\r
-\r
- // start and end are in real (not relative coords);\r
-\r
- // The coords in the hashtable that is returned are in relative coords\r
- // i.e. start from 0\r
-\r
- Hashtable blocks = new Hashtable();\r
-\r
- boolean prev = false;\r
- int bstart = -1;\r
-\r
- for (int i = start; i <= end ; i++) {\r
- SequenceI seq = (SequenceI)seqs.elementAt(0);\r
-\r
- char c = seq.getCharAt(i);\r
-\r
- boolean found = true;\r
-\r
- int j = 1;\r
-\r
- while (j < seqs.size() && found == true) {\r
-\r
- SequenceI jseq = (SequenceI)seqs.elementAt(j);\r
-\r
- if (!exc.contains(jseq)) {\r
-\r
- char cc = jseq.getCharAt(i);\r
-\r
- if ( cc != c) {\r
- found = false;\r
- }\r
- }\r
- j++;\r
- }\r
-\r
-\r
- if (prev == false && found == true) {\r
- bstart = i;\r
- } else if (prev == true && found == false && bstart != -1) {\r
-\r
- int blockstart = bstart-start;\r
- int blocklen = i-bstart;\r
-\r
- // System.out.println("Start len " + blockstart + " " + blocklen);\r
-\r
- //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
- blocks.put(new Integer(blockstart),new Integer(blocklen));\r
- // }\r
-\r
- bstart = -1;\r
- }\r
- prev = found;\r
- }\r
-\r
- if (bstart != -1) {\r
-\r
- int blockstart = bstart-start;\r
- int blocklen = end-bstart;\r