コード例 #1
0
  private int[][][] getFullHashes(Sequence seq, int subKmerSize) {
    int cutoff =
        (int)
            ((long) Integer.MIN_VALUE
                + ((long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) / (long) REDUCTION);

    // compute just direct hash of sequence
    int[] hashes = Utils.computeSequenceHashes(seq.getString(), subKmerSize);

    int count = 0;
    for (int val : hashes) if (val <= cutoff) count++;

    SortableIntPair[] completeHashAsPair = new SortableIntPair[count];
    count = 0;
    for (int iter = 0; iter < hashes.length; iter++)
      if (hashes[iter] <= cutoff) {
        completeHashAsPair[count] = new SortableIntPair(hashes[iter], iter);
        count++;
      }

    // sort the results, sort is in place so no need to look at second
    Arrays.sort(completeHashAsPair);

    return storeAsArray(completeHashAsPair);
  }
コード例 #2
0
 public OrderKmerHashes(Sequence seq, int kmerSize) {
   this.seqLength = seq.length() - kmerSize + 1;
   this.orderedHashes = getFullHashes(seq, kmerSize);
 }