-
Notifications
You must be signed in to change notification settings - Fork 71
/
AssemblyEvidenceSupport.java
100 lines (87 loc) · 3.09 KB
/
AssemblyEvidenceSupport.java
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package au.edu.wehi.idsv;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
public class AssemblyEvidenceSupport {
public enum SupportType {
Read(0),
ReadPair(1);
private final int value;
SupportType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static SupportType value(int i) {
for (SupportType st : SupportType.values()) {
if (st.getValue() == i) {
return st;
}
}
throw new IllegalArgumentException("Invalid value");
}
}
private final SupportType supportType;
private final Range<Integer> assemblyContigOffset;
private final String evidenceID;
private final String fragmentID;
private final int category;
private final float qual;
public SupportType getSupportType() {
return supportType;
}
public Range<Integer> getAssemblyContigOffset() {
return assemblyContigOffset;
}
public String getEvidenceID() {
return evidenceID;
}
public String getFragmentID() {
return fragmentID;
}
public int getCategory() {
return category;
}
public AssemblyEvidenceSupport adjustForAssemblyTruncation(int startBasesTruncated) {
return new AssemblyEvidenceSupport(
supportType,
Range.closed(assemblyContigOffset.lowerEndpoint() - startBasesTruncated, assemblyContigOffset.upperEndpoint() - startBasesTruncated),
evidenceID,
fragmentID,
category,
qual);
}
public float getQual() {
return qual;
}
public AssemblyEvidenceSupport(
SupportType supportType,
Range<Integer> assemblyContigOffset,
String evidenceID,
String fragmentID,
int category,
float qual) {
this.supportType = supportType;
this.assemblyContigOffset = assemblyContigOffset;
this.evidenceID = evidenceID;
this.fragmentID = fragmentID;
this.category = category;
this.qual = qual;
}
public AssemblyEvidenceSupport(DirectedEvidence e, Range<Integer> supportInterval) {
this(e instanceof NonReferenceReadPair ? SupportType.ReadPair : SupportType.Read,
supportInterval,
e.getEvidenceID(),
e.getOriginatingFragmentID(((SAMEvidenceSource)(e.getEvidenceSource())).getSourceCategory()).iterator().next(),
((SAMEvidenceSource)(e.getEvidenceSource())).getSourceCategory(),
e.getBreakendQual());
}
public static Ordering<AssemblyEvidenceSupport> ByEvidenceID = new Ordering<AssemblyEvidenceSupport>() {
public int compare(AssemblyEvidenceSupport arg1, AssemblyEvidenceSupport arg2) {
return ComparisonChain.start()
.compare(arg1.evidenceID, arg2.evidenceID)
.result();
}
};
}