-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab1a.java
More file actions
56 lines (49 loc) · 977 Bytes
/
Copy pathLab1a.java
File metadata and controls
56 lines (49 loc) · 977 Bytes
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package scratch;
import java.util.Random;
class Lab1a
{
public static void main(String[] args)
{
//declare and initilize string to hold each base and string to hold the growing kmer
String three_mer = "";
String base = "";
//triple a tracker
int aaa = 0;
//run 1000 times
for(int x=0; x < 1000; x++)
{
//run three times to make a 3mer
for(int y=0; y < 3; y++)
{
//declare and initilize random between 0 and 3
Random rand = new Random();
float f = rand.nextFloat();
if (f <= 0.12)
{
base = "A";
}
else if ((f > .12) && (f <= .23))
{
base = "T";
}
else if ((f > .23) && (f <= .61))
{
base = "C";
}
else if (f > .61)
{
base = "G";
}
three_mer = three_mer + base;
}
System.out.println(three_mer);
if(three_mer.equals("AAA"))
{
aaa++;
}
three_mer = "";
}
System.out.println("AAA count: ");
System.out.println(aaa);
}
}