| 10 | import java.io.OutputStream; |
| 11 | |
| 12 | class fasta { |
| 13 | public static final int IM = 139968; |
| 14 | public static final int IA = 3877; |
| 15 | public static final int IC = 29573; |
| 16 | public static int last = 42; |
| 17 | |
| 18 | public static final int LINE_LENGTH = 60; |
| 19 | |
| 20 | // pseudo-random number generator |
| 21 | public static final double random(double max) { |
| 22 | last = (last * IA + IC) % IM; |
| 23 | return max * last / IM; |
| 24 | } |
| 25 | |
| 26 | // Weighted selection from alphabet |
| 27 | public static String ALU = |
| 28 | "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" |
| 29 | + "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" |
| 30 | + "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" |
| 31 | + "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" |
| 32 | + "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" |
| 33 | + "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" |
| 34 | + "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; |
| 35 | public static byte[] ALUB = ALU.getBytes(); |
| 36 | |
| 37 | public static final frequency[] IUB = new frequency[] { |
| 38 | new frequency('a', 0.27), |
| 39 | new frequency('c', 0.12), |
| 40 | new frequency('g', 0.12), |
| 41 | new frequency('t', 0.27), |
| 42 | |
| 43 | new frequency('B', 0.02), |
| 44 | new frequency('D', 0.02), |
| 45 | new frequency('H', 0.02), |
| 46 | new frequency('K', 0.02), |
| 47 | new frequency('M', 0.02), |
| 48 | new frequency('N', 0.02), |
| 49 | new frequency('R', 0.02), |
| 50 | new frequency('S', 0.02), |
| 51 | new frequency('V', 0.02), |
| 52 | new frequency('W', 0.02), |
| 53 | new frequency('Y', 0.02) }; |
| 54 | |
| 55 | public static final frequency[] HomoSapiens = new frequency[] { |
| 56 | new frequency('a', 0.3029549426680d), |
| 57 | new frequency('c', 0.1979883004921d), |
| 58 | new frequency('g', 0.1975473066391d), |
| 59 | new frequency('t', 0.3015094502008d)}; |
| 60 | |
| 61 | public static void makeCumulative(frequency[] a) { |
| 62 | double cp = 0.0; |
| 63 | for (int i = 0; i < a.length; i++) { |
| 64 | cp += a[i].p; |
| 65 | a[i].p = cp; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // naive |
nothing calls this directly
no test coverage detected
searching dependent graphs…