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

Method writeFrequencies

benchmark/bench/knucleotide.java:62–85  ·  view source on GitHub ↗
(Map<String, knucleotide> frequencies)

Source from the content-addressed store, hash-verified

60 }
61
62 static String writeFrequencies(Map<String, knucleotide> frequencies) {
63 ArrayList<knucleotide> list = new ArrayList<knucleotide>(frequencies.size());
64 int sum = 0;
65 for (knucleotide fragment : frequencies.values()) {
66 list.add(fragment);
67 sum += fragment.count;
68 }
69
70 Collections.sort(list, new Comparator<knucleotide>() {
71 public int compare(knucleotide o1, knucleotide o2) {
72 int c = o2.count - o1.count;
73 if (c == 0) {
74 c = o1.sequence.compareTo(o2.sequence);
75 }
76 return c;
77 }
78 });
79
80 StringBuilder sb = new StringBuilder();
81 for (knucleotide k : list)
82 sb.append(String.format("%s %.3f\n", k.sequence.toUpperCase(), (float)(k.count) * 100.0f / (double)sum));
83
84 return sb.toString();
85 }
86
87 static String writeCount(List<Future<Map<String, knucleotide>>> futures, String nucleotideFragment) throws Exception {
88 int count = 0;

Callers 1

mainMethod · 0.95

Calls 8

sizeMethod · 0.65
valuesMethod · 0.65
addMethod · 0.65
toStringMethod · 0.65
sortMethod · 0.45
appendMethod · 0.45
formatMethod · 0.45
toUpperCaseMethod · 0.45

Tested by

no test coverage detected