MCPcopy Index your code
hub / github.com/apache/groovy / revcomp

Class revcomp

benchmark/bench/revcomp.java:11–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9import java.io.*;
10
11public final class revcomp {
12
13 static final byte[] map = new byte[128];
14
15 static {
16 String[] mm = {"ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy", "TGVHCDM\nKNSYAAWBRTGVHCDMKNSYAAWBR"};
17 for (int i = 0; i < mm[0].length(); i++)
18 map[mm[0].charAt(i)] = (byte) mm[1].charAt(i);
19 }
20
21 static void reverse(byte[] buf, int begin, int end) {
22 while (true) {
23 byte bb = buf[begin];
24 if (bb == '\n') bb = buf[++begin];
25 byte be = buf[end];
26 if (be == '\n') be = buf[--end];
27 if (begin > end) break;
28 buf[begin++] = map[be];
29 buf[end--] = map[bb];
30 }
31 }
32
33 public static void main(String[] args) throws IOException {
34 final byte[] buf = new byte[System.in.available()];
35 System.in.read(buf);
36
37 for (int i = 0; i < buf.length;) {
38 while (buf[i++] != '\n');
39 int data = i;
40 while (i < buf.length && buf[i++] != '>');
41 reverse(buf, data, i-2);
42 }
43
44 System.out.write(buf);
45 }
46}

Callers

nothing calls this directly

Calls 2

lengthMethod · 0.45
charAtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…