@@ -45,7 +45,7 @@ public class Options {
4545 private boolean intron = true ;
4646 private boolean indel = true ;
4747 private int threadNo = 1 ;
48- private final List <InputBAM > inputBAMs = new ArrayList <InputBAM >();
48+ private final List <InputBAM > inputBAMs = new ArrayList <>();
4949 private File hdf ;
5050 private String inputType ;
5151 private int nearbyIndelWindow = 3 ;
@@ -61,7 +61,6 @@ public class Options {
6161 private String filterQuery ;
6262 //private Integer minCoverage;
6363 private Integer maxCoverage ;
64- private Map <String , String []> pindelMutations ;
6564 private Integer outputFormat = 1 ;
6665
6766 public Options (final String [] args ) throws Exception {
@@ -120,10 +119,6 @@ public Options(final String[] args) throws Exception {
120119 log = (String ) options .valueOf ("log" );
121120 String loglevel = (String ) options .valueOf ("loglevel" );
122121
123- if (loglevel == null ) {
124- loglevel = "INFO" ;
125- }
126-
127122 if (options .has ("r" )) {
128123 reference = new File ((String ) options .valueOf ("r" ));
129124 }
@@ -225,30 +220,35 @@ public Options(final String[] args) throws Exception {
225220
226221
227222 //set filtering options
228- if (profile .equals ("torrent" )) {
229- baseQuality = 0 ;
230- mappingQuality = 1 ;
231- indel = true ;
232- intron = true ;
233- novelstarts = false ;
234- strand =false ;
235- } else if (profile .equals ("RNA" )) {
236- baseQuality = 7 ;
237- mappingQuality = 10 ;
238- indel = true ;
239- intron = true ;
240- novelstarts = true ;
241- strand =false ;
242- } else if (profile .equals ("DNA" )) {
243- baseQuality = 10 ;
244- mappingQuality = 10 ;
245- indel = true ;
246- intron = false ;
247- novelstarts = false ;
248- strand =false ;
249- } else if (profile .equals ("indel" )) {
250-
251- }
223+ switch (profile ) {
224+ case "torrent" :
225+ baseQuality = 0 ;
226+ mappingQuality = 1 ;
227+ indel = true ;
228+ intron = true ;
229+ novelstarts = false ;
230+ strand = false ;
231+ break ;
232+ case "RNA" :
233+ baseQuality = 7 ;
234+ mappingQuality = 10 ;
235+ indel = true ;
236+ intron = true ;
237+ novelstarts = true ;
238+ strand = false ;
239+ break ;
240+ case "DNA" :
241+ baseQuality = 10 ;
242+ mappingQuality = 10 ;
243+ indel = true ;
244+ intron = false ;
245+ novelstarts = false ;
246+ strand = false ;
247+ break ;
248+ case "indel" :
249+
250+ break ;
251+ }
252252
253253 if (options .has ("bq" )) {
254254 baseQuality = (Integer ) options .valueOf ("bq" );
@@ -337,7 +337,7 @@ public Options(final String[] args) throws Exception {
337337 normalBam = new InputBAM (null , null , new File ((String ) options .valueOf ("in" )), inputType );
338338
339339 if (options .has ("pd" ) || options .has ("pi" )) {
340- this . pindelMutations = getPindelMutations (options );
340+ Map < String , String []> pindelMutations = getPindelMutations (options );
341341 }
342342
343343 }
@@ -385,12 +385,8 @@ public Integer getOutputFormat() {
385385 return outputFormat ;
386386 }
387387
388- public Map <String , String []> getPindelMutations () {
389- return pindelMutations ;
390- }
391-
392388 private Map <String , String []> getPindelMutations (OptionSet options ) throws IOException {
393- Map <String , String []> pindelMutations = new HashMap <String , String [] >();
389+ Map <String , String []> pindelMutations = new HashMap <>();
394390
395391 if (options .has ("pd" )) {
396392 File file = new File ((String )options .valueOf ("pd" ));
@@ -405,38 +401,38 @@ private Map<String, String[]> getPindelMutations(OptionSet options) throws IOExc
405401
406402 private void readPindelMutationFile (Map <String , String []> pindelMutations ,
407403 File file , String type ) throws IOException {
408- try (BufferedReader reader = new BufferedReader (new FileReader (file )); ) {
404+ try (BufferedReader reader = new BufferedReader (new FileReader (file ))) {
409405 String line ;
410406 List <String > lines = new ArrayList <>();
411407 while ((line = reader .readLine ()) != null ) {
412408 if (line .startsWith ("####" )) {
413409 if (lines .size () > 0 ) {
414410 String [] infos = lines .get (0 ).split ("\t " );
415411 String chr = infos [3 ].replace ("ChrID " , "" );
416- Integer start = new Integer (infos [4 ].replace ("BP " , "" ));
417- Integer end = new Integer (infos [5 ].replace ("BP " , "" ));
412+ int start = Integer . parseInt (infos [4 ].replace ("BP " , "" ));
413+ int end = Integer . parseInt (infos [5 ].replace ("BP " , "" ));
418414 if ("DEL" .equals (type )) {
419415 start ++;
420416 end --;
421417 }
422418 String key = chr + ":" + start + ":" + end + ":" + type ;
423- String normal = "" ;
424- String tumour = "" ;
419+ StringBuilder normal = new StringBuilder () ;
420+ StringBuilder tumour = new StringBuilder () ;
425421 int normalCount = 0 ;
426422 int tumourCount = 0 ;
427423 for (int i =2 ; i <lines .size (); i ++) {
428424 String [] subLines = lines .get (i ).split ("\t " );
429- String bam = subLines [subLines .length - 2 ];
430- String name = subLines [subLines .length - 1 ].replace ("@" , "" );
425+ String bam = subLines [subLines .length - 2 ];
426+ String name = subLines [subLines .length - 1 ].replace ("@" , "" );
431427 if (bam .contains ("Normal" )) {
432- normal += name + ";" ;
428+ normal . append ( name ). append ( ";" ) ;
433429 normalCount ++;
434430 } else {
435- tumour += name + ";" ;
431+ tumour . append ( name ). append ( ";" ) ;
436432 tumourCount ++;
437433 }
438434 }
439- String [] out = {tumourCount + ";" + normalCount , tumour , normal };
435+ String [] out = {tumourCount + ";" + normalCount , tumour . toString () , normal . toString () };
440436 pindelMutations .put (key , out );
441437 }
442438 lines .clear ();
@@ -479,10 +475,6 @@ public boolean hasStrelkaOption() {
479475 return options .has ("strelka" );
480476 }
481477
482- public String getInputType () {
483- return inputType ;
484- }
485-
486478 private void getHDFBamList () throws Exception {
487479 PileupHDF pileupHDF = new PileupHDF (hdf .getAbsolutePath (), false , false );
488480 pileupHDF .open ();
@@ -497,7 +489,7 @@ private void getHDFBamList() throws Exception {
497489 }
498490
499491 private void getBamList (File bamList ) throws IOException , QBasePileupException {
500- try (BufferedReader reader = new BufferedReader (new FileReader (bamList )); ) {
492+ try (BufferedReader reader = new BufferedReader (new FileReader (bamList ))) {
501493 String line ;
502494 int count = 0 ;
503495 while ((line = reader .readLine ()) != null ) {
@@ -573,10 +565,6 @@ public File getHdf() {
573565 return hdf ;
574566 }
575567
576- public OptionParser getParser () {
577- return parser ;
578- }
579-
580568 public OptionSet getOptions () {
581569 return options ;
582570 }
@@ -595,14 +583,6 @@ boolean hasVersionOption() {
595583 return options .has ("v" ) || options .has ("V" ) || options .has ("version" );
596584 }
597585
598- boolean hasLogOption () {
599- return options .has ("log" );
600- }
601-
602- boolean hasLogLevelOption () {
603- return options .has ("loglevel" );
604- }
605-
606586 public void detectBadOptions () throws QBasePileupException {
607587 if ( ! hasHelpOption () && ! hasVersionOption ()) {
608588
0 commit comments