forked from AsadRizvi97/snp-identifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChromosome.java
More file actions
34 lines (30 loc) · 1.11 KB
/
Chromosome.java
File metadata and controls
34 lines (30 loc) · 1.11 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
/**
* Created by Bradley Pham on 12/4/2017.
*/
public class Chromosome {
private DeluxeBST<Integer,String[]> tree; //to store position with key is the site and value is nucleotide at that position
private String[] input;//input line
//@argument:
//line: format Chromosome Position Reference SNPs
//numberOfSamples: total number of SNP files being considered
//fileIndex: order of SNP file (first, second, third, etc sample)
public Chromosome(String[] line, int numberOfSamples, int fileIndex) {
tree = new DeluxeBST<>(numberOfSamples);
input = line;
update(line, fileIndex);
}
//print each chromosome with all position.
//Format: -------------------------------
//Position Reference Sample1 Sample2
public void print(int label) {
tree.print(label);
}
//to update chromosome if it already existed
public void update(String[] line, int fileIndex) {
tree.put(Integer.parseInt(line[1]), line, fileIndex);
}
//to take out which chromosome this is
public String identifier() {
return input[0];
}
}