-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermutation.java
More file actions
42 lines (35 loc) · 1.17 KB
/
Permutation.java
File metadata and controls
42 lines (35 loc) · 1.17 KB
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
/*
* Peter Edge
* CSCI 5481 Final Project
*
* This file contains the Permutation class.
* It is used while forming the burrow-wheeler transform
* to hold a single BWT matrix permutation.
* The main purpose of this class is twofold:
*
* 1. need to hold the sequence of the permutation
* 2. need to hold on to the original index from before sequence is lexically sorted
*
* This is bc java has no convenient way to get the indeces of a sort operation, as MATLAB does.
*/
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.util.ArrayList;
import java.lang.StringBuilder;
// needs to implement Comparable so that it can be sorted in BWT
public class Permutation implements Comparable<Permutation>{
// fasta header of the original short read
String sequence;
Integer index; // will be sorted, need to hold onto original index
Permutation(){};
Permutation(String s, Integer i){
sequence = s;
index = i;
}
// permutations need to be sorted
@Override
public int compareTo(Permutation other){
return this.sequence.compareTo(other.sequence);
}
}