3131
3232import util .FileSelection ;
3333import scripts .BAM_Manipulation .BAIIndexer ;
34- import scripts .BAM_Manipulation .BAMDeDuplication ;
34+ import scripts .BAM_Manipulation .BAMMarkDuplicates ;
3535
3636@ SuppressWarnings ("serial" )
37- public class BAMRemoveDupWindow extends JFrame implements ActionListener , PropertyChangeListener {
37+ public class BAMMarkDupWindow extends JFrame implements ActionListener , PropertyChangeListener {
3838 private JPanel contentPane ;
3939 protected JFileChooser fc = new JFileChooser (new File (System .getProperty ("user.dir" )));
4040
@@ -52,6 +52,7 @@ public class BAMRemoveDupWindow extends JFrame implements ActionListener, Proper
5252 private JLabel label ;
5353 private JLabel lblDefaultToLocal ;
5454 private JCheckBox chckbxGenerateBaiIndex ;
55+ private JCheckBox chckbxRemoveDuplicates ;
5556
5657 class Task extends SwingWorker <Void , Void > {
5758 @ Override
@@ -60,17 +61,25 @@ public Void doInBackground() throws Exception {
6061 for (int x = 0 ; x < BAMFiles .size (); x ++) {
6162 String [] NAME = BAMFiles .get (x ).getName ().split ("\\ ." );
6263 File OUTPUT = null ;
63- if (OUTPUT_PATH != null ) { OUTPUT = new File (OUTPUT_PATH .getCanonicalPath () + File .separator + NAME [0 ] + "_dedup.bam" ); }
64- else { OUTPUT = new File (NAME [0 ] + "_dedup.bam" ); }
65- BAMDeDuplication dedup = new BAMDeDuplication (BAMFiles .get (x ), OUTPUT );
64+ File METRICS = null ;
65+ if (OUTPUT_PATH != null ) {
66+ OUTPUT = new File (OUTPUT_PATH .getCanonicalPath () + File .separator + NAME [0 ] + "_dedup.bam" );
67+ METRICS = new File (OUTPUT_PATH .getCanonicalPath () + File .separator + NAME [0 ] + "_dedup.metrics" );
68+ } else {
69+ OUTPUT = new File (NAME [0 ] + "_dedup.bam" );
70+ METRICS = new File (NAME [0 ] + "_dedup.metrics" );
71+ }
72+
73+ BAMMarkDuplicates dedup = new BAMMarkDuplicates (BAMFiles .get (x ), chckbxRemoveDuplicates .isSelected (), OUTPUT , METRICS );
6674 dedup .run ();
75+
6776 if (chckbxGenerateBaiIndex .isSelected ()) { BAIIndexer .generateIndex (OUTPUT ); }
6877
6978 int percentComplete = (int )(((double )(x + 1 ) / BAMFiles .size ()) * 100 );
7079 setProgress (percentComplete );
7180 }
7281 setProgress (100 );
73- JOptionPane .showMessageDialog (null , "De-Duplication Complete" );
82+ JOptionPane .showMessageDialog (null , "Mark Duplicates Complete" );
7483 return null ;
7584 }
7685
@@ -80,11 +89,11 @@ public void done() {
8089 }
8190 }
8291
83- public BAMRemoveDupWindow () {
84- setTitle ("BAM Remove Duplicate Reads " );
92+ public BAMMarkDupWindow () {
93+ setTitle ("BAM MarkDuplicates (picard) " );
8594 setDefaultCloseOperation (JFrame .DISPOSE_ON_CLOSE );
8695
87- setBounds (125 , 125 , 450 , 330 );
96+ setBounds (125 , 125 , 450 , 360 );
8897 contentPane = new JPanel ();
8998 contentPane .setBorder (new EmptyBorder (5 , 5 , 5 , 5 ));
9099 setContentPane (contentPane );
@@ -132,7 +141,7 @@ public void actionPerformed(ActionEvent arg0) {
132141 });
133142 contentPane .add (btnRemoveBam );
134143
135- btnSort = new JButton ("De-Duplicate " );
144+ btnSort = new JButton ("Mark Duplicates " );
136145 sl_contentPane .putConstraint (SpringLayout .WEST , btnSort , 160 , SpringLayout .WEST , contentPane );
137146 sl_contentPane .putConstraint (SpringLayout .SOUTH , btnSort , 0 , SpringLayout .SOUTH , contentPane );
138147 sl_contentPane .putConstraint (SpringLayout .EAST , btnSort , -160 , SpringLayout .EAST , contentPane );
@@ -149,7 +158,7 @@ public void actionPerformed(ActionEvent arg0) {
149158 contentPane .add (progressBar );
150159
151160 btnOutput = new JButton ("Output Directory" );
152- sl_contentPane .putConstraint (SpringLayout .SOUTH , scrollPane , -42 , SpringLayout .NORTH , btnOutput );
161+ sl_contentPane .putConstraint (SpringLayout .SOUTH , scrollPane , -72 , SpringLayout .NORTH , btnOutput );
153162 btnOutput .addActionListener (new ActionListener () {
154163 public void actionPerformed (ActionEvent e ) {
155164 OUTPUT_PATH = FileSelection .getOutputDir (fc );
@@ -176,10 +185,16 @@ public void actionPerformed(ActionEvent e) {
176185 contentPane .add (lblDefaultToLocal );
177186
178187 chckbxGenerateBaiIndex = new JCheckBox ("Generate BAI Index for new BAM file" );
188+ sl_contentPane .putConstraint (SpringLayout .NORTH , chckbxGenerateBaiIndex , 40 , SpringLayout .SOUTH , scrollPane );
189+ sl_contentPane .putConstraint (SpringLayout .WEST , chckbxGenerateBaiIndex , 5 , SpringLayout .WEST , contentPane );
179190 chckbxGenerateBaiIndex .setSelected (true );
180- sl_contentPane .putConstraint (SpringLayout .NORTH , chckbxGenerateBaiIndex , 11 , SpringLayout .SOUTH , scrollPane );
181- sl_contentPane .putConstraint (SpringLayout .WEST , chckbxGenerateBaiIndex , 0 , SpringLayout .WEST , scrollPane );
182191 contentPane .add (chckbxGenerateBaiIndex );
192+
193+ chckbxRemoveDuplicates = new JCheckBox ("Remove Duplicates" );
194+ sl_contentPane .putConstraint (SpringLayout .WEST , chckbxRemoveDuplicates , 0 , SpringLayout .WEST , scrollPane );
195+ sl_contentPane .putConstraint (SpringLayout .SOUTH , chckbxRemoveDuplicates , -6 , SpringLayout .NORTH , chckbxGenerateBaiIndex );
196+ chckbxRemoveDuplicates .setSelected (true );
197+ contentPane .add (chckbxRemoveDuplicates );
183198 }
184199
185200 @ Override
0 commit comments