Skip to content

Commit 35a1f9e

Browse files
authored
Merge pull request #340 from AdamaJava/update_htsjdk
Update htsjdk to 4.0.2
2 parents 56d6487 + af2a56e commit 35a1f9e

File tree

62 files changed

+1701
-1840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1701
-1840
lines changed

q3panel/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies {
1313
api 'org.apache.commons:commons-lang3:3.4'
1414
api 'net.sf.trove4j:core:3.1.0'
1515
api 'net.sf.jopt-simple:jopt-simple:4.6'
16-
api 'com.github.samtools:htsjdk:2.24.1'
16+
api 'com.github.samtools:htsjdk:4.0.2'
1717

1818
api group: 'com.io7m.xom',name: 'xom', version: '1.2.10'
1919
}

q3tiledaligner/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies {
99
api project(':qcommon')
1010
api project(':qio')
1111

12-
api 'com.github.samtools:htsjdk:2.24.1'
12+
api 'com.github.samtools:htsjdk:4.0.2'
1313
api 'net.sf.trove4j:core:3.1.0'
1414
api 'org.apache.commons:commons-lang3:3.4'
1515
api 'net.sf.jopt-simple:jopt-simple:4.6'

q3vcftools/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
api project(':qcommon')
1515
api project(':qio')
1616

17-
api 'com.github.samtools:htsjdk:2.24.1'
17+
api 'com.github.samtools:htsjdk:4.0.2'
1818
api 'net.sf.jopt-simple:jopt-simple:4.6'
1919
api 'net.sf.trove4j:core:3.1.0'
2020
api group: 'com.jcraft', name: 'jsch', version: '0.1.54'

qannotate/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
api project(':qio')
3030
api project(':qbamfilter')
3131

32-
api 'com.github.samtools:htsjdk:2.24.1'
32+
api 'com.github.samtools:htsjdk:4.0.2'
3333
api 'net.sf.jopt-simple:jopt-simple:4.6'
3434
api name: 'snpEff', version: '4.0e'
3535
api 'com.fasterxml.jackson.core:jackson-databind:2.6.7'

qbamfilter/src/org/qcmg/qbamfilter/filter/CigarFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class CigarFilter implements SamRecordFilter{
2828
*
2929
*/
3030
public CigarFilter(String operatorName, Comparator comp, String value )throws Exception{
31-
this.value = Integer.valueOf(value);
31+
this.value = Integer.parseInt(value);
3232
op = comp;
3333
if(operatorName.equalsIgnoreCase("M")){operator = CigarOperator.M;}
3434
else if(operatorName.equalsIgnoreCase("I")){operator = CigarOperator.I;}

qbamfilter/src/org/qcmg/qbamfilter/filter/Comparator.java

Lines changed: 107 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public enum Comparator {
2626
/**
2727
* @param v1
2828
* @param v2
29-
* it convert string v1 and v2 into integer when Comparator is GreatEqual, SamallEqual,Great and Small
29+
* it converts string v1 and v2 into integer when Comparator is GreatEqual, SmallEqual,Great and Small
3030
* then do integer comparison for v1 and v2. Otherwise it straightly does String comparison ignoring Case
3131
* for Comparator Equal and NotEqual
3232
* @return true if v1 is GreatEqual than v2 for Comparator GreatEqual;
33-
* @return true if v1 is Great than v2 for Comparator Great;
33+
* @return true if v1 is Greater than v2 for Comparator Great;
3434
* @return true if v1 is SmallEqual than v2 for Comparator SmallEqual;
3535
* @return true if v1 is Small than v2 for Comparator Small;
3636
* @return true if v1 and v2 are same string for Comparator Equal
@@ -44,21 +44,21 @@ public enum Comparator {
4444
*/
4545
public boolean eval(String v1, String v2) {
4646
switch(this){
47-
case GreatEqual: return Integer.valueOf(v1) >= Integer.valueOf(v2);
48-
case SmallEqual: return Integer.valueOf(v1) <= Integer.valueOf(v2);
49-
case Great: return Integer.valueOf(v1) > Integer.valueOf(v2);
50-
case Small: return Integer.valueOf(v1) < Integer.valueOf(v2);
47+
case GreatEqual: return Integer.parseInt(v1) >= Integer.parseInt(v2);
48+
case SmallEqual: return Integer.parseInt(v1) <= Integer.parseInt(v2);
49+
case Great: return Integer.parseInt(v1) > Integer.parseInt(v2);
50+
case Small: return Integer.parseInt(v1) < Integer.parseInt(v2);
5151
case Equal: return v1.equalsIgnoreCase(v2);
52-
case NotEqual: return !(v1.equalsIgnoreCase(v2));
52+
case NotEqual: return ! v1.equalsIgnoreCase(v2);
5353
case StartWith: return v1.toLowerCase().startsWith(v2.toLowerCase());
54-
case NotStartWith: return !v1.toLowerCase().startsWith(v2.toLowerCase());
54+
case NotStartWith: return ! v1.toLowerCase().startsWith(v2.toLowerCase());
5555
case EndWith: return v1.toLowerCase().endsWith(v2.toLowerCase());
5656
case NotEndWith: return ! v1.toLowerCase().endsWith(v2.toLowerCase());
5757
case Contain: return v1.toLowerCase().contains(v2.toLowerCase());
58-
case NotContain: return !v1.toLowerCase().contains(v2.toLowerCase());
58+
case NotContain: return ! v1.toLowerCase().contains(v2.toLowerCase());
5959
}
6060

61-
throw new AssertionError("Unknow comparator mark:" + this);
61+
throw new AssertionError("Unknown comparator mark:" + this);
6262
}
6363

6464

@@ -74,15 +74,27 @@ public boolean eval(String v1, String v2) {
7474
* @return true if v1 is not equal to v2 for Comparator NotEqual;
7575
*/
7676
public boolean eval(int v1, int v2){
77-
switch(this){
78-
case GreatEqual: return (v1 >= v2);
79-
case SmallEqual: return (v1 <= v2 );
80-
case Great: return (v1 > v2);
81-
case Small: return (v1 < v2);
82-
case Equal: return (v1 == v2);
83-
case NotEqual: return (v1 != v2);
77+
switch (this) {
78+
case GreatEqual -> {
79+
return (v1 >= v2);
80+
}
81+
case SmallEqual -> {
82+
return (v1 <= v2);
83+
}
84+
case Great -> {
85+
return (v1 > v2);
86+
}
87+
case Small -> {
88+
return (v1 < v2);
89+
}
90+
case Equal -> {
91+
return (v1 == v2);
92+
}
93+
case NotEqual -> {
94+
return (v1 != v2);
95+
}
8496
}
85-
throw new AssertionError("Unknow comparator mark:" + this);
97+
throw new AssertionError("Unknown comparator mark:" + this);
8698
}
8799

88100
/**
@@ -92,15 +104,27 @@ public boolean eval(int v1, int v2){
92104
* see detail return value on documents of eval(int v1, int v2);
93105
*/
94106
public boolean eval(float v1, float v2){
95-
switch(this){
96-
case GreatEqual: return (v1 >= v2);
97-
case SmallEqual: return (v1 <= v2 );
98-
case Great: return (v1 > v2);
99-
case Small: return (v1 < v2);
100-
case Equal: return (v1 == v2);
101-
case NotEqual: return (v1 != v2);
107+
switch (this) {
108+
case GreatEqual -> {
109+
return (v1 >= v2);
110+
}
111+
case SmallEqual -> {
112+
return (v1 <= v2);
113+
}
114+
case Great -> {
115+
return (v1 > v2);
116+
}
117+
case Small -> {
118+
return (v1 < v2);
119+
}
120+
case Equal -> {
121+
return (v1 == v2);
122+
}
123+
case NotEqual -> {
124+
return (v1 != v2);
125+
}
102126
}
103-
throw new AssertionError("Unknow comparator mark:" + this);
127+
throw new AssertionError("Unknown comparator mark:" + this);
104128
}
105129

106130
/**
@@ -111,30 +135,34 @@ public boolean eval(float v1, float v2){
111135
* Throw Exception for another type of Comparator;
112136
*/
113137
public boolean eval(boolean v1, boolean v2){
114-
switch(this){
115-
case Equal: return (v1 == v2);
116-
case NotEqual: return (v1 != v2 );
138+
switch (this) {
139+
case Equal -> {
140+
return (v1 == v2);
141+
}
142+
case NotEqual -> {
143+
return (v1 != v2);
144+
}
117145
}
118-
throw new AssertionError("Unknow op:" + this);
146+
throw new AssertionError("Unknown op:" + this);
119147
}
120148

121149
/**
122150
*
123151
* @param comp: valid string parameter must belong to [">=", ">", "<=", "<", "==", "!="]
124-
* @return one of the six Comparators based onthe parameter string comp
125-
* @throws Exception if the parameter comp is not valid.
152+
* @return one of the six Comparators based on the parameter string comp
126153
*/
127-
public static final Comparator GetComparator(String comp, String value) {
128-
129-
if(comp.equals(">=")){ return GreatEqual;}
130-
else if( comp.equals("<=")){return SmallEqual; }
131-
else if( comp.equals(">")){return Great; }
132-
else if( comp.equals("<")){return Small; }
133-
else if( comp.equals("==")){return Equal; }
134-
else if( comp.equals("!=")){return NotEqual;}
135-
else if( comp.equals("=~") || comp.equals("!~")){
136-
return GetWildCaseComparator(comp, value);}
137-
else return null;
154+
public static Comparator GetComparator(String comp, String value) {
155+
156+
return switch (comp) {
157+
case ">=" -> GreatEqual;
158+
case "<=" -> SmallEqual;
159+
case ">" -> Great;
160+
case "<" -> Small;
161+
case "==" -> Equal;
162+
case "!=" -> NotEqual;
163+
case "=~", "!~" -> getWildCaseComparator(comp, value);
164+
default -> null;
165+
};
138166

139167
}
140168

@@ -143,53 +171,62 @@ else if( comp.equals("=~") || comp.equals("!~")){
143171
* @param comp must be '=~' or '!~'
144172
* @param value: String contain single or non '*'
145173
* @return
146-
* @throws Exception unless the single '*' appear at the begin or end of value string
147174
*/
148-
public static Comparator GetWildCaseComparator(String comp, String value) {
149-
String subStr = GetWildCaseValue(value);
175+
public static Comparator getWildCaseComparator(String comp, String value) {
176+
String subStr = getWildCaseValue(value);
150177

151-
if( !comp.equals("=~") && !comp.equals("!~") )
152-
return null;
178+
if ( ! comp.equals("=~") && ! comp.equals("!~")) {
179+
return null;
180+
}
153181

154-
// System.out.println( String.format("GetWildCaseComparator( String %s, String %s )", comp, value) );
155-
156-
//only allow single or none '*'
157-
if( value.contains("*") && subStr.length() != (value.length() - 1) )
158-
return null;
182+
//only allow single or none '*'
183+
if ( value.contains("*") && subStr.length() != (value.length() - 1)) {
184+
return null;
185+
}
159186

160-
if(value.startsWith("*"))
161-
return comp.equals("=~")? EndWith: NotEndWith;
162-
else if(value.endsWith("*")){
187+
if (value.startsWith("*")) {
188+
return comp.equals("=~") ? EndWith : NotEndWith;
189+
} else if (value.endsWith("*")) {
163190
return comp.equals("=~")? StartWith: NotStartWith;
164-
}else if( ! value.contains("*")){
191+
} else if ( ! value.contains("*")) {
165192
return comp.equals("=~")? Contain: NotContain;
166193
}
167194

168195
return null;
169196
}
170197

171198

172-
public static String GetWildCaseValue(String value) {
199+
public static String getWildCaseValue(String value) {
173200
//remove all '*'
174201
return value.replace("*", "");
175-
176-
177-
}
202+
}
178203

179204
/**
180205
* @return comparator string. eg.
181206
* return ">=" for Comparator.GreatEqual.GetString().
182207
* return "==" for Comparator.Equal.GetString().
183208
*/
184-
public String GetString(){
185-
switch(this){
186-
case GreatEqual: return ">=";
187-
case SmallEqual: return "<=";
188-
case Great: return ">";
189-
case Small: return "<";
190-
case Equal: return "==";
191-
case NotEqual: return "!=";
209+
public String getString() {
210+
switch (this) {
211+
case GreatEqual -> {
212+
return ">=";
213+
}
214+
case SmallEqual -> {
215+
return "<=";
216+
}
217+
case Great -> {
218+
return ">";
219+
}
220+
case Small -> {
221+
return "<";
222+
}
223+
case Equal -> {
224+
return "==";
225+
}
226+
case NotEqual -> {
227+
return "!=";
228+
}
192229
}
193-
throw new AssertionError("Unknow comparator mark:" + this);
230+
throw new AssertionError("Unknown comparator mark:" + this);
194231
}
195232
}

0 commit comments

Comments
 (0)