-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmotifCounter.java
More file actions
40 lines (33 loc) · 1.25 KB
/
motifCounter.java
File metadata and controls
40 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package biomarker1;
/*
* Process for microsatellite count on a given slide window
*/
import java.util.ArrayList;
public class motifCounter {
ArrayList seqs;
ArrayList names;
motifCounter(ArrayList seqs, ArrayList names) {
this.seqs = seqs;
this.names = names;
}
public String find(String motif) {
String sTextoBuscado = motif;
int contador = 0;
int numSeqTurno = 0;
String S = "";
for (Object seq : seqs) {
contador = 0;
String SeqTurno = (String) seq;
String sTexto = SeqTurno;
while (sTexto.contains(sTextoBuscado)) {
sTexto = sTexto.substring(sTexto.indexOf(sTextoBuscado) + 1);
contador++; //increment the counter while the window containes the microsatellite
}
System.out.println("For sequence " + names.get(numSeqTurno) + " And subsequence " + sTextoBuscado + " hit count: " + contador);
S = S + " \n For sequence " + names.get(numSeqTurno) + " And subsequence " + sTextoBuscado + " hit count: " + contador + "\n";
numSeqTurno++;
}
S = S + "--------------------------\n ";
return S;
}
}