List of usage examples for java.awt Cursor DEFAULT_CURSOR
int DEFAULT_CURSOR
To view the source code for java.awt Cursor DEFAULT_CURSOR.
Click Source Link
From source file:v800_trainer.JCicloTronic.java
private void jMenuOpenallActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuOpenallActionPerformed // Add your handling code here: int i;// ww w. j a v a 2s . c o m StringBuffer Buffer = new StringBuffer(); String[] liste = new String[1]; byte Data[] = new byte[81930]; File path = new File(Properties.getProperty("data.dir")); File Datei; FileFilter directoryFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } public String getDescription() { return ""; }; }; chooser.setCurrentDirectory( new java.io.File(Properties.getProperty("import.dir", Properties.getProperty("data.dir")))); chooser.setDialogType(JFileChooser.OPEN_DIALOG); ExampleFileFilter filtera = new ExampleFileFilter(); ExampleFileFilter filterb = new ExampleFileFilter(); ExampleFileFilter filterc = new ExampleFileFilter(); ExampleFileFilter filterd = new ExampleFileFilter(); ExampleFileFilter filtere = new ExampleFileFilter(); filtera.addExtension("dat"); filtera.setDescription("HAC Rohdaten"); filterb.addExtension("tur"); filterb.setDescription("Hactronic Dateien"); filterc.addExtension("hrm"); filterc.setDescription("Polar Daten"); filterd.addExtension(""); filterd.setDescription("Polar V800 Verzeichnis"); filtere.addExtension("csv"); filtere.setDescription("Polar V800 CSV Flow export"); chooser.resetChoosableFileFilters(); chooser.addChoosableFileFilter(filtera); chooser.addChoosableFileFilter(filterb); chooser.addChoosableFileFilter(filterc); chooser.addChoosableFileFilter(filterd); chooser.addChoosableFileFilter(filtere); chooser.setFileFilter(filtere); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showDialog(this, null); if (returnVal == JFileChooser.APPROVE_OPTION) { if (chooser.getSelectedFile().getName().endsWith(".dat")) { path = new File(chooser.getCurrentDirectory().getPath()); } else { path = new File(chooser.getSelectedFile().getPath()); } if (chooser.getFileFilter().equals(filtera)) { liste = path.list(new DirFilter(".dat")); } if (chooser.getFileFilter().equals(filterb)) { liste = path.list(new DirFilter(".tur")); } if (chooser.getFileFilter().equals(filterc)) { liste = path.list(new DirFilter(".hrm")); } if (chooser.getFileFilter().equals(filtere)) { liste = path.list(new DirFilter(".csv")); } if (chooser.getFileFilter().equals(filterd)) { File[] files = path.listFiles(); ArrayList<String> pathliste = new ArrayList(); for (File file : files) { try { if (file.isDirectory()) { pathliste.add(file.getCanonicalPath()); } } catch (Exception e) { } } Thread thread = new Thread(new Runnable() { public void run() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); pm = new ProgressMonitor(JCicloTronic.this, "Importiere...", "", 0, 100); pm.setMillisToPopup(1); v800export V800_export = new v800export(); V800_export.export_sessions(JCicloTronic.this, pathliste); pm.close(); ChangeModel(); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); try { Thread.sleep(100); } catch (Exception e) { if (Thread.interrupted()) { return; } } } }); thread.start(); return; } //alle auer V800 Dateien importieren if (liste == null) { JOptionPane.showMessageDialog(null, "Keine Rohdaten-Files gefunden!", "Achtung!", JOptionPane.ERROR_MESSAGE); return; } final String[] liste_final = liste.clone(); final File path_final = path; Thread thread = new Thread(new Runnable() { public void run() { File Datei; byte Data[] = new byte[81930]; setCursor(new Cursor(Cursor.WAIT_CURSOR)); pm = new ProgressMonitor(JCicloTronic.this, "Importiere...", "", 0, 100); pm.setMillisToPopup(1); for (int i = 0; i < liste_final.length; i++) { pm.setProgress((int) 100.0 * i / liste_final.length); pm.setNote(liste_final[i]); try { Eingabedatei = new java.io.FileInputStream(path_final.getPath() + SystemProperties.getProperty("file.separator") + liste_final[i]); try { Datei = new File(path_final.getPath() + SystemProperties.getProperty("file.separator") + liste_final[i]); Data = new byte[(int) Datei.length()]; // Eingabedatei.read() Eingabedatei.read(Data); Eingabedatei.close(); if (chooser.getFileFilter().equals(filtera)) { ExtractTour(Data); } if (chooser.getFileFilter().equals(filterb)) { ExtractHactronicFile(Data); } if (chooser.getFileFilter().equals(filterc)) { ExtractPolarFile(Data); } if (chooser.getFileFilter().equals(filtere)) { ExtractCSV(Data); } } catch (IOException e) { JOptionPane.showMessageDialog(null, "IO-Fehler bei Datenlesen", "Achtung!", JOptionPane.ERROR_MESSAGE); } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(null, "IO-Fehler bei " + path_final.getPath() + SystemProperties.getProperty("file.separator") + liste_final[i], "Achtung!", JOptionPane.ERROR_MESSAGE); } } pm.close(); JOptionPane.showMessageDialog(null, "Daten Ende", "Achtung!", JOptionPane.ERROR_MESSAGE); Properties.setProperty("import.dir", chooser.getCurrentDirectory().getPath()); ChangeModel(); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); try { Thread.sleep(100); } catch (Exception e) { if (Thread.interrupted()) { return; } } } }); thread.start(); } }
From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java
/** * This method initializes jButton1 //from w w w .j a va2s. c o m * * @return javax.swing.JButton */ private JButton getJButtonNext() { if (jButtonNext == null) { jButtonNext = new JButton(); URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/next.png"); if (iconFile != null) { jButtonNext.setIcon(new ImageIcon(iconFile)); } else { jButtonNext.setText("N"); } jButtonNext.setMnemonic(KeyEvent.VK_N); jButtonNext.setEnabled(myControler.isInTable()); jButtonNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } catch (Exception ex) { log.error(ex); } // try to move to the next specimen in the table. if (thisPane.myControler.nextSpecimenInTable()) { //thisPane.myControler.setSpecimen(thisPane.specimen.getSpecimenId() + 1); thisPane.setVisible(false); thisPane.myControler.displayInEditor(); thisPane.invalidate(); } try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { log.error(ex); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } finally { try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { log.error(ex); } } } }); } return jButtonNext; }
From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java
/** * This method initializes jButton1 /*from ww w. j a va 2s .c om*/ * * @return javax.swing.JButton */ private JButton getJButtonPrevious() { if (jButtonPrevious == null) { jButtonPrevious = new JButton(); URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/back.png"); if (iconFile != null) { jButtonPrevious.setIcon(new ImageIcon(iconFile)); } else { jButtonPrevious.setText("P"); } jButtonPrevious.setMnemonic(KeyEvent.VK_P); jButtonPrevious.setToolTipText("Move to Previous Specimen"); jButtonPrevious.setEnabled(myControler.isInTable()); jButtonPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } catch (Exception ex) { log.error(ex); } // try to move to the previous specimen in the table. if (thisPane.myControler.previousSpecimenInTable()) { thisPane.setVisible(false); thisPane.myControler.displayInEditor(); thisPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); thisPane.invalidate(); } try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { log.error(ex); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } finally { try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); ; } catch (Exception ex) { log.error(ex); } } } }); } return jButtonPrevious; }
From source file:org.domainmath.gui.MainFrame.java
private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed MainFrame.octavePanel.evaluate("pkg load all;"); String f = System.getProperty("user.dir") + File.separator + "cache" + File.separator + "pkg_list.xml"; MainFrame.octavePanel.evaluate("DomainMath_PkgContents('" + f + "');"); PkgDocFrame pkgDocFrame = new PkgDocFrame(this); pkgDocFrame.setLocationRelativeTo(this); this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); ActionListener taskPerformer = (ActionEvent evt1) -> { pkgDocFrame.setVisible(true);/*from ww w .j ava2 s. c o m*/ }; javax.swing.Timer t = new javax.swing.Timer(1200, taskPerformer); t.setRepeats(false); t.start(); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:v800_trainer.JCicloTronic.java
private void Map_PanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_Map_PanelComponentShown // TODO add your handling code here: setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (SelectionChanged) { Statistik_PanelComponentShown_StatistikStarten(evt); alteAuswahl = -6;/*from w ww. j a v a2 s .c o m*/ Draw_Map(); Update_Graphik_paint = true; } if (Update_Map_paint == true) { Draw_Map(); } // Draw_Map(); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:v800_trainer.JCicloTronic.java
private void jMenu_V800_LadenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu_V800_LadenMouseClicked V800_Download_Training V800_read = new V800_Download_Training(); if (!V800_read.start(this)) return;/*from w w w .j av a 2s . co m*/ setCursor(new Cursor(Cursor.WAIT_CURSOR)); ArrayList<String> sessions = V800_read.get_all_sessions(); ArrayList<String> NewData = new ArrayList(); for (int i = 0; i < sessions.size(); i++) { String Name = sessions.get(i).replace("/", ""); Name = Properties.getProperty("data.dir", Properties.getProperty("working.dir")) + SystemProperties.getProperty("file.separator") + Name.substring(0, Name.length() - 2) + "_Tour.cfg"; File file = new File(Name); if ((file.exists() != true || Integer.parseInt(Properties.getProperty("Daten ueberschreiben")) == 1)) { NewData.add(sessions.get(i)); } } Thread thread = new Thread(new Runnable() { public void run() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); pm = new ProgressMonitor(JCicloTronic.this, "Download...", "", 0, 100); pm.setMillisToPopup(0); pm.setMillisToDecideToPopup(0); ArrayList<String> PathList = V800_read.get_sessions(NewData); V800_read.stop(); // V800_read = null; pm.close(); v800export V800_export = new v800export(); pm = new ProgressMonitor(JCicloTronic.this, "Importiere...", "", 0, 100); pm.setMillisToPopup(0); pm.setMillisToDecideToPopup(0); V800_export.export_sessions(JCicloTronic.this, PathList); pm.close(); ChangeModel(); try { Thread.sleep(100); } catch (Exception e) { if (Thread.interrupted()) { return; } } } }); thread.start(); ChangeModel(); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Writes the data onto a file that is specified by the filePath * //w w w . j a v a 2 s . com * @param query * The SQL statement * @param model * The model for the current results * @param filePath * A String that denotes the filepath * @param append * Whether to append the current results into the file * * @todo Make this handle other data types (especially Date/Time) better * for cleaner import to spreadsheet. */ private void writeDataAsCSV(String query, TableModel model, String filePath, boolean append) { PrintWriter out; int row, col; boolean[] quote; boolean quoteThis; String temp; Object value; out = null; this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); (flashRunIndicator = new Thread( new FlashForeground(runIndicator, Color.red.brighter(), Color.lightGray, 5))).start(); (timeRunIndicator = new Thread(new InsertTime(timeIndicator, new java.util.Date().getTime(), QUERY_EXECUTION_TIMER_UPDATE_DELAY_MS))).start(); try { out = new PrintWriter(new FileWriter(filePath, append)); messageOut(""); messageOut(Resources.getString("msgStartExportToFile", filePath)); // Output query if (!fileExportsRaw.isSelected()) { // Make it look like a comment using hash comment character out.print("#,"); out.print("\""); } // out.print(getQuery().getSQL()); out.print(query.replaceAll("\n", " ")); if (!fileExportsRaw.isSelected()) { out.print("\""); } out.println(); // Setup array to hold which columns need to be quoted quote = new boolean[model.getColumnCount()]; // Output column headings - determine if column needs quotes for (col = 0; col < model.getColumnCount(); ++col) { if (col > 0) { out.print(","); } out.print("\"" + model.getColumnName(col) + "\""); /** * todo: use column type to set need for quotes */ quote[col] = false; } out.println(); // Output data for (row = 0; row < model.getRowCount(); ++row) { for (col = 0; col < model.getColumnCount(); ++col) { if (col > 0) { out.print(","); } // Get the field content try { value = model.getValueAt(row, col); if (value == null) { temp = ""; } else if (value instanceof java.sql.Timestamp) { temp = Utility.formattedDate((java.sql.Timestamp) value); } else { temp = model.getValueAt(row, col).toString(); if (!fileExportsRaw.isSelected()) { temp = temp.replace('"', '\''); temp = temp.replace('\n', '~'); } } } catch (Exception any) { LOGGER.error("Failed to export data", any); // Display error and move on messageOut(Resources.getString("errFailDuringExport", any.getMessage()), STYLE_RED); temp = ""; } // Decide if quotes are needed: // -If the row is a known character type // -If this field contains a comma quoteThis = !fileExportsRaw.isSelected() && (quote[col] || temp.indexOf(",") > -1); // Output the field if (quoteThis) { out.print("\""); } out.print(temp); if (quoteThis) { out.print("\""); } } if (!fileNoCRAddedToExportRows.isSelected()) { out.println(); } } // Assume that if writing multiple resultsets to file the // user would appreciate a separation line between them. if (append) { out.println("\n********"); } messageOut(Resources.getString("msgEndExportToFile")); } catch (Exception any) { LOGGER.error("Unable to write data to file", any); messageOut(Resources.getString("errFailDataSave", any.toString()), STYLE_RED); } finally { if (out != null) { try { out.close(); } catch (Exception any) { LOGGER.error("Failed while writing data to CSV file", any); } } } flashRunIndicator.interrupt(); flashRunIndicator = null; timeRunIndicator.interrupt(); timeRunIndicator = null; this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
/** * This method is called from within the constructor to Tinitialize the * form. WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. *//*from w ww.ja v a 2s . c om*/ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { m_jPanContainer = new javax.swing.JPanel(); m_jOptions = new javax.swing.JPanel(); m_jButtons = new javax.swing.JPanel(); m_jPanelScripts = new javax.swing.JPanel(); m_jButtonsExt = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); m_jbtnScale = new javax.swing.JButton(); m_jLogout = new javax.swing.JButton(); m_jbtnPrintBill = new javax.swing.JButton(); m_jSettleBill = new javax.swing.JButton(); m_jSplitBtn = new javax.swing.JButton(); m_jBtnDiscount = new javax.swing.JButton(); m_jBtnCancelBill = new javax.swing.JButton(); m_jBtnBillOnHold = new javax.swing.JButton(); m_jPanelBag = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); m_jLblUserInfo = new javax.swing.JLabel(); m_jUser = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); m_jTable = new javax.swing.JLabel(); m_jLblCurrentDate = new javax.swing.JLabel(); m_jLblTime = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); m_jLblBillNo = new javax.swing.JLabel(); m_jPanTicket = new javax.swing.JPanel(); jPanel10 = new javax.swing.JPanel(); jButtonAddon = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); m_jLblItemCode = new javax.swing.JLabel(); m_jTxtItemCode = new javax.swing.JTextField(); m_jLblItemName = new javax.swing.JLabel(); m_jCboItemName = new javax.swing.JComboBox(); m_jPanelCentral = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); m_jPlus = new javax.swing.JButton(); m_jMinus = new javax.swing.JButton(); m_jEditLine = new javax.swing.JButton(); m_jCalculatePromotion = new javax.swing.JButton(); m_jAction = new javax.swing.JButton(); m_jDelete = new javax.swing.JButton(); m_jBtnServed = new javax.swing.JButton(); m_jKot = new javax.swing.JButton(); m_jEraser = new javax.swing.JButton(); m_jContEntries = new javax.swing.JPanel(); m_jPanEntries = new javax.swing.JPanel(); catcontainer = new javax.swing.JPanel(); jPanel12 = new javax.swing.JPanel(); jLayeredPane1 = new javax.swing.JLayeredPane(); jPanel4 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); m_jTxtTotalPaid = new javax.swing.JLabel(); m_jTxtChange = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); m_jTax = new javax.swing.JComboBox(); m_jPor = new javax.swing.JLabel(); m_jaddtax = new javax.swing.JToggleButton(); jLblPrinterStatus = new javax.swing.JLabel(); m_jKeyFactory = new javax.swing.JTextField(); jPanel8 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); m_jSubtotalEuros1 = new javax.swing.JLabel(); m_jLblTotalEuros4 = new javax.swing.JLabel(); m_jTaxesEuros1 = new javax.swing.JLabel(); m_jLblTotalEuros5 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); m_jLblTotalEuros6 = new javax.swing.JLabel(); m_jDiscount1 = new javax.swing.JLabel(); m_jTotalEuros = new javax.swing.JLabel(); jTaxPanel = new javax.swing.JPanel(); m_jServiceTaxLbl = new javax.swing.JLabel(); m_jServiceTax = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); m_jTaxList = new javax.swing.JList(); m_jSwachBharatLbl = new javax.swing.JLabel(); m_jSwachBharat = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); m_jPromoDiscount = new javax.swing.JLabel(); m_jProducts = new javax.swing.JPanel(); setBackground(new java.awt.Color(222, 232, 231)); setPreferredSize(new java.awt.Dimension(1024, 768)); setLayout(new java.awt.CardLayout()); m_jPanContainer.setBackground(new java.awt.Color(222, 232, 231)); m_jPanContainer.setLayout(new java.awt.BorderLayout()); m_jOptions.setBackground(new java.awt.Color(222, 232, 231)); m_jOptions.setLayout(new java.awt.BorderLayout()); m_jButtons.setBackground(new java.awt.Color(222, 232, 231)); m_jButtons.setPreferredSize(new java.awt.Dimension(4, 10)); m_jOptions.add(m_jButtons, java.awt.BorderLayout.LINE_START); m_jPanelScripts.setBackground(new java.awt.Color(222, 232, 231)); m_jPanelScripts.setLayout(new java.awt.BorderLayout()); m_jButtonsExt.setBackground(new java.awt.Color(222, 232, 231)); m_jButtonsExt.setLayout(new javax.swing.BoxLayout(m_jButtonsExt, javax.swing.BoxLayout.LINE_AXIS)); jPanel1.setBackground(new java.awt.Color(222, 232, 231)); jPanel1.setPreferredSize(new java.awt.Dimension(620, 47)); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); m_jbtnScale.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/ark216.png"))); // NOI18N m_jbtnScale.setText(AppLocal.getIntString("button.scale")); // NOI18N m_jbtnScale.setFocusPainted(false); m_jbtnScale.setFocusable(false); m_jbtnScale.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jbtnScale.setRequestFocusEnabled(false); m_jbtnScale.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jbtnScaleActionPerformed(evt); } }); jPanel1.add(m_jbtnScale, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 5, -1)); m_jLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1logout.png"))); // NOI18N m_jLogout.setToolTipText("Logout"); m_jLogout.setFocusable(false); m_jLogout.setPreferredSize(new java.awt.Dimension(40, 40)); m_jLogout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jLogoutActionPerformed(evt); } }); jPanel1.add(m_jLogout, new org.netbeans.lib.awtextra.AbsoluteConstraints(575, 0, -1, -1)); m_jbtnPrintBill.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1Print-Bill.png"))); // NOI18N m_jbtnPrintBill.setPreferredSize(new java.awt.Dimension(90, 40)); m_jbtnPrintBill.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jbtnPrintBillActionPerformed(evt); } }); jPanel1.add(m_jbtnPrintBill, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 0, -1, -1)); m_jSettleBill.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1Settle-Bill.png"))); // NOI18N m_jSettleBill.setPreferredSize(new java.awt.Dimension(90, 40)); m_jSettleBill.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jSettleBillActionPerformed(evt); } }); jPanel1.add(m_jSettleBill, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 0, -1, -1)); m_jSplitBtn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/190-40-BUTTON.png"))); // NOI18N m_jSplitBtn.setMnemonic('f'); m_jSplitBtn.setFocusPainted(false); m_jSplitBtn.setFocusable(false); m_jSplitBtn.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jSplitBtn.setPreferredSize(new java.awt.Dimension(90, 40)); m_jSplitBtn.setRequestFocusEnabled(false); m_jSplitBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jSplitBtnActionPerformed(evt); } }); jPanel1.add(m_jSplitBtn, new org.netbeans.lib.awtextra.AbsoluteConstraints(195, 0, -1, -1)); m_jBtnDiscount.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/bill-discount.png"))); // NOI18N m_jBtnDiscount.setMnemonic('i'); m_jBtnDiscount.setToolTipText("Add Discount"); m_jBtnDiscount.setFocusPainted(false); m_jBtnDiscount.setFocusable(false); m_jBtnDiscount.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jBtnDiscount.setPreferredSize(new java.awt.Dimension(90, 40)); m_jBtnDiscount.setRequestFocusEnabled(false); m_jBtnDiscount.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jBtnDiscountActionPerformed(evt); } }); jPanel1.add(m_jBtnDiscount, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 0, -1, -1)); m_jBtnCancelBill.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/pos/templates/can-bill.png"))); // NOI18N m_jBtnCancelBill.setToolTipText("Cancel the Bill"); m_jBtnCancelBill.setPreferredSize(new java.awt.Dimension(90, 40)); m_jBtnCancelBill.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jBtnCancelBillActionPerformed(evt); } }); jPanel1.add(m_jBtnCancelBill, new org.netbeans.lib.awtextra.AbsoluteConstraints(385, 0, -1, -1)); m_jBtnBillOnHold.setBackground(new java.awt.Color(130, 130, 65)); m_jBtnBillOnHold.setForeground(new java.awt.Color(153, 153, 136)); m_jBtnBillOnHold .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/HOLD-BILL.png"))); // NOI18N m_jBtnBillOnHold.setToolTipText(""); m_jBtnBillOnHold.setPreferredSize(new java.awt.Dimension(90, 40)); m_jBtnBillOnHold.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jBtnBillOnHoldActionPerformed(evt); } }); jPanel1.add(m_jBtnBillOnHold, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 0, 90, 40)); m_jButtonsExt.add(jPanel1); m_jPanelScripts.add(m_jButtonsExt, java.awt.BorderLayout.LINE_END); m_jOptions.add(m_jPanelScripts, java.awt.BorderLayout.LINE_END); m_jPanelBag.setBackground(new java.awt.Color(222, 232, 231)); m_jPanelBag.setFocusable(false); m_jPanelBag.setPreferredSize(new java.awt.Dimension(800, 35)); m_jPanelBag.setRequestFocusEnabled(false); m_jPanelBag.setLayout(new java.awt.BorderLayout()); m_jOptions.add(m_jPanelBag, java.awt.BorderLayout.CENTER); jPanel6.setBackground(new java.awt.Color(80, 102, 116)); jPanel6.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jPanel6.setPreferredSize(new java.awt.Dimension(1024, 90)); jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel3.setBackground(new java.awt.Color(222, 232, 231)); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); jLabel3.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/openbravo/pos/templates/1header-habanero.png"))); // NOI18N jLabel3.setAutoscrolls(true); jLabel3.setFocusable(false); jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); jLabel3.setMaximumSize(new java.awt.Dimension(1450, 61)); jLabel3.setMinimumSize(new java.awt.Dimension(1024, 61)); jLabel3.setPreferredSize(new java.awt.Dimension(1024, 45)); jLabel3.setRequestFocusEnabled(false); jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.TOP); jPanel6.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1551, -1)); m_jLblUserInfo.setBackground(new java.awt.Color(80, 102, 160)); m_jLblUserInfo.setForeground(new java.awt.Color(255, 255, 255)); m_jLblUserInfo.setText(" LOGGED IN USER:"); m_jLblUserInfo.setFocusable(false); m_jLblUserInfo.setPreferredSize(new java.awt.Dimension(340, 16)); m_jLblUserInfo.setRequestFocusEnabled(false); jPanel6.add(m_jLblUserInfo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 140, 50)); m_jUser.setForeground(new java.awt.Color(252, 248, 0)); m_jUser.setText("jLabel6"); jPanel6.add(m_jUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 40, 70, 50)); jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Table:"); jPanel6.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 40, 50, 50)); m_jTable.setForeground(new java.awt.Color(252, 248, 0)); m_jTable.setText("jLabel9"); jPanel6.add(m_jTable, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 40, 60, 50)); m_jLblCurrentDate.setBackground(new java.awt.Color(80, 102, 160)); m_jLblCurrentDate.setForeground(new java.awt.Color(255, 255, 255)); m_jLblCurrentDate.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jLblCurrentDate .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/Date-icon.png"))); // NOI18N m_jLblCurrentDate.setFocusable(false); m_jLblCurrentDate.setPreferredSize(new java.awt.Dimension(300, 16)); m_jLblCurrentDate.setRequestFocusEnabled(false); jPanel6.add(m_jLblCurrentDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 45, 180, 45)); m_jLblTime.setBackground(new java.awt.Color(80, 102, 160)); m_jLblTime.setForeground(new java.awt.Color(255, 255, 255)); m_jLblTime.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jLblTime .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/Clock-icon.png"))); // NOI18N m_jLblTime.setText( " jLabel2"); m_jLblTime.setFocusable(false); m_jLblTime.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); m_jLblTime.setPreferredSize(new java.awt.Dimension(300, 16)); m_jLblTime.setRequestFocusEnabled(false); jPanel6.add(m_jLblTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 45, 230, 45)); jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Bill No:"); jPanel6.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 40, 50, 50)); m_jLblBillNo.setForeground(new java.awt.Color(252, 248, 0)); jPanel6.add(m_jLblBillNo, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 40, 90, 50)); m_jOptions.add(jPanel6, java.awt.BorderLayout.NORTH); m_jPanContainer.add(m_jOptions, java.awt.BorderLayout.NORTH); m_jPanTicket.setBackground(new java.awt.Color(222, 232, 231)); m_jPanTicket.setLayout(new java.awt.BorderLayout()); jPanel10.setBackground(new java.awt.Color(222, 232, 231)); jPanel10.setPreferredSize(new java.awt.Dimension(803, 48)); jPanel10.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jButtonAddon .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1Add-on.png"))); // NOI18N jButtonAddon.setPreferredSize(new java.awt.Dimension(90, 40)); jButtonAddon.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddonActionPerformed(evt); } }); jPanel10.add(jButtonAddon, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 0, 90, 40)); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1Category.png"))); // NOI18N jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel10.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 0, 90, 40)); jButton3.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/subcategory.png"))); // NOI18N jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel10.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(890, 0, 90, 40)); m_jLblItemCode.setText("ITEM CODE"); jPanel10.add(m_jLblItemCode, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 8, 90, 20)); m_jTxtItemCode.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1))); m_jTxtItemCode.setMinimumSize(new java.awt.Dimension(123, 20)); m_jTxtItemCode.setPreferredSize(new java.awt.Dimension(123, 20)); m_jTxtItemCode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jTxtItemCodeActionPerformed(evt); } }); jPanel10.add(m_jTxtItemCode, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 10, -1, 20)); m_jLblItemName.setText("ITEM NAME"); jPanel10.add(m_jLblItemName, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 10, -1, 20)); m_jCboItemName.setEditable(true); m_jCboItemName.setAutoscrolls(true); m_jCboItemName.setMaximumSize(new java.awt.Dimension(123, 20)); m_jCboItemName.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { m_jCboItemNameItemStateChanged(evt); } }); m_jCboItemName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jCboItemNameActionPerformed(evt); } }); jPanel10.add(m_jCboItemName, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 10, 340, -1)); m_jPanTicket.add(jPanel10, java.awt.BorderLayout.PAGE_START); m_jPanelCentral.setFocusable(false); m_jPanelCentral.setRequestFocusEnabled(false); m_jPanelCentral.setLayout(new java.awt.BorderLayout()); jPanel5.setLayout(new java.awt.BorderLayout()); jPanel2.setBackground(new java.awt.Color(222, 232, 231)); jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5)); jPanel2.setMinimumSize(new java.awt.Dimension(66, 338)); jPanel2.setPreferredSize(new java.awt.Dimension(61, 400)); m_jPlus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/TPlus.png"))); // NOI18N m_jPlus.setToolTipText("Increase selected item quantity by one"); m_jPlus.setFocusPainted(false); m_jPlus.setFocusable(false); m_jPlus.setMaximumSize(new java.awt.Dimension(51, 42)); m_jPlus.setMinimumSize(new java.awt.Dimension(51, 42)); m_jPlus.setPreferredSize(new java.awt.Dimension(51, 42)); m_jPlus.setRequestFocusEnabled(false); m_jPlus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jPlusActionPerformed(evt); } }); m_jMinus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/TMinus.png"))); // NOI18N m_jMinus.setToolTipText("Decrease selected item's quantity by one"); m_jMinus.setFocusPainted(false); m_jMinus.setFocusable(false); m_jMinus.setMaximumSize(new java.awt.Dimension(51, 42)); m_jMinus.setMinimumSize(new java.awt.Dimension(51, 42)); m_jMinus.setPreferredSize(new java.awt.Dimension(51, 42)); m_jMinus.setRequestFocusEnabled(false); m_jMinus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jMinusActionPerformed(evt); } }); m_jEditLine.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/TEdit.png"))); // NOI18N m_jEditLine.setMnemonic('e'); m_jEditLine.setToolTipText("Edit Properties of selected item"); m_jEditLine.setFocusPainted(false); m_jEditLine.setFocusable(false); m_jEditLine.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jEditLine.setRequestFocusEnabled(false); m_jEditLine.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jEditLineActionPerformed(evt); } }); m_jCalculatePromotion .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/pramo.png"))); // NOI18N m_jCalculatePromotion.setMnemonic('f'); m_jCalculatePromotion.setFocusPainted(false); m_jCalculatePromotion.setFocusable(false); m_jCalculatePromotion.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jCalculatePromotion.setPreferredSize(new java.awt.Dimension(51, 42)); m_jCalculatePromotion.setRequestFocusEnabled(false); m_jCalculatePromotion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jCalculatePromotionActionPerformed(evt); } }); m_jAction.setBorder(null); m_jAction.setBorderPainted(false); m_jAction.setPreferredSize(new java.awt.Dimension(10, 2)); m_jAction.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jActionActionPerformed(evt); } }); m_jDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/Tclose.png"))); // NOI18N m_jDelete.setMnemonic('d'); m_jDelete.setToolTipText("Remove total quantity of selected item"); m_jDelete.setFocusPainted(false); m_jDelete.setFocusable(false); m_jDelete.setMinimumSize(new java.awt.Dimension(51, 42)); m_jDelete.setPreferredSize(new java.awt.Dimension(51, 42)); m_jDelete.setRequestFocusEnabled(false); m_jDelete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jDeleteActionPerformed(evt); } }); m_jBtnServed.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/servedsymbol.png"))); // NOI18N m_jBtnServed.setToolTipText("Serve Selected Item"); m_jBtnServed.setPreferredSize(new java.awt.Dimension(91, 73)); m_jBtnServed.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jBtnServedActionPerformed(evt); } }); m_jKot.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/TKOT.png"))); // NOI18N m_jKot.setToolTipText("Send All Fresh Items to Kitchen"); m_jKot.setPreferredSize(new java.awt.Dimension(51, 42)); m_jKot.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jBtnKotActionPerformed(evt); } }); m_jEraser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/TDelete.png"))); // NOI18N m_jEraser.setMnemonic('i'); m_jEraser.setToolTipText("Clear All Non KOT Items"); m_jEraser.setFocusPainted(false); m_jEraser.setFocusable(false); m_jEraser.setMargin(new java.awt.Insets(8, 14, 8, 14)); m_jEraser.setRequestFocusEnabled(false); m_jEraser.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jEraserActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup().add(168, 168, 168).add(m_jAction, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(m_jBtnServed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jEraser, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jKot, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jCalculatePromotion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jEditLine, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jMinus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jPlus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup().add(242, 242, 242) .add(m_jAction, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(jPanel2Layout.createSequentialGroup() .add(m_jPlus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(3, 3, 3) .add(m_jMinus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(3, 3, 3) .add(m_jDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(2, 2, 2) .add(m_jEditLine, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(3, 3, 3) .add(m_jCalculatePromotion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 7, Short.MAX_VALUE) .add(m_jBtnServed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) .add(m_jKot, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(3, 3, 3).add(m_jEraser, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(36, 36, 36))); jPanel5.add(jPanel2, java.awt.BorderLayout.NORTH); m_jPanelCentral.add(jPanel5, java.awt.BorderLayout.LINE_END); m_jPanTicket.add(m_jPanelCentral, java.awt.BorderLayout.CENTER); m_jContEntries.setFocusable(false); m_jContEntries.setPreferredSize(new java.awt.Dimension(501, 500)); m_jContEntries.setRequestFocusEnabled(false); m_jContEntries.setLayout(new java.awt.BorderLayout()); m_jPanEntries.setMinimumSize(new java.awt.Dimension(508, 500)); m_jPanEntries.setPreferredSize(new java.awt.Dimension(495, 525)); m_jPanEntries.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); catcontainer.setPreferredSize(new java.awt.Dimension(300, 200)); catcontainer.setLayout(new java.awt.BorderLayout()); m_jPanEntries.add(catcontainer, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 508, 510)); m_jContEntries.add(m_jPanEntries, java.awt.BorderLayout.PAGE_START); m_jPanTicket.add(m_jContEntries, java.awt.BorderLayout.LINE_END); jPanel12.setBackground(new java.awt.Color(222, 232, 231)); jPanel12.setFocusable(false); jPanel12.setPreferredSize(new java.awt.Dimension(600, 5)); jPanel12.setRequestFocusEnabled(false); jPanel12.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLayeredPane1.setPreferredSize(new java.awt.Dimension(300, 402)); jPanel12.add(jLayeredPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, -500, 989, 509)); m_jPanTicket.add(jPanel12, java.awt.BorderLayout.PAGE_END); m_jPanContainer.add(m_jPanTicket, java.awt.BorderLayout.CENTER); jPanel4.setBackground(new java.awt.Color(222, 232, 231)); jPanel4.setPreferredSize(new java.awt.Dimension(1024, 210)); jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel7.setBorder( javax.swing.BorderFactory.createMatteBorder(0, 1, 1, 1, new java.awt.Color(204, 204, 204))); jPanel7.setMaximumSize(new java.awt.Dimension(700, 158)); jPanel7.setPreferredSize(new java.awt.Dimension(320, 158)); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N jLabel7.setText("TOTAL PAID"); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N jLabel8.setText("CHANGE"); m_jTxtTotalPaid.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N m_jTxtTotalPaid.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jTxtTotalPaid.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jTxtTotalPaid.setFocusable(false); m_jTxtTotalPaid.setOpaque(true); m_jTxtTotalPaid.setPreferredSize(new java.awt.Dimension(123, 25)); m_jTxtTotalPaid.setRequestFocusEnabled(false); m_jTxtChange.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N m_jTxtChange.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jTxtChange.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jTxtChange.setFocusable(false); m_jTxtChange.setOpaque(true); m_jTxtChange.setPreferredSize(new java.awt.Dimension(123, 25)); m_jTxtChange.setRequestFocusEnabled(false); jPanel3.setPreferredSize(new java.awt.Dimension(228, 100)); m_jTax.setFocusable(false); m_jTax.setRequestFocusEnabled(false); m_jPor.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jPor.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jPor.setFocusable(false); m_jPor.setOpaque(true); m_jPor.setPreferredSize(new java.awt.Dimension(22, 22)); m_jPor.setRequestFocusEnabled(false); m_jaddtax.setText("+"); m_jaddtax.setFocusPainted(false); m_jaddtax.setFocusable(false); m_jaddtax.setRequestFocusEnabled(false); jLblPrinterStatus.setForeground(new java.awt.Color(255, 0, 0)); m_jKeyFactory.setBackground(javax.swing.UIManager.getDefaults().getColor("Panel.background")); m_jKeyFactory.setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.background")); m_jKeyFactory.setBorder(null); m_jKeyFactory.setCaretColor(javax.swing.UIManager.getDefaults().getColor("Panel.background")); m_jKeyFactory.setPreferredSize(new java.awt.Dimension(4, 4)); m_jKeyFactory.setRequestFocusEnabled(false); m_jKeyFactory.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { m_jKeyFactoryKeyTyped(evt); } }); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap() .add(m_jKeyFactory, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 239, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(65, 65, 65).add(jLblPrinterStatus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 68, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jPanel3Layout.createSequentialGroup().add(20, 20, 20) .add(m_jaddtax, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(m_jPor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jPanel3Layout.createSequentialGroup().addContainerGap().add(m_jTax, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().add(6, 6, 6).add(jLblPrinterStatus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(m_jKeyFactory, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_jTax, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(21, 21, 21) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(m_jPor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jaddtax, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel7Layout.createSequentialGroup().add(10, 10, 10) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel7Layout.createSequentialGroup() .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(3, 3, 3) .add(m_jTxtTotalPaid, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jPanel7Layout.createSequentialGroup() .add(jLabel8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(19, 19, 19).add(m_jTxtChange, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 392, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel7Layout .setVerticalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel7Layout.createSequentialGroup() .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(270, 270, 270) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jTxtTotalPaid, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(10, 10, 10) .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(m_jTxtChange, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))); jPanel4.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(1325, 1, 170, 160)); jPanel8.setBackground(new java.awt.Color(255, 255, 255)); jPanel8.setBorder( javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(204, 204, 204))); jPanel8.setPreferredSize(new java.awt.Dimension(1551, 193)); jPanel8.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Bill Details"); jPanel8.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(15, 12, 188, -1)); m_jSubtotalEuros1.setBackground(new java.awt.Color(255, 255, 255)); m_jSubtotalEuros1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); m_jSubtotalEuros1.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jSubtotalEuros1.setFocusable(false); m_jSubtotalEuros1.setOpaque(true); m_jSubtotalEuros1.setPreferredSize(new java.awt.Dimension(123, 25)); m_jSubtotalEuros1.setRequestFocusEnabled(false); jPanel8.add(m_jSubtotalEuros1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 40, 80, 23)); m_jLblTotalEuros4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); m_jLblTotalEuros4.setText("SUB TOTAL"); jPanel8.add(m_jLblTotalEuros4, new org.netbeans.lib.awtextra.AbsoluteConstraints(11, 37, 94, 23)); m_jTaxesEuros1.setBackground(new java.awt.Color(255, 255, 255)); m_jTaxesEuros1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); m_jTaxesEuros1.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jTaxesEuros1.setFocusable(false); m_jTaxesEuros1.setOpaque(true); m_jTaxesEuros1.setPreferredSize(new java.awt.Dimension(123, 25)); m_jTaxesEuros1.setRequestFocusEnabled(false); jPanel8.add(m_jTaxesEuros1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 80, 23)); m_jLblTotalEuros5.setBackground(new java.awt.Color(255, 255, 255)); m_jLblTotalEuros5.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); m_jLblTotalEuros5.setText("TAXES"); jPanel8.add(m_jLblTotalEuros5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 60, 23)); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); jLabel5.setText("DISCOUNT"); jPanel8.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 80, 23)); m_jLblTotalEuros6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); m_jLblTotalEuros6.setText("TOTAL SALES"); jPanel8.add(m_jLblTotalEuros6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, 80, 20)); m_jDiscount1.setBackground(new java.awt.Color(255, 255, 255)); m_jDiscount1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); m_jDiscount1.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jDiscount1.setFocusable(false); m_jDiscount1.setOpaque(true); m_jDiscount1.setPreferredSize(new java.awt.Dimension(123, 25)); m_jDiscount1.setRequestFocusEnabled(false); jPanel8.add(m_jDiscount1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 100, 80, 23)); m_jTotalEuros.setBackground(new java.awt.Color(255, 255, 255)); m_jTotalEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jTotalEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jTotalEuros.setFocusable(false); m_jTotalEuros.setOpaque(true); m_jTotalEuros.setPreferredSize(new java.awt.Dimension(123, 25)); m_jTotalEuros.setRequestFocusEnabled(false); jPanel8.add(m_jTotalEuros, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 160, 80, 23)); jTaxPanel.setBackground(new java.awt.Color(255, 255, 255)); jTaxPanel.setPreferredSize(new java.awt.Dimension(202, 157)); jTaxPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); m_jServiceTaxLbl.setText("SERVICE TAX"); jTaxPanel.add(m_jServiceTaxLbl, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 100, 23)); m_jServiceTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); jTaxPanel.add(m_jServiceTax, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 40, 70, 23)); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("Tax Breakup"); jTaxPanel.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 11, 194, -1)); jScrollPane1.setBorder(null); jScrollPane1.setViewportView(m_jTaxList); jTaxPanel.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 37, 200, 140)); m_jSwachBharatLbl.setText("SWACHH BHARAT TAX"); jTaxPanel.add(m_jSwachBharatLbl, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 70, 130, 20)); m_jSwachBharat.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); jTaxPanel.add(m_jSwachBharat, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 70, 20)); jPanel8.add(jTaxPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(221, 1, -1, 178)); jLabel9.setText("PROMO DISCOUNT"); jPanel8.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 120, 20)); m_jPromoDiscount.setBackground(new java.awt.Color(255, 255, 255)); m_jPromoDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); m_jPromoDiscount.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jPromoDiscount.setFocusable(false); m_jPromoDiscount.setOpaque(true); m_jPromoDiscount.setPreferredSize(new java.awt.Dimension(123, 25)); m_jPromoDiscount.setRequestFocusEnabled(false); jPanel8.add(m_jPromoDiscount, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 130, 80, 23)); jPanel4.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(7, 1, 434, -1)); m_jProducts.setBackground(new java.awt.Color(255, 255, 255)); m_jProducts.setLayout(new java.awt.CardLayout()); jPanel4.add(m_jProducts, new org.netbeans.lib.awtextra.AbsoluteConstraints(447, 1, 551, 190)); m_jPanContainer.add(jPanel4, java.awt.BorderLayout.SOUTH); add(m_jPanContainer, "ticket"); }
From source file:MiGA.StatsSelection.java
public StatsSelection(final String[] organisms, final boolean flag) { setTitle("MiGA"); setSize(800, 600);//from w w w .j a va2 s . c om setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Image im = Toolkit.getDefaultToolkit().getImage("ssr.png"); this.setIconImage(im); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } countmono = new ArrayList<Integer>(); countdi = new ArrayList<Integer>(); counttri = new ArrayList<Integer>(); counttetra = new ArrayList<Integer>(); countpenta = new ArrayList<Integer>(); counthexa = new ArrayList<Integer>(); countmonore = new ArrayList<Integer>(); countdire = new ArrayList<Integer>(); counttrire = new ArrayList<Integer>(); counttetrare = new ArrayList<Integer>(); countpentare = new ArrayList<Integer>(); counthexare = new ArrayList<Integer>(); Amono = new ArrayList<Integer>(); Tmono = new ArrayList<Integer>(); Gmono = new ArrayList<Integer>(); Cmono = new ArrayList<Integer>(); Adi = new ArrayList<Integer>(); Tdi = new ArrayList<Integer>(); Gdi = new ArrayList<Integer>(); Cdi = new ArrayList<Integer>(); Atri = new ArrayList<Integer>(); Ttri = new ArrayList<Integer>(); Gtri = new ArrayList<Integer>(); Ctri = new ArrayList<Integer>(); Atetra = new ArrayList<Integer>(); Ttetra = new ArrayList<Integer>(); Gtetra = new ArrayList<Integer>(); Ctetra = new ArrayList<Integer>(); Apenta = new ArrayList<Integer>(); Tpenta = new ArrayList<Integer>(); Gpenta = new ArrayList<Integer>(); Cpenta = new ArrayList<Integer>(); Ahexa = new ArrayList<Integer>(); Thexa = new ArrayList<Integer>(); Ghexa = new ArrayList<Integer>(); Chexa = new ArrayList<Integer>(); for (int i = 0; i < organisms.length; i++) { countmono.add(0); countdi.add(0); counttri.add(0); counttetra.add(0); countpenta.add(0); counthexa.add(0); countmonore.add(0); countdire.add(0); counttrire.add(0); counttetrare.add(0); countpentare.add(0); counthexare.add(0); Amono.add(0); Tmono.add(0); Gmono.add(0); Cmono.add(0); Adi.add(0); Tdi.add(0); Gdi.add(0); Cdi.add(0); Atri.add(0); Ttri.add(0); Gtri.add(0); Ctri.add(0); Atetra.add(0); Ttetra.add(0); Gtetra.add(0); Ctetra.add(0); Apenta.add(0); Tpenta.add(0); Gpenta.add(0); Cpenta.add(0); Ahexa.add(0); Thexa.add(0); Ghexa.add(0); Chexa.add(0); } lab = new JLabel( "<html><b><p>To retrieve the sequence you want</p><p>simply copy and paste in the fields below</p><p>the data you were given in your result's file</p></b></html>"); startlab = new JLabel("Start:"); endlab = new JLabel("End:"); titlelab = new JLabel("Chromosome or field:"); startnum = new JTextField(); startnum.setColumns(5); endnum = new JTextField(); endnum.setColumns(5); titlef = new JTextField(); titlef.setColumns(30); flankst = new JLabel("Flanking region before: "); flankst.setEnabled(false); flankst.setVisible(false); flankend = new JLabel("Flanking region after: "); flankend.setEnabled(false); flankend.setVisible(false); flankstn = new JTextField(); flankstn.setColumns(5); flankstn.setEnabled(false); flankstn.setVisible(false); flankendn = new JTextField(); flankendn.setColumns(5); flankendn.setEnabled(false); flankendn.setVisible(false); result = new JTextArea("", 6, 90); result.setText(" "); result.setEditable(false); result.setLineWrap(true); result.setAutoscrolls(true); sbrText = new JScrollPane(result); sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); flk = new JCheckBox("Flanking Regions"); flk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (flk.isSelected()) { flankst.setEnabled(true); flankst.setVisible(true); flankend.setEnabled(true); flankend.setVisible(true); flankstn.setEnabled(true); flankstn.setVisible(true); flankendn.setEnabled(true); flankendn.setVisible(true); } if (!flk.isSelected()) { flankst.setEnabled(false); flankst.setVisible(false); flankend.setEnabled(false); flankend.setVisible(false); flankstn.setEnabled(false); flankstn.setVisible(false); flankendn.setEnabled(false); flankendn.setVisible(false); } } }); retrieve = new JButton("Retrieve"); retrieve.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int start = 0; int end = 0; BufferedReader in = null; String location = ""; String newlocation = ""; String bufferpre = ""; String bufferpost = ""; String pre = ""; String post = ""; String mid = ""; try { String[] locationarray = titlef.getText().split("data/"); location = locationarray[0] + locationarray[1]; newlocation = ""; if (location.contains("local")) { in = new BufferedReader(new FileReader(location + ".txt")); } else if (location.contains("organisms")) { String[] loc = location.split("/"); try { if (CheckForKaryotype(loc[1])) { newlocation = loc[0] + "/" + loc[1] + "/chrom-" + loc[2] + "-slices.txt"; } else { newlocation = loc[0] + "/" + loc[1] + "/slice-" + loc[2] + ".txt"; } } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } in = new BufferedReader(new FileReader(newlocation)); } } catch (FileNotFoundException ex) { msg.showMessageDialog(paneldown, "Wrong field", "Error", JOptionPane.ERROR_MESSAGE); } int rest = Integer.parseInt(startnum.getText()) % 20000; int lines = Integer.parseInt(startnum.getText()) / 20000; lines++; String buffer1 = ""; for (int c = 0; c < lines; c++) { try { buffer1 = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } if (flk.isSelected()) { boolean tfs = false, tfe = false; int fs = 0, fe = 0; try { fs = Integer.parseInt(flankstn.getText()); tfs = true; } catch (NumberFormatException ex) { tfs = false; } try { fe = Integer.parseInt(flankendn.getText()); tfe = true; } catch (NumberFormatException ex) { tfe = false; } if (tfs && tfe) { start = rest - Integer.parseInt(flankstn.getText()); end = rest + Integer.parseInt(endnum.getText()) - Integer.parseInt(startnum.getText()) + Integer.parseInt(flankendn.getText()); try { in = new BufferedReader(new FileReader(newlocation)); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } if (start < 0 && lines == 1) { start = 0; } else if (start < 0 && lines > 1) { for (int j = 0; j < lines - 1; j++) { try { bufferpre = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } pre = bufferpre.substring(20000 + start); mid = buffer1.substring(0, end); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } int cl = 0; try { cl = countlines(newlocation); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } try { in = new BufferedReader(new FileReader(newlocation)); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } if (end > 20000 && lines == cl - 1) { if (end - 20000 >= rest) { end = rest; mid = buffer1.substring(start); post = bufferpost; } else { for (int j = 0; j < lines - 1; j++) { try { bufferpost = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } mid = buffer1.substring(start); post = bufferpre.substring(0, end - 20000); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } } else if (end > 20000 && lines < cl - 1) { for (int j = 0; j < lines + 1; j++) { try { bufferpost = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } mid = buffer1.substring(start); post = bufferpost.substring(0, end - 20000); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (start >= 0 && (end <= 20000 || end <= rest)) { mid = buffer1.substring(start, end); } } else { if (!tfs) { msg.showMessageDialog(paneldown, "Flanking region start is empty.\nFill in the gap or uncheck the\nflanking regions checkbox", "Error", JOptionPane.ERROR_MESSAGE); } if (!tfe) { msg.showMessageDialog(paneldown, "Flanking region end is empty.\nFill in the gap or uncheck the\nflanking regions checkbox", "Error", JOptionPane.ERROR_MESSAGE); } } // } if (!flk.isSelected()) { start = rest; end = rest + Integer.parseInt(endnum.getText()) - Integer.parseInt(startnum.getText()); try { in = new BufferedReader(new FileReader(newlocation)); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } if (start < 0 && lines == 1) { start = 0; } else if (start < 0 && lines > 1) { for (int j = 0; j < lines - 1; j++) { try { bufferpre = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } pre = bufferpre.substring(start); mid = buffer1.substring(0, end); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } int cl = 0; try { cl = countlines(newlocation); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } try { in = new BufferedReader(new FileReader(newlocation)); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } if (end > 20000 && lines == cl - 1) { if (end - 20000 >= rest) { end = rest; mid = buffer1.substring(start); post = bufferpost; } else { for (int j = 0; j < lines - 1; j++) { try { bufferpost = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } mid = buffer1.substring(start); post = bufferpre.substring(0, end - 20000); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } } else if (end > 20000 && lines < cl - 1) { for (int j = 0; j < lines + 1; j++) { try { bufferpost = in.readLine(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } mid = buffer1.substring(start); post = bufferpost.substring(0, end - 20000); try { in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (start >= 0 && (end <= 20000 || end <= rest)) { mid = buffer1.substring(start, end); } } result.setText(pre + mid + post); } }); mono = new JCheckBox("Mononucleotide"); di = new JCheckBox("Dinucleotide"); tri = new JCheckBox("Trinucleotide"); tetra = new JCheckBox("Tetranucleotide"); penta = new JCheckBox("Pentanucleotide"); hexa = new JCheckBox("Hexanucleotide"); SSR = new ArrayList<String>(); repeats = new ArrayList<Integer>(); EndOfSsr = new ArrayList<Integer>(); start = new ArrayList<Integer>(); select = new JLabel("Select type: "); minimumssrlen = new JLabel("Minimum SSR length(bp)"); minimumssrlen.setVisible(false); score = new JTextField(); score.setColumns(5); score.setVisible(false); msg = new JOptionPane(); gapmax = new JLabel("Maximum Mismatch length for Imperfect SSRs(bp)"); gapmax.setVisible(false); max = new JTextField(); max.setColumns(5); max.setVisible(false); minlenpregap = new JLabel("Minimum SSR length before given Mismatch length(bp)"); minlenpregap.setVisible(false); minpregap = new JTextField(); minpregap.setColumns(5); minpregap.setVisible(false); gapcomp = new JLabel("Maximum Inter-repeat R for Compound SSRs(bp)"); gapcomp.setVisible(false); maxgapcomp = new JTextField(); maxgapcomp.setColumns(5); maxgapcomp.setVisible(false); box1 = new JCheckBox("Perfect"); box2 = new JCheckBox("Imperfect"); box3 = new JCheckBox("Compound"); com = new JCheckBox("Perfect Compound"); incom = new JCheckBox("Imperfect Compound"); box1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (box2.isSelected() || box3.isSelected()) { if (box1.isSelected()) { std.setEnabled(true); no_st.setEnabled(true); part_st.setEnabled(true); full_st.setEnabled(true); if (!box3.isSelected()) { minimumssrlen.setVisible(true); score.setVisible(true); } } if (!box1.isSelected()) { std.setEnabled(false); no_st.setEnabled(false); part_st.setEnabled(false); full_st.setEnabled(false); if (!box3.isSelected()) { minimumssrlen.setVisible(false); score.setVisible(false); } } } else { if (box1.isSelected()) { std.setEnabled(true); no_st.setEnabled(true); part_st.setEnabled(true); full_st.setEnabled(true); panel2.setVisible(true); minimumssrlen.setVisible(true); score.setVisible(true); } if (!box1.isSelected()) { std.setEnabled(false); no_st.setEnabled(false); part_st.setEnabled(false); full_st.setEnabled(false); panel2.setVisible(false); minimumssrlen.setVisible(false); score.setVisible(false); } } } }); box2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (box1.isSelected() || box3.isSelected()) { if (box2.isSelected()) { gapmax.setVisible(true); max.setVisible(true); minlenpregap.setVisible(true); minpregap.setVisible(true); } if (!box2.isSelected()) { gapmax.setVisible(false); max.setVisible(false); minlenpregap.setVisible(false); minpregap.setVisible(false); } } else { if (box2.isSelected()) { panel2.setVisible(true); gapmax.setVisible(true); max.setVisible(true); minlenpregap.setVisible(true); minpregap.setVisible(true); } if (!box2.isSelected()) { panel2.setVisible(false); gapmax.setVisible(false); max.setVisible(false); minlenpregap.setVisible(false); minpregap.setVisible(false); } } } }); box3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (box1.isSelected() || box2.isSelected()) { if (box3.isSelected()) { paneldownleft.setVisible(true); if (!box1.isSelected()) { minimumssrlen.setVisible(true); score.setVisible(true); } gapcomp.setVisible(true); maxgapcomp.setVisible(true); com.setVisible(true); incom.setVisible(true); } if (!box3.isSelected()) { paneldownleft.setVisible(false); gapcomp.setVisible(false); maxgapcomp.setVisible(false); if (!box1.isSelected()) { minimumssrlen.setVisible(false); score.setVisible(false); com.setVisible(false); incom.setVisible(false); } } } else { if (box3.isSelected()) { paneldownleft.setVisible(true); panel2.setVisible(true); minimumssrlen.setVisible(true); score.setVisible(true); gapcomp.setVisible(true); maxgapcomp.setVisible(true); com.setVisible(true); incom.setVisible(true); } if (!box3.isSelected()) { paneldownleft.setVisible(false); panel2.setVisible(false); minimumssrlen.setVisible(false); score.setVisible(false); gapcomp.setVisible(false); maxgapcomp.setVisible(false); com.setVisible(false); incom.setVisible(false); } } } }); /* incom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (incom.isSelected()) { if (!box2.isSelected()) { gapmax.setVisible(true); max.setVisible(true); minlenpregap.setVisible(true); minpregap.setVisible(true); } } if (!incom.isSelected()) { if (!box2.isSelected()) { gapmax.setVisible(false); max.setVisible(false); minlenpregap.setVisible(false); minpregap.setVisible(false); } } } });*/ std = new JPanel(); no_st = new JRadioButton("Not Standardized"); part_st = new JRadioButton("Partial Standardized"); full_st = new JRadioButton("Full Standardized"); no_st.setSelected(true); no_st.setEnabled(false); part_st.setEnabled(false); full_st.setEnabled(false); standard = new ButtonGroup(); standard.add(no_st); standard.add(part_st); standard.add(full_st); show = new JButton("Run"); show.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (!box1.isSelected() && !box2.isSelected() && !box3.isSelected()) { msg.showMessageDialog(paneldown, "Please select a type", "Error", JOptionPane.ERROR_MESSAGE); } for (int i = 0; i < organisms.length; i++) { File f = new File("organisms/" + organisms[i] + "/stats/"); if (f.exists()) { f.delete(); } } calendar = Calendar.getInstance(); now = calendar.getTime(); if (box1.isSelected()) { if (!score.getText().isEmpty()) { boolean isnumber = false; int minlen = 0; try { minlen = Integer.parseInt(score.getText()); isnumber = true; } catch (NumberFormatException ex) { isnumber = false; } if (isnumber) { try { getPerfectSSRs(organisms, minlen, flag); for (int i = 0; i < organisms.length; i++) { map = new HashMap<String, motifStats>(); String location = ""; String location2 = ""; PrintWriter out = null; // 18/11/2013 added starting here String filetype = ""; String filepro = ""; if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } //List<String> files = getFiles(organisms[i], minlen, flag); // 18/11/2013 added ending here PrintWriter stats = null; PrintWriter html = null; PrintWriter motifstats = null; PrintWriter motifhtml = null; DataOutputStream lt = null; if (filetype.contains("organisms")) { File f = new File("organisms/" + organisms[i] + "/stats/"); if (!f.exists()) { f.mkdir(); } stats = new PrintWriter(new FileWriter("organisms/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); motifstats = new PrintWriter(new FileWriter("organisms/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); motifhtml = new PrintWriter(new FileWriter("organisms/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); html = new PrintWriter(new FileWriter("organisms/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); lt = new DataOutputStream(new BufferedOutputStream( new FileOutputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".perf"))); File fi = new File("organisms/" + organisms[i] + "/results/"); if (!fi.exists()) { fi.mkdir(); } String toopen = "organisms/" + organisms[i] + "/results/allPerfect_" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; location = toopen; location2 = "organisms/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; out = new PrintWriter(toopen); out.println("Results for organism: " + organisms[i] + "\t Search Parameters --> Minimum SSR Length (bp): " + minlen); out.println( " SSR repeats start-end length Path(../organism/data/chromosome)"); } else if (filetype.contains("local")) { File f = new File("local/" + organisms[i] + "/stats/"); if (!f.exists()) { f.mkdir(); } stats = new PrintWriter(new FileWriter("local/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); motifstats = new PrintWriter(new FileWriter("local/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); motifhtml = new PrintWriter(new FileWriter("local/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); lt = new DataOutputStream(new BufferedOutputStream( new FileOutputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".perf"))); html = new PrintWriter(new FileWriter("local/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); File fi = new File("local/" + organisms[i] + "/results/"); if (!fi.exists()) { fi.mkdir(); } String toopen = "local/" + organisms[i] + "/results/allPerfect_" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; location = toopen; location2 = "local/" + organisms[i] + "/stats/" + "motif_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; out = new PrintWriter(toopen); out.println("Results for project: " + organisms[i] + "\t Search Parameters --> Minimum SSR Length (bp): " + minlen); out.println( " SSR repeats start-end length Path(../organism/data/chromosome)"); out.println(); } if (mono.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } //List<String> files = getFiles(organisms[i], minlen, flag); //for (int j = 0; j < files.size(); j++) { while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + minlen + "_monoPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); // map for motifstats if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } if (di.isSelected()) { //for (int j = 0; j < files.size(); j++) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } //List<String> files = getFiles(organisms[i], minlen, flag); while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream(new BufferedInputStream( new FileInputStream(files + "_" + minlen + "_diPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); //out.println("SSR: " + ssr + " repeats: " + repeats + " start-end " + (end - repeats * ssr.length()) + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } if (tri.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } //for (int j = 0; j < files.size(); j++) { while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + minlen + "_triPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); //out.println("SSR: " + ssr + " repeats: " + repeats + " start-end " + (end - repeats * ssr.length()) + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } if (tetra.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + minlen + "_tetraPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); // out.println("SSR: " + ssr + " repeats: " + repeats + " start-end " + (end - repeats * ssr.length()) + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } if (penta.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + minlen + "_pentaPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); // out.println("SSR: " + ssr + " repeats: " + repeats + " start-end " + (end - repeats * ssr.length()) + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } if (hexa.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + minlen + "_hexaPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int repeats = in.readInt(); int end = in.readInt(); // out.println("SSR: " + ssr + " repeats: " + repeats + " start-end " + (end - repeats * ssr.length()) + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); out.println(cell(ssr, 6) + " " + cell(repeats, 11) + " " + cell(Integer .toString(end - repeats * ssr.length() + 1) + "-" + Integer.toString(end + 1), 20) + " " + cell(repeats * ssr.length(), 6) + " " + files.substring(0, files.lastIndexOf('.'))); if (!map.containsKey(ssr)) { motifStats m = new motifStats(ssr, repeats); map.put(ssr, m); } else { map.get(ssr).update(repeats); } } catch (EOFException exc) { eof = true; } } in.close(); } } out.close(); Runtime.getRuntime().exec("notepad " + location); DecimalFormat round = new DecimalFormat("#.###"); html.println("<html><h1>******* Perfect SSRs *******</h1>"); html.println("<h4>Results for project: " + organisms[i] + "</h4><h4>Search Parameters --> Minimum SSR Length (bp): " + minlen + "</h4>"); html.println( "<table border=\"1\"><tr><td><b>motif</b></td><td><b>count</b></td><td><b>bp</b></td><td><b>A%</b></td><td><b>T%</b></td><td><b>C%</b></td><td><b>G%</b></td><td><b>Relative Frequency</b></td><td><b>Abundance</b></td><td><b>Relative Abundance</b></td></tr>"); stats.println("******* Perfect SSRs *******"); stats.println("Results for project: " + organisms[i] + "\n Search Parameters --> Minimum SSR Length (bp): " + minlen); stats.println( " ____________________________________________________________________________________________________________ "); stats.println( "| | | | | | | | Relative | | Relative |"); stats.println( "| motif | count | bp | A% | T% | C% | G% | Frequency | Abundance | Abundance |"); stats.println( "|=======|=======|============|=======|=======|=======|=======|===============|===============|===============|"); int totalcount = 0; long bpcount = 0; int Aperc = 0; int Tperc = 0; int Gperc = 0; int Cperc = 0; float relfreq = 0; float abfreq = 0; long seqcount = 0; if (mono.isSelected()) { totalcount += countmono.get(i); bpcount += countmonore.get(i); } if (di.isSelected()) { totalcount += countdi.get(i); bpcount += countdire.get(i) * 2; } if (tri.isSelected()) { totalcount += counttri.get(i); bpcount += counttrire.get(i) * 3; } if (tetra.isSelected()) { totalcount += counttetra.get(i); bpcount += counttetrare.get(i) * 4; } if (penta.isSelected()) { totalcount += countpenta.get(i); bpcount += countpentare.get(i) * 5; } if (hexa.isSelected()) { totalcount += counthexa.get(i); bpcount += counthexare.get(i) * 6; } try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } Connection con = null; try { con = DriverManager.getConnection("jdbc:mysql://localhost:3306", "biouser", "thesis2012"); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } Statement st = null; try { st = con.createStatement(); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } st.executeUpdate("use lobid"); seqcount = 0; if (filetype.contains("organisms")) { ResultSet rs = st.executeQuery( "SELECT end FROM slices INNER JOIN organism WHERE slices.org_id=organism.org_id AND organism.name='" + organisms[i] + "'"); while (rs.next()) { seqcount += Long.parseLong(rs.getString(1)); } } else if (filetype.contains("local")) { BufferedReader in = new BufferedReader( new FileReader("local/" + organisms[i] + "/index.txt")); int count = countlines("local/" + organisms[i] + "/index.txt"); for (int c = 0; c < count; c++) { String temp = in.readLine(); BufferedReader tmp = new BufferedReader( new FileReader("local/" + organisms[i] + "/" + temp + ".txt")); boolean eof = false; while (!eof) { String s = tmp.readLine(); if (s != null) { seqcount += s.length(); } else { eof = true; } } tmp.close(); } } if (mono.isSelected()) { Aperc += Amono.get(i); Tperc += Tmono.get(i); Gperc += Gmono.get(i); Cperc += Cmono.get(i); //lt.writeInt(countmono);lt.writeInt(countmonore);lt.writeFloat((float)Amono*100/countmonore);lt.writeFloat((float)Tmono*100/countmonore);lt.writeFloat((float)Gmono*100/countmonore);lt.writeFloat((float)Cmono*100/countmonore);lt.writeFloat((float) countmono / totalcount);lt.writeFloat((float) countmonore / seqcount);lt.writeFloat((float) countmonore / bpcount); stats.printf("|mono |" + cell(Integer.toString(countmono.get(i)), 7) + "|" + cell(Integer.toString(1 * countmonore.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) countmono.get(i) / totalcount, 15) + "|" + cell((float) countmonore.get(i) / seqcount, 15) + "|" + cell((float) countmonore.get(i) / bpcount, 15) + "|\n", cell((float) (Amono.get(i) * 100) / (countmonore.get(i)), 7), cell((float) (Tmono.get(i) * 100) / (countmonore.get(i)), 7), cell((float) (Cmono.get(i) * 100) / (countmonore.get(i)), 7), cell((float) (Gmono.get(i) * 100) / (countmonore.get(i)), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>mono</b></td><td>" + countmono.get(i) + "</td><td>" + (1 * countmonore.get(i)) + "</td><td>" + round.format((float) (Amono.get(i) * 100) / (countmonore.get(i))) + "</td><td>" + round.format((float) (Tmono.get(i) * 100) / (countmonore.get(i))) + "</td><td>" + round.format((float) (Cmono.get(i) * 100) / (countmonore.get(i))) + "</td><td>" + round.format((float) (Gmono.get(i) * 100) / (countmonore.get(i))) + "</td><td>" + round.format((float) countmono.get(i) / totalcount) + "</td><td>" + round.format((float) countmonore.get(i) / seqcount) + "</td><td>" + round.format((float) countmonore.get(i) / bpcount) + "</td></tr>"); } if (di.isSelected()) { Aperc += Adi.get(i); Tperc += Tdi.get(i); Gperc += Gdi.get(i); Cperc += Cdi.get(i); //lt.writeInt(countdi);lt.writeInt(countdire*2);lt.writeFloat((float)Adi*100/countdire*2);lt.writeFloat((float)Tdi*100/countdire*2);lt.writeFloat((float)Gdi*100/countdire*2);lt.writeFloat((float)Cdi*100/countdire*2);lt.writeFloat((float) countdi / totalcount);lt.writeFloat((float) countdire*2 / seqcount);lt.writeFloat((float) countdire*2 / bpcount); stats.printf("|di |" + cell(Integer.toString(countdi.get(i)), 7) + "|" + cell(Integer.toString(countdire.get(i) * 2), 12) + "|%s|%s|%s|%s|" + cell((float) countdi.get(i) / totalcount, 15) + "|" + cell((float) countdire.get(i) * 2 / seqcount, 15) + "|" + cell((float) countdire.get(i) * 2 / bpcount, 15) + "|\n", cell((float) (Adi.get(i) * 100) / (countdire.get(i) * 2), 7), cell((float) (Tdi.get(i) * 100) / (countdire.get(i) * 2), 7), cell((float) (Cdi.get(i) * 100) / (countdire.get(i) * 2), 7), cell((float) (Gdi.get(i) * 100) / (countdire.get(i) * 2), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>di</b></td><td>" + countdi.get(i) + "</td><td>" + (2 * countdire.get(i)) + "</td><td>" + round.format((float) (Adi.get(i) * 100) / (2 * countdire.get(i))) + "</td><td>" + round.format((float) (Tdi.get(i) * 100) / (2 * countdire.get(i))) + "</td><td>" + round.format((float) (Cdi.get(i) * 100) / (2 * countdire.get(i))) + "</td><td>" + round.format((float) (Gdi.get(i) * 100) / (2 * countdire.get(i))) + "</td><td>" + round.format((float) countdi.get(i) / totalcount) + "</td><td>" + round.format((float) 2 * countdire.get(i) / seqcount) + "</td><td>" + round.format((float) 2 * countdire.get(i) / bpcount) + "</td></tr>"); } if (tri.isSelected()) { Aperc += Atri.get(i); Tperc += Ttri.get(i); Gperc += Gtri.get(i); Cperc += Ctri.get(i); //lt.writeInt(counttri);lt.writeInt(counttrire*3);lt.writeFloat((float)Atri*100/counttrire*3);lt.writeFloat((float)Ttri*100/counttrire*3);lt.writeFloat((float)Gtri*100/counttrire*3);lt.writeFloat((float)Ctri*100/counttrire*3);lt.writeFloat((float) counttri / totalcount);lt.writeFloat((float) counttrire*3 / seqcount);lt.writeFloat((float) counttrire*3 / bpcount); stats.printf("|tri |" + cell(Integer.toString(counttri.get(i)), 7) + "|" + cell(Integer.toString(counttrire.get(i) * 3), 12) + "|%s|%s|%s|%s|" + cell((float) counttri.get(i) / totalcount, 15) + "|" + cell((float) counttrire.get(i) * 3 / seqcount, 15) + "|" + cell((float) counttrire.get(i) * 3 / bpcount, 15) + "|\n", cell((float) (Atri.get(i) * 100) / (counttrire.get(i) * 3), 7), cell((float) (Ttri.get(i) * 100) / (counttrire.get(i) * 3), 7), cell((float) (Ctri.get(i) * 100) / (counttrire.get(i) * 3), 7), cell((float) (Gtri.get(i) * 100) / (counttrire.get(i) * 3), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>tri</b></td><td>" + counttri.get(i) + "</td><td>" + (3 * counttrire.get(i)) + "</td><td>" + round.format( (float) (Atri.get(i) * 100) / (3 * counttrire.get(i))) + "</td><td>" + round.format( (float) (Ttri.get(i) * 100) / (3 * counttrire.get(i))) + "</td><td>" + round.format( (float) (Ctri.get(i) * 100) / (3 * counttrire.get(i))) + "</td><td>" + round.format( (float) (Gtri.get(i) * 100) / (3 * counttrire.get(i))) + "</td><td>" + round.format((float) counttri.get(i) / totalcount) + "</td><td>" + round.format((float) 3 * counttrire.get(i) / seqcount) + "</td><td>" + round.format((float) 3 * counttrire.get(i) / bpcount) + "</td></tr>"); } if (tetra.isSelected()) { Aperc += Atetra.get(i); Tperc += Ttetra.get(i); Gperc += Gtetra.get(i); Cperc += Ctetra.get(i); //lt.writeInt(counttetra);lt.writeInt(counttetrare*4);lt.writeFloat((float)Atetra*100/counttetrare*4);lt.writeFloat((float)Ttetra*100/counttetrare*4);lt.writeFloat((float)Gtetra*100/counttetrare*4);lt.writeFloat((float)Ctetra*100/counttetrare*4);lt.writeFloat((float) counttetra / totalcount);lt.writeFloat((float) counttetrare*4 / seqcount);lt.writeFloat((float) counttetrare*4 / bpcount); stats.printf("|tetra |" + cell(Integer.toString(counttetra.get(i)), 7) + "|" + cell(Integer.toString(counttetrare.get(i) * 4), 12) + "|%s|%s|%s|%s|" + cell((float) counttetra.get(i) / totalcount, 15) + "|" + cell((float) counttetrare.get(i) * 4 / seqcount, 15) + "|" + cell((float) counttetrare.get(i) * 4 / bpcount, 15) + "|\n", cell((float) (Atetra.get(i) * 100) / (counttetrare.get(i) * 4), 7), cell((float) (Ttetra.get(i) * 100) / (counttetrare.get(i) * 4), 7), cell((float) (Ctetra.get(i) * 100) / (counttetrare.get(i) * 4), 7), cell((float) (Gtetra.get(i) * 100) / (counttetrare.get(i) * 4), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>tetra</b></td><td>" + counttetra.get(i) + "</td><td>" + (4 * counttetrare.get(i)) + "</td><td>" + round.format( (float) (Atetra.get(i) * 100) / (4 * counttetrare.get(i))) + "</td><td>" + round.format( (float) (Ttetra.get(i) * 100) / (4 * counttetrare.get(i))) + "</td><td>" + round.format( (float) (Ctetra.get(i) * 100) / (4 * counttetrare.get(i))) + "</td><td>" + round.format( (float) (Gtetra.get(i) * 100) / (4 * counttetrare.get(i))) + "</td><td>" + round.format((float) counttetra.get(i) / totalcount) + "</td><td>" + round.format((float) 4 * counttetrare.get(i) / seqcount) + "</td><td>" + round.format((float) 4 * counttetrare.get(i) / bpcount) + "</td></tr>"); } if (penta.isSelected()) { Aperc += Apenta.get(i); Tperc += Tpenta.get(i); Gperc += Gpenta.get(i); Cperc += Cpenta.get(i); //lt.writeInt(countpenta);lt.writeInt(countpentare*5);lt.writeFloat((float)Apenta*100/countpentare*5);lt.writeFloat((float)Tpenta*100/countpentare*5);lt.writeFloat((float)Gpenta*100/countpentare*5);lt.writeFloat((float)Cpenta*100/countpentare*5);lt.writeFloat((float) countpenta / totalcount);lt.writeFloat((float) countpentare*5 / seqcount);lt.writeFloat((float) countpentare*5 / bpcount); stats.printf("|penta |" + cell(Integer.toString(countpenta.get(i)), 7) + "|" + cell(Integer.toString(countpentare.get(i) * 5), 12) + "|%s|%s|%s|%s|" + cell((float) countpenta.get(i) / totalcount, 15) + "|" + cell((float) countpentare.get(i) * 5 / seqcount, 15) + "|" + cell((float) countpentare.get(i) * 5 / bpcount, 15) + "|\n", cell((float) (Apenta.get(i) * 100) / (countpentare.get(i) * 5), 7), cell((float) (Tpenta.get(i) * 100) / (countpentare.get(i) * 5), 7), cell((float) (Cpenta.get(i) * 100) / (countpentare.get(i) * 5), 7), cell((float) (Gpenta.get(i) * 100) / (countpentare.get(i) * 5), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>penta</b></td><td>" + countpenta.get(i) + "</td><td>" + (5 * countpentare.get(i)) + "</td><td>" + round.format( (float) (Apenta.get(i) * 100) / (5 * countpentare.get(i))) + "</td><td>" + round.format( (float) (Tpenta.get(i) * 100) / (5 * countpentare.get(i))) + "</td><td>" + round.format( (float) (Cpenta.get(i) * 100) / (5 * countpentare.get(i))) + "</td><td>" + round.format( (float) (Gpenta.get(i) * 100) / (5 * countpentare.get(i))) + "</td><td>" + round.format((float) countpenta.get(i) / totalcount) + "</td><td>" + round.format((float) 5 * countpentare.get(i) / seqcount) + "</td><td>" + round.format((float) 5 * countpentare.get(i) / bpcount) + "</td></tr>"); } if (hexa.isSelected()) { Aperc += Ahexa.get(i); Tperc += Thexa.get(i); Gperc += Ghexa.get(i); Cperc += Chexa.get(i); //lt.writeInt(counthexa);lt.writeInt(counthexare*6);lt.writeFloat((float)Ahexa*100/counthexare*6);lt.writeFloat((float)Thexa*100/counthexare*6);lt.writeFloat((float)Ghexa*100/counthexare*6);lt.writeFloat((float)Chexa*100/counthexare*6);lt.writeFloat((float) counthexa / totalcount);lt.writeFloat((float) counthexare*6 / seqcount);lt.writeFloat((float) counthexare*6 / bpcount); stats.printf("|hexa |" + cell(Integer.toString(counthexa.get(i)), 7) + "|" + cell(Integer.toString(counthexare.get(i) * 6), 12) + "|%s|%s|%s|%s|" + cell((float) counthexa.get(i) / totalcount, 15) + "|" + cell((float) counthexare.get(i) * 6 / seqcount, 15) + "|" + cell((float) counthexare.get(i) * 6 / bpcount, 15) + "|\n", cell((float) (Ahexa.get(i) * 100) / (counthexare.get(i) * 6), 7), cell((float) (Thexa.get(i) * 100) / (counthexare.get(i) * 6), 7), cell((float) (Chexa.get(i) * 100) / (counthexare.get(i) * 6), 7), cell((float) (Ghexa.get(i) * 100) / (counthexare.get(i) * 6), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>hexa</b></td><td>" + counthexa.get(i) + "</td><td>" + (6 * counthexare.get(i)) + "</td><td>" + round.format( (float) (Ahexa.get(i) * 100) / (6 * counthexare.get(i))) + "</td><td>" + round.format( (float) (Thexa.get(i) * 100) / (6 * counthexare.get(i))) + "</td><td>" + round.format( (float) (Chexa.get(i) * 100) / (6 * counthexare.get(i))) + "</td><td>" + round.format( (float) (Ghexa.get(i) * 100) / (6 * counthexare.get(i))) + "</td><td>" + round.format((float) counthexa.get(i) / totalcount) + "</td><td>" + round.format((float) 6 * counthexare.get(i) / seqcount) + "</td><td>" + round.format((float) 6 * counthexare.get(i) / bpcount) + "</td></tr>"); } if (mono.isSelected()) { relfreq += (float) countmono.get(i) / totalcount; abfreq += (float) countmonore.get(i) / bpcount; } if (di.isSelected()) { relfreq += (float) countdi.get(i) / totalcount; abfreq += (float) countdire.get(i) * 2 / bpcount; } if (tri.isSelected()) { relfreq += (float) counttri.get(i) / totalcount; abfreq += (float) counttrire.get(i) * 3 / bpcount; } if (tetra.isSelected()) { relfreq += (float) counttetra.get(i) / totalcount; abfreq += (float) counttetrare.get(i) * 4 / bpcount; } if (penta.isSelected()) { relfreq += (float) countpenta.get(i) / totalcount; abfreq += (float) countpentare.get(i) * 5 / bpcount; } if (hexa.isSelected()) { relfreq += (float) counthexa.get(i) / totalcount; abfreq += (float) counthexare.get(i) * 6 / bpcount; } Globals.A = Aperc; Globals.T = Tperc; Globals.G = Gperc; Globals.C = Cperc; lt.writeLong(seqcount); lt.writeInt(totalcount); lt.writeLong(bpcount); lt.writeInt(Aperc); lt.writeInt(Tperc); lt.writeInt(Gperc); lt.writeInt(Cperc); stats.println("|TOTAL |" + cell(Integer.toString(totalcount), 7) + "|" + cell(Long.toString(bpcount), 12) + "|" + cell((float) Aperc * 100 / bpcount, 7) + "|" + cell((float) Tperc * 100 / bpcount, 7) + "|" + cell((float) Cperc * 100 / bpcount, 7) + "|" + cell((float) Gperc * 100 / bpcount, 7) + "|" + cell(relfreq, 15) + "|" + cell((float) bpcount / seqcount, 15) + "|" + cell((float) abfreq, 15) + "|"); stats.println( "|_______|_______|____________|_______|_______|_______|_______|_______________|_______________|_______________|"); stats.println("Genome length (bp): " + seqcount); stats.println("Relative Frequency: Count of each motif type / total SSR count"); stats.println("Abundance: bp of each motif type / total sequence bp"); stats.println( "Relative Abundance: bp of each motif type / total microsatellites bp"); stats.println(); stats.println(); stats.close(); lt.close(); html.println("<tr><td><b>TOTAL</b></td><td>" + totalcount + "</td><td>" + bpcount + "</td><td>" + round.format((float) Aperc * 100 / bpcount) + "</td><td>" + round.format((float) Tperc * 100 / bpcount) + "</td><td>" + round.format((float) Cperc * 100 / bpcount) + "</td><td>" + round.format((float) Gperc * 100 / bpcount) + "</td><td>" + round.format((float) relfreq) + "</td><td>" + round.format((float) bpcount / seqcount) + "</td><td>" + round.format((float) abfreq) + "</td></tr></table></html>"); html.close(); // it = map.keySet().iterator(); for (String key : map.keySet()) { map.get(key).refresh(); } List<String> n1 = new ArrayList<String>(); List<String> n2 = new ArrayList<String>(); List<String> n3 = new ArrayList<String>(); List<String> n4 = new ArrayList<String>(); List<String> n5 = new ArrayList<String>(); List<String> n6 = new ArrayList<String>(); Iterator<String> it = map.keySet().iterator(); while (it.hasNext()) { String next = it.next(); int len = next.length(); if (len == 1) n1.add(next); else if (len == 2) n2.add(next); else if (len == 3) n3.add(next); else if (len == 4) n4.add(next); else if (len == 5) n5.add(next); else if (len == 6) n6.add(next); } Collections.sort(n1); Collections.sort(n2); Collections.sort(n3); Collections.sort(n4); Collections.sort(n5); Collections.sort(n6); boolean[] id1 = new boolean[n1.size()]; boolean[] id2 = new boolean[n2.size()]; boolean[] id3 = new boolean[n3.size()]; boolean[] id4 = new boolean[n4.size()]; boolean[] id5 = new boolean[n5.size()]; boolean[] id6 = new boolean[n6.size()]; motifhtml.println("<html><head><title>Motif Statistics</title></head><body>"); int stand = checkStandardize(); // stand=2; debug if (stand == 0) { motifstats.println("**** Not Standardized ****"); motifhtml.println("<h1>**** Not Standardized ****</h1>"); Arrays.fill(id1, true); Arrays.fill(id2, true); Arrays.fill(id3, true); Arrays.fill(id4, true); Arrays.fill(id5, true); Arrays.fill(id6, true); } else { if (stand == 1) { motifstats.println("**** Partially Standardized ****"); motifhtml.println("<h1>**** Partially Standardized ****</h1>"); matrix = new parser(1); } if (stand == 2) { motifstats.println("**** Fully Standardized ****"); motifhtml.println("<h1>**** Fully Standardized ****</h1>"); matrix = new parser(2); } Arrays.fill(id1, true); Arrays.fill(id2, true); Arrays.fill(id3, true); Arrays.fill(id4, true); Arrays.fill(id5, true); Arrays.fill(id6, true); for (int n = 0; n < n1.size(); n++) { int id = -2; id = matrix.SearchMap(1, n1.get(n)); if (id >= 0) { int found = matrix.checkFound(1, id); if (found >= 0) { map.get(n1.get(found)).merge(map.get(n1.get(n))); id1[n] = false; // gia clean twn listwn apo merged TODO * } if (found == -4) { matrix.makeFound(1, id, n); } } } for (int n = 0; n < n2.size(); n++) { int id = -2; id = matrix.SearchMap(2, n2.get(n)); if (id >= 0) { int found = matrix.checkFound(2, id); if (found >= 0) { map.get(n2.get(found)).merge(map.get(n2.get(n))); id2[n] = false; // gia clean twn listwn apo merged TODO * } else { matrix.makeFound(2, id, n); id2[n] = true; } } } for (int n = 0; n < n3.size(); n++) { int id = -2; id = matrix.SearchMap(3, n3.get(n)); if (id >= 0) { int found = matrix.checkFound(3, id); if (found >= 0) { map.get(n3.get(found)).merge(map.get(n3.get(n))); id3[n] = false; // gia clean twn listwn apo merged TODO * } else { matrix.makeFound(3, id, n); id3[n] = true; } } } for (int n = 0; n < n4.size(); n++) { int id = -2; id = matrix.SearchMap(4, n4.get(n)); if (id >= 0) { int found = matrix.checkFound(4, id); if (found >= 0) { map.get(n4.get(found)).merge(map.get(n4.get(n))); id4[n] = false; // gia clean twn listwn apo merged TODO * } else { matrix.makeFound(4, id, n); id4[n] = true; } } } for (int n = 0; n < n5.size(); n++) { int id = -2; id = matrix.SearchMap(5, n5.get(n)); if (id >= 0) { int found = matrix.checkFound(5, id); if (found >= 0) { map.get(n5.get(found)).merge(map.get(n5.get(n))); id5[n] = false; // gia clean twn listwn apo merged TODO * } else { matrix.makeFound(5, id, n); id5[n] = true; } } } for (int n = 0; n < n6.size(); n++) { int id = -2; id = matrix.SearchMap(6, n6.get(n)); if (id >= 0) { int found = matrix.checkFound(6, id); if (found >= 0) { map.get(n6.get(found)).merge(map.get(n6.get(n))); id6[n] = false; // gia clean twn listwn apo merged TODO * } else { matrix.makeFound(6, id, n); id6[n] = true; } } } } for (String key : map.keySet()) { map.get(key).refresh(); } motifstats.println( " Motif Count Repeats bp Avg_Length SD_Length Max_Length Avg_Repeats A% T% C% G% "); motifhtml.println( "<table border=\"1\"><tr><td><b>Motif</b></td><td><b>Count</b></td><td><b>Repeats</b></td><td><b>bp</b></td><td><b>Avg_Length</b></td><td><b>SD_Length</b></td><td><b>Max_Length</b></td><td><b>Avg_Repeats</b></td><td><b>A%</b></td><td><b>T%</b></td><td><b>C%</b></td><td><b>G%</b></td></tr>"); if (mono.isSelected()) { for (int z = 0; z < n1.size(); z++) { if (id1[z] && !map.get(n1.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n1.get(z)).toString()); motifhtml.println(map.get(n1.get(z)).toHTML()); } } } if (di.isSelected()) { for (int z = 0; z < n2.size(); z++) { if (id2[z] && !map.get(n2.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n2.get(z)).toString()); motifhtml.println(map.get(n2.get(z)).toHTML()); } } } if (tri.isSelected()) { for (int z = 0; z < n3.size(); z++) { if (id3[z] && !map.get(n3.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n3.get(z)).toString()); motifhtml.println(map.get(n3.get(z)).toHTML()); } } } if (tetra.isSelected()) { for (int z = 0; z < n4.size(); z++) { if (id4[z] && !map.get(n4.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n4.get(z)).toString()); motifhtml.println(map.get(n4.get(z)).toHTML()); } } } if (penta.isSelected()) { for (int z = 0; z < n5.size(); z++) { if (id5[z] && !map.get(n5.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n5.get(z)).toString()); motifhtml.println(map.get(n5.get(z)).toHTML()); } } } if (hexa.isSelected()) { for (int z = 0; z < n6.size(); z++) { if (id6[z] && !map.get(n6.get(z)).getMotif().contains("N")) { motifstats.println(map.get(n6.get(z)).toString()); motifhtml.println(map.get(n6.get(z)).toHTML()); } } } motifstats.close(); motifhtml.println("</table></body></html>"); motifhtml.close(); Runtime.getRuntime().exec("notepad " + location2); } } catch (FileNotFoundException ex) { //msg.showMessageDialog(paneldown, "Update your selected species", "Error", JOptionPane.ERROR_MESSAGE); Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { msg.showMessageDialog(paneldown, "Minimum length requires an Integer", "Error", JOptionPane.ERROR_MESSAGE); } } else { msg.showMessageDialog(paneldown, "Please fill in the minimum length (Integers only)", "Error", JOptionPane.ERROR_MESSAGE); } } if (box2.isSelected()) { boolean gapisnumber = false; boolean minisnumber = false; int gap = 0; int min = 0; try { gap = Integer.parseInt(max.getText()); gapisnumber = true; } catch (NumberFormatException ex) { gapisnumber = false; } try { min = Integer.parseInt(minpregap.getText()); minisnumber = true; } catch (NumberFormatException ex) { minisnumber = false; } if (gapisnumber && minisnumber) { try { getImPerfectSSRs(organisms, min, flag, gap); for (int i = 0; i < organisms.length; i++) { PrintWriter stats = null; PrintWriter html = null; String location = ""; // 18/11/2013 added starting here String filetype = ""; String filepro = ""; if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } //List<String> files = getFiles(organisms[i], minlen, flag); // 18/11/2013 added ending here PrintWriter out = null; DataOutputStream lt = null; if (filetype.contains("organisms")) { File f = new File("organisms/" + organisms[i] + "/stats/"); if (!f.exists()) { f.mkdir(); } stats = new PrintWriter(new FileWriter( "organisms/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); lt = new DataOutputStream(new BufferedOutputStream( new FileOutputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".imperf"))); html = new PrintWriter(new FileWriter( "organisms/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); File fi = new File("organisms/" + organisms[i] + "/results/"); if (!fi.exists()) { fi.mkdir(); } String toopen = "organisms/" + organisms[i] + "/results/allImPerfect_" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; location = toopen; out = new PrintWriter(toopen); out.println("Results for organism: " + organisms[i] + "\t Search Parameters --> Maximum Mismatch length for ImPerfect SSRs : " + gap + " minimum SSR length before given gap: " + min); } else if (filetype.contains("local")) { File f = new File("local/" + organisms[i] + "/stats/"); if (!f.exists()) { f.mkdir(); } stats = new PrintWriter(new FileWriter( "local/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt", true)); lt = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".imperf"))); html = new PrintWriter(new FileWriter( "local/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".html", true)); File fi = new File("local/" + organisms[i] + "/results/"); if (!fi.exists()) { fi.mkdir(); } String toopen = "local/" + organisms[i] + "/results/allImPerfect_" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; location = toopen; out = new PrintWriter(toopen); out.println("Results for project: " + organisms[i] + "\t Search Parameters --> Maximum Mismatch length for ImPerfect SSRs : " + gap + " minimum SSR length before given gap: " + min); } if (mono.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_monoImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } if (di.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_diImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } if (tri.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_triImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } if (tetra.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_tetraImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } if (penta.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_pentaImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } if (hexa.isSelected()) { // 18/11/2013 added starting here if (flag) { filetype = "organisms"; filepro = "organisms/" + organisms[i] + "/data/"; int ret = getOrganismStatus(organisms[i]); if (ret == -1) indexer = new Indexer(chromosomelist); else indexer = new Indexer(ret); } else { filetype = "local"; filepro = "local/" + organisms[i] + "/data/"; String indexfile = "local/" + organisms[i] + "/index.txt"; indexer = new Indexer(indexfile); } while (indexer.hasNext()) { String files = filepro + indexer.getNextFileName(); DataInputStream in = new DataInputStream( new BufferedInputStream(new FileInputStream( files + "_" + min + "_" + gap + "_hexaImPerfect.temp"))); boolean eof = false; while (!eof) { try { String ssr = in.readUTF(); int start = in.readInt(); int end = in.readInt(); if (!ssr.contains("N")) out.println("SSR: " + ssr + " start-end " + start + "-" + end + " Path(../data/chromosome): " + files.substring(0, files.lastIndexOf('.'))); } catch (EOFException exc) { eof = true; } } in.close(); } } out.close(); Runtime.getRuntime().exec("notepad " + location); DecimalFormat round = new DecimalFormat("#.###"); html.println("<html><h1>******* ImPerfect SSRs *******</h1>"); html.println("<h4>Results for project: " + organisms[i] + "</h4><h4>Search Parameters --> Maximum Mismatch length for ImPerfect SSRs (bp): " + gap + "</h4><h4>minimum SSR length before given Mismatch length (bp): " + min + "</h4>"); html.println( "<table border=\"1\"><tr><td><b>motif</b></td><td><b>count</b></td><td><b>bp</b></td><td><b>A%</b></td><td><b>T%</b></td><td><b>C%</b></td><td><b>G%</b></td><td><b>Relative Frequency</b></td><td><b>Abundance</b></td><td><b>Relative Abundance</b></td></tr>"); stats.println("******* ImPerfect SSRs *******"); stats.println("Results for project: " + organisms[i] + "\n Search Parameters --> Maximum Mismatch length for ImPerfect SSRs (bp): " + gap + " \nminimum SSR length before given Mismatch length (bp): " + min); stats.println( " ____________________________________________________________________________________________________________ "); stats.println( "| | | | | | | | Relative | | Relative |"); stats.println( "| motif | count | bp | A% | T% | C% | G% | Frequency | Abundance | Abundance |"); stats.println( "|=======|=======|============|=======|=======|=======|=======|===============|===============|===============|"); int totalcount = 0; long bpcount = 0; int Aperc = 0; int Tperc = 0; int Gperc = 0; int Cperc = 0; float relfreq = 0; float abfreq = 0; long seqcount = 0; if (mono.isSelected()) { totalcount += countmono.get(i); bpcount += countmonore.get(i); } if (di.isSelected()) { totalcount += countdi.get(i); bpcount += countdire.get(i); } if (tri.isSelected()) { totalcount += counttri.get(i); bpcount += counttrire.get(i); } if (tetra.isSelected()) { totalcount += counttetra.get(i); bpcount += counttetrare.get(i); } if (penta.isSelected()) { totalcount += countpenta.get(i); bpcount += countpentare.get(i); } if (hexa.isSelected()) { totalcount += counthexa.get(i); bpcount += counthexare.get(i); } try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } Connection con = null; try { con = DriverManager.getConnection("jdbc:mysql://localhost:3306", "biouser", "thesis2012"); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } Statement st = null; try { st = con.createStatement(); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } st.executeUpdate("use lobid"); seqcount = 0; if (filetype.contains("organisms")) { ResultSet rs = st.executeQuery( "SELECT end FROM slices INNER JOIN organism WHERE slices.org_id=organism.org_id AND organism.name='" + organisms[i] + "'"); while (rs.next()) { seqcount += Long.parseLong(rs.getString(1)); } } else if (filetype.contains("local")) { BufferedReader in = new BufferedReader( new FileReader("local/" + organisms[i] + "/index.txt")); int count = countlines("local/" + organisms[i] + "/index.txt"); for (int c = 0; c < count; c++) { String temp = in.readLine(); BufferedReader tmp = new BufferedReader( new FileReader("local/" + organisms[i] + "/" + temp + ".txt")); boolean eof = false; while (!eof) { String s = tmp.readLine(); if (s != null) { seqcount += s.length(); } else { eof = true; } } tmp.close(); } } int tempmono = countmonore.get(i); int tempdi = countdire.get(i); int temptri = counttrire.get(i); int temptetra = counttetrare.get(i); int temppenta = countpentare.get(i); int temphexa = counthexare.get(i); if (tempmono == 0) tempmono = 1; if (tempdi == 0) tempdi = 1; if (temptri == 0) temptri = 1; if (temptetra == 0) temptetra = 1; if (temppenta == 0) temppenta = 1; if (temphexa == 0) temphexa = 1; if (mono.isSelected()) { Aperc += Amono.get(i); Tperc += Tmono.get(i); Gperc += Gmono.get(i); Cperc += Cmono.get(i); //lt.writeInt(countmono.get(i));lt.writeInt(countmonore.get(i));lt.writeFloat((float)Amono.get(i)*100/tempmono);lt.writeFloat((float)Tmono.get(i)*100/tempmono);lt.writeFloat((float)Gmono.get(i)*100/tempmono);lt.writeFloat((float)Cmono.get(i)*100/tempmono);lt.writeFloat((float) countmono.get(i) / totalcount);lt.writeFloat((float) countmonore.get(i) / seqcount);lt.writeFloat((float) countmonore.get(i) / bpcount); stats.printf("|mono |" + cell(Integer.toString(countmono.get(i)), 7) + "|" + cell(Integer.toString(countmonore.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) countmono.get(i) / totalcount, 15) + "|" + cell((float) countmonore.get(i) / seqcount, 15) + "|" + cell((float) countmonore.get(i) / bpcount, 15) + "|\n", cell((float) (Amono.get(i) * 100) / (tempmono), 7), cell((float) (Tmono.get(i) * 100) / (tempmono), 7), cell((float) (Cmono.get(i) * 100) / (tempmono), 7), cell((float) (Gmono.get(i) * 100) / (tempmono), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>mono</b></td><td>" + countmono.get(i) + "</td><td>" + (countmonore.get(i)) + "</td><td>" + round.format((float) (Amono.get(i) * 100) / (tempmono)) + "</td><td>" + round.format((float) (Tmono.get(i) * 100) / (tempmono)) + "</td><td>" + round.format((float) (Cmono.get(i) * 100) / (tempmono)) + "</td><td>" + round.format((float) (Gmono.get(i) * 100) / (tempmono)) + "</td><td>" + round.format((float) countmono.get(i) / totalcount) + "</td><td>" + round.format((float) countmonore.get(i) / seqcount) + "</td><td>" + round.format((float) countmonore.get(i) / bpcount) + "</td></tr>"); } if (di.isSelected()) { Aperc += Adi.get(i); Tperc += Tdi.get(i); Gperc += Gdi.get(i); Cperc += Cdi.get(i); //lt.writeInt(countdi.get(i));lt.writeInt(countdi.get(i)re.get(i));lt.writeFloat((float)Adi.get(i)*100/tempdi);lt.writeFloat((float)Tdi.get(i)*100/tempdi);lt.writeFloat((float)Gdi.get(i)*100/tempdi);lt.writeFloat((float)Cdi.get(i)*100/tempdi);lt.writeFloat((float) countdi.get(i) / totalcount);lt.writeFloat((float) countdi.get(i)re.get(i) / seqcount);lt.writeFloat((float) countdi.get(i)re.get(i) / bpcount); stats.printf( "|di |" + cell(Integer.toString(countdi.get(i)), 7) + "|" + cell(Integer.toString(countdire.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) countdi.get(i) / totalcount, 15) + "|" + cell((float) countdi.get(i) / seqcount, 15) + "|" + cell((float) countdi.get(i) / bpcount, 15) + "|\n", cell((float) (Adi.get(i) * 100) / (tempdi), 7), cell((float) (Tdi.get(i) * 100) / (tempdi), 7), cell((float) (Cdi.get(i) * 100) / (tempdi), 7), cell((float) (Gdi.get(i) * 100) / (tempdi), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>di</b></td><td>" + countdi.get(i) + "</td><td>" + (countdire.get(i)) + "</td><td>" + round.format((float) (Adi.get(i) * 100) / (tempdi)) + "</td><td>" + round.format((float) (Tdi.get(i) * 100) / (tempdi)) + "</td><td>" + round.format((float) (Cdi.get(i) * 100) / (tempdi)) + "</td><td>" + round.format((float) (Gdi.get(i) * 100) / (tempdi)) + "</td><td>" + round.format((float) countdi.get(i) / totalcount) + "</td><td>" + round.format((float) countdire.get(i) / seqcount) + "</td><td>" + round.format((float) countdire.get(i) / bpcount) + "</td></tr>"); } if (tri.isSelected()) { Aperc += Atri.get(i); Tperc += Ttri.get(i); Gperc += Gtri.get(i); Cperc += Ctri.get(i); //lt.writeInt(counttri.get(i));lt.writeInt(counttrire.get(i).get(i));lt.writeFloat((float)Atri.get(i)*100/temptri);lt.writeFloat((float)Ttri.get(i)*100/temptri);lt.writeFloat((float)Gtri.get(i)*100/temptri);lt.writeFloat((float)Ctri.get(i)*100/temptri);lt.writeFloat((float) counttri.get(i) / totalcount);lt.writeFloat((float) counttrire.get(i).get(i) / seqcount);lt.writeFloat((float) counttrire.get(i).get(i) / bpcount); stats.printf("|tri |" + cell(Integer.toString(counttri.get(i)), 7) + "|" + cell(Integer.toString(counttrire.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) counttri.get(i) / totalcount, 15) + "|" + cell((float) counttrire.get(i) / seqcount, 15) + "|" + cell((float) counttrire.get(i) / bpcount, 15) + "|\n", cell((float) (Atri.get(i) * 100) / (temptri), 7), cell((float) (Ttri.get(i) * 100) / (temptri), 7), cell((float) (Ctri.get(i) * 100) / (temptri), 7), cell((float) (Gtri.get(i) * 100) / (temptri), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>tri</b></td><td>" + counttri.get(i) + "</td><td>" + (counttrire.get(i)) + "</td><td>" + round.format((float) (Atri.get(i) * 100) / (temptri)) + "</td><td>" + round.format((float) (Ttri.get(i) * 100) / (temptri)) + "</td><td>" + round.format((float) (Ctri.get(i) * 100) / (temptri)) + "</td><td>" + round.format((float) (Gtri.get(i) * 100) / (temptri)) + "</td><td>" + round.format((float) counttri.get(i) / totalcount) + "</td><td>" + round.format((float) counttrire.get(i) / seqcount) + "</td><td>" + round.format((float) counttrire.get(i) / bpcount) + "</td></tr>"); } if (tetra.isSelected()) { Aperc += Atetra.get(i); Tperc += Ttetra.get(i); Gperc += Gtetra.get(i); Cperc += Ctetra.get(i); //lt.writeInt(counttetra.get(i));lt.writeInt(counttetrare.get(i));lt.writeFloat((float)Atetra.get(i)*100/temptetra);lt.writeFloat((float)Ttetra.get(i)*100/temptetra);lt.writeFloat((float)Gtetra.get(i)*100/temptetra);lt.writeFloat((float)Ctetra.get(i)*100/temptetra);lt.writeFloat((float) counttetra.get(i) / totalcount);lt.writeFloat((float) counttetrare.get(i) / seqcount);lt.writeFloat((float) counttetrare.get(i) / bpcount); stats.printf("|tetra |" + cell(Integer.toString(counttetra.get(i)), 7) + "|" + cell(Integer.toString(counttetrare.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) counttetra.get(i) / totalcount, 15) + "|" + cell((float) counttetrare.get(i) / seqcount, 15) + "|" + cell((float) counttetrare.get(i) / bpcount, 15) + "|\n", cell((float) (Atetra.get(i) * 100) / (temptetra), 7), cell((float) (Ttetra.get(i) * 100) / (temptetra), 7), cell((float) (Ctetra.get(i) * 100) / (temptetra), 7), cell((float) (Gtetra.get(i) * 100) / (temptetra), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>tetra</b></td><td>" + counttetra.get(i) + "</td><td>" + (counttetrare.get(i)) + "</td><td>" + round.format((float) (Atetra.get(i) * 100) / (temptetra)) + "</td><td>" + round.format((float) (Ttetra.get(i) * 100) / (temptetra)) + "</td><td>" + round.format((float) (Ctetra.get(i) * 100) / (temptetra)) + "</td><td>" + round.format((float) (Gtetra.get(i) * 100) / (temptetra)) + "</td><td>" + round.format((float) counttetra.get(i) / totalcount) + "</td><td>" + round.format((float) counttetrare.get(i) / seqcount) + "</td><td>" + round.format((float) counttetrare.get(i) / bpcount) + "</td></tr>"); } if (penta.isSelected()) { Aperc += Apenta.get(i); Tperc += Tpenta.get(i); Gperc += Gpenta.get(i); Cperc += Cpenta.get(i); //lt.writeInt(countpenta.get(i));lt.writeInt(countpentare.get(i));lt.writeFloat((float)Apenta.get(i)*100/temppenta);lt.writeFloat((float)Tpenta.get(i)*100/temppenta);lt.writeFloat((float)Gpenta.get(i)*100/temppenta);lt.writeFloat((float)Cpenta.get(i)*100/temppenta);lt.writeFloat((float) countpenta.get(i) / totalcount);lt.writeFloat((float) countpentare.get(i) / seqcount);lt.writeFloat((float) countpentare.get(i) / bpcount); stats.printf("|penta |" + cell(Integer.toString(countpenta.get(i)), 7) + "|" + cell(Integer.toString(countpentare.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) countpenta.get(i) / totalcount, 15) + "|" + cell((float) countpentare.get(i) / seqcount, 15) + "|" + cell((float) countpentare.get(i) / bpcount, 15) + "|\n", cell((float) (Apenta.get(i) * 100) / (temppenta), 7), cell((float) (Tpenta.get(i) * 100) / (temppenta), 7), cell((float) (Cpenta.get(i) * 100) / (temppenta), 7), cell((float) (Gpenta.get(i) * 100) / (temppenta), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>penta</b></td><td>" + countpenta.get(i) + "</td><td>" + (countpentare.get(i)) + "</td><td>" + round.format((float) (Apenta.get(i) * 100) / (temppenta)) + "</td><td>" + round.format((float) (Tpenta.get(i) * 100) / (temppenta)) + "</td><td>" + round.format((float) (Cpenta.get(i) * 100) / (temppenta)) + "</td><td>" + round.format((float) (Gpenta.get(i) * 100) / (temppenta)) + "</td><td>" + round.format((float) countpenta.get(i) / totalcount) + "</td><td>" + round.format((float) countpentare.get(i) / seqcount) + "</td><td>" + round.format((float) countpentare.get(i) / bpcount) + "</td></tr>"); } if (hexa.isSelected()) { Aperc += Ahexa.get(i); Tperc += Thexa.get(i); Gperc += Ghexa.get(i); Cperc += Chexa.get(i); //lt.writeInt(counthexa.get(i));lt.writeInt(counthexare.get(i));lt.writeFloat((float)Ahexa.get(i)*100/temphexa);lt.writeFloat((float)Thexa.get(i)*100/temphexa);lt.writeFloat((float)Ghexa.get(i)*100/temphexa);lt.writeFloat((float)Chexa.get(i)*100/temphexa);lt.writeFloat((float) counthexa.get(i) / totalcount);lt.writeFloat((float) counthexare.get(i) / seqcount);lt.writeFloat((float) counthexare.get(i) / bpcount); stats.printf("|hexa |" + cell(Integer.toString(counthexa.get(i)), 7) + "|" + cell(Integer.toString(counthexare.get(i)), 12) + "|%s|%s|%s|%s|" + cell((float) counthexa.get(i) / totalcount, 15) + "|" + cell((float) counthexare.get(i) / seqcount, 15) + "|" + cell((float) counthexare.get(i) / bpcount, 15) + "|\n", cell((float) (Ahexa.get(i) * 100) / (temphexa), 7), cell((float) (Thexa.get(i) * 100) / (temphexa), 7), cell((float) (Chexa.get(i) * 100) / (temphexa), 7), cell((float) (Ghexa.get(i) * 100) / (temphexa), 7)); stats.println( "|-------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>hexa</b></td><td>" + counthexa.get(i) + "</td><td>" + (counthexare.get(i)) + "</td><td>" + round.format((float) (Ahexa.get(i) * 100) / (temphexa)) + "</td><td>" + round.format((float) (Thexa.get(i) * 100) / (temphexa)) + "</td><td>" + round.format((float) (Chexa.get(i) * 100) / (temphexa)) + "</td><td>" + round.format((float) (Ghexa.get(i) * 100) / (temphexa)) + "</td><td>" + round.format((float) counthexa.get(i) / totalcount) + "</td><td>" + round.format((float) counthexare.get(i) / seqcount) + "</td><td>" + round.format((float) counthexare.get(i) / bpcount) + "</td></tr>"); } if (mono.isSelected()) { relfreq += (float) countmono.get(i) / totalcount; abfreq += (float) countmonore.get(i) / bpcount; } if (di.isSelected()) { relfreq += (float) countdi.get(i) / totalcount; abfreq += (float) countdire.get(i) / bpcount; } if (tri.isSelected()) { relfreq += (float) counttri.get(i) / totalcount; abfreq += (float) counttrire.get(i) / bpcount; } if (tetra.isSelected()) { relfreq += (float) counttetra.get(i) / totalcount; abfreq += (float) counttetrare.get(i) / bpcount; } if (penta.isSelected()) { relfreq += (float) countpenta.get(i) / totalcount; abfreq += (float) countpentare.get(i) / bpcount; } if (hexa.isSelected()) { relfreq += (float) counthexa.get(i) / totalcount; abfreq += (float) counthexare.get(i) / bpcount; } lt.writeLong(seqcount); lt.writeInt(totalcount); lt.writeLong(bpcount); lt.writeInt(Aperc); lt.writeInt(Tperc); lt.writeInt(Gperc); lt.writeInt(Cperc); stats.println("|TOTAL |" + cell(Integer.toString(totalcount), 7) + "|" + cell(Long.toString(bpcount), 12) + "|" + cell((float) Aperc * 100 / bpcount, 7) + "|" + cell((float) Tperc * 100 / bpcount, 7) + "|" + cell((float) Cperc * 100 / bpcount, 7) + "|" + cell((float) Gperc * 100 / bpcount, 7) + "|" + cell(relfreq, 15) + "|" + cell((float) bpcount / seqcount, 15) + "|" + cell((float) abfreq, 15) + "|"); stats.println( "|_______|_______|____________|_______|_______|_______|_______|_______________|_______________|_______________|"); stats.println("Genome length (bp): " + seqcount); stats.println("Relative Frequency: Count of each motif type / total SSR count"); stats.println("Abundance: bp of each motif type / total sequence bp"); stats.println( "Relative Abundance: bp of each motif type / total microsatellites bp"); stats.println(); stats.println(); stats.close(); lt.close(); html.println("<tr><td><b>TOTAL</b></td><td>" + totalcount + "</td><td>" + bpcount + "</td><td>" + round.format((float) Aperc * 100 / bpcount) + "</td><td>" + round.format((float) Tperc * 100 / bpcount) + "</td><td>" + round.format((float) Cperc * 100 / bpcount) + "</td><td>" + round.format((float) Gperc * 100 / bpcount) + "</td><td>" + round.format((float) relfreq) + "</td><td>" + round.format((float) bpcount / seqcount) + "</td><td>" + round.format((float) abfreq) + "</td></tr></table></html>"); html.close(); } } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); //msg.showMessageDialog(paneldown, "Update your selected species", "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { if (!gapisnumber && !minisnumber) { msg.showMessageDialog(paneldown, "Fill in Mismatch length for Imperfect SSRs \n and the minimum sequence length before the Mismatch length\n (Integers only)", "Error", JOptionPane.ERROR_MESSAGE); } else { if (!gapisnumber) { msg.showMessageDialog(paneldown, "Fill in Mismatch length for Imperfect SSRs (Integer only)", "Error", JOptionPane.ERROR_MESSAGE); } if (!minisnumber) { msg.showMessageDialog(paneldown, "Fill in the minimum sequence length before the Mismatch length (Integer only)", "Error", JOptionPane.ERROR_MESSAGE); } } } } if (box3.isSelected()) { boolean lenisnumber; boolean gapisnumber; int minlen = 0; int gap = 0; if (!com.isSelected() && !incom.isSelected()) { msg.showMessageDialog(paneldown, "Select a Compound SSR Option", "Error", JOptionPane.ERROR_MESSAGE); } else { try { minlen = Integer.parseInt(score.getText()); lenisnumber = true; } catch (NumberFormatException ex) { lenisnumber = false; } try { gap = Integer.parseInt(maxgapcomp.getText()); gapisnumber = true; } catch (NumberFormatException ex) { gapisnumber = false; } if (lenisnumber && gapisnumber) { if (com.isSelected()) { try { getCompoundPerfectSSRs(organisms, minlen, flag, gap); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); //msg.showMessageDialog(paneldown, "Update your selected species", "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (incom.isSelected()) { try { getImPerfectCompoundSSRs(organisms, minlen, flag, gap); } catch (SQLException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); //msg.showMessageDialog(paneldown, "Update your selected species", "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } } else { if (!lenisnumber) { msg.showMessageDialog(paneldown, "Minimum length requires an Integer", "Error", JOptionPane.ERROR_MESSAGE); } if (!gapisnumber) { msg.showMessageDialog(paneldown, "Inter-repeat Region between compound SSRs requires an Integer", "Error", JOptionPane.ERROR_MESSAGE); } } } } if (box1.isSelected() || box2.isSelected() || box3.isSelected() || com.isSelected() || incom.isSelected()) { PrintWriter out = null; PrintWriter html = null; boolean orgs = true; DecimalFormat round = new DecimalFormat("#.###"); //String file=""; for (int i = 0; i < organisms.length; i++) { String file = "organisms/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; File stats = new File(file); if (!stats.exists()) { orgs = false; file = "local/" + organisms[i] + "/stats/" + "summary_statistics" + now.toString().replace(':', '_').replace(' ', '_') + ".txt"; } try { html = new PrintWriter( new FileWriter(file.substring(0, file.indexOf(".")) + ".html", true)); html.println("<html><h1>******* SUMMARY TABLE *******</h1>"); html.println( "<table border=\"1\"><tr><td>type</td><td><b>count</b></td><td><b>bp</b></td><td><b>A%</b></td><td><b>T%</b></td><td><b>C%</b></td><td><b>G%</b></td><td><b>Relative Frequency</b></td><td><b>Abundance</b></td><td><b>Relative Abundance</b></td></tr>"); out = new PrintWriter(new FileWriter(file, true)); out.println("******* SUMMARY TABLE *******"); out.println( " _________________________________________________________________________________________________________________ "); out.println( "| | | | | | | | Relative | | Relative |"); out.println( "| type | count | bp | A% | T% | C% | G% | Frequency | Abundance | Abundance |"); out.println( "|============|=======|============|=======|=======|=======|=======|===============|===============|===============|"); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } //TOTAL long seqcount = 0; int SSRcount = 0; int SSRbpcount = 0; int A = 0, T = 0, G = 0, C = 0; float relfreq = 0; float abfreq = 0; //perfect int pcount = 0; long pbpcount = 0; int Ap = 0, Tp = 0, Gp = 0, Cp = 0; //imperfect int imcount = 0; long imbpcount = 0; int Aim = 0, Tim = 0, Gim = 0, Cim = 0; //compound perfect int ccount = 0; long cbpcount = 0; int Ac = 0, Tc = 0, Gc = 0, Cc = 0; //compound imperfect int cicount = 0; long cibpcount = 0; int Aci = 0, Tci = 0, Gci = 0, Cci = 0; if (box1.isSelected()) { DataInputStream in = null; if (orgs) { try { in = new DataInputStream( new BufferedInputStream(new FileInputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".perf"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { try { in = new DataInputStream(new BufferedInputStream(new FileInputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".perf"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } try { seqcount = in.readLong(); pcount = in.readInt(); pbpcount = in.readLong(); Ap = in.readInt(); Tp = in.readInt(); Gp = in.readInt(); Cp = in.readInt(); A += Ap; T += Tp; G += Gp; C += Cp; SSRcount += pcount; SSRbpcount += pbpcount; in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (box2.isSelected()) { DataInputStream in = null; if (orgs) { try { in = new DataInputStream( new BufferedInputStream(new FileInputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".imperf"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { try { in = new DataInputStream(new BufferedInputStream(new FileInputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".imperf"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } try { seqcount = in.readLong(); imcount = in.readInt(); imbpcount = in.readLong(); Aim = in.readInt(); Tim = in.readInt(); Gim = in.readInt(); Cim = in.readInt(); A += Aim; T += Tim; G += Gim; C += Cim; SSRcount += imcount; SSRbpcount += imbpcount; in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (box3.isSelected()) { if (com.isSelected()) { DataInputStream in = null; if (orgs) { try { in = new DataInputStream(new BufferedInputStream( new FileInputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".compp"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { try { in = new DataInputStream(new BufferedInputStream( new FileInputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".compp"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } try { seqcount = in.readLong(); ccount = in.readInt(); cbpcount = in.readInt(); Ac = in.readInt(); Tc = in.readInt(); Gc = in.readInt(); Cc = in.readInt(); A += Ac; T += Tc; G += Gc; C += Cc; SSRcount += ccount; SSRbpcount += cbpcount; in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } if (incom.isSelected()) { DataInputStream in = null; if (orgs) { try { in = new DataInputStream(new BufferedInputStream( new FileInputStream("organisms/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".compim"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } else { try { in = new DataInputStream(new BufferedInputStream( new FileInputStream("local/" + organisms[i] + "/data/" + now.toString().replace(':', '_').replace(' ', '_') + ".compim"))); } catch (FileNotFoundException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } try { seqcount = in.readLong(); cicount = in.readInt(); cibpcount = in.readInt(); Aci = in.readInt(); Tci = in.readInt(); Gci = in.readInt(); Cci = in.readInt(); A += Aci; T += Tci; G += Gci; C += Cci; SSRcount += cicount; SSRbpcount += cibpcount; in.close(); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } } if (box1.isSelected()) { relfreq += (float) pcount / SSRcount; abfreq += (float) pbpcount / SSRbpcount; out.printf( "|Perfect |" + cell(Integer.toString(pcount), 7) + "|" + cell(Long.toString(pbpcount), 12) + "|%s|%s|%s|%s|" + cell((float) pcount / SSRcount, 15) + "|" + cell((float) pbpcount / seqcount, 15) + "|" + cell((float) pbpcount / SSRbpcount, 15) + "|\n", cell((float) (Ap * 100) / (SSRbpcount), 7), cell((float) (Tp * 100) / (SSRbpcount), 7), cell((float) (Cp * 100) / (SSRbpcount), 7), cell((float) (Gp * 100) / (SSRbpcount), 7)); out.println( "|------------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>Perfect</b></td><td>" + pcount + "</td><td>" + pbpcount + "</td><td>" + round.format((float) Ap * 100 / SSRbpcount) + "</td><td>" + round.format((float) Tp * 100 / SSRbpcount) + "</td><td>" + round.format((float) Cp * 100 / SSRbpcount) + "</td><td>" + round.format((float) Gp * 100 / SSRbpcount) + "</td><td>" + round.format((float) pcount / SSRcount) + "</td><td>" + round.format((float) pbpcount / seqcount) + "</td><td>" + round.format((float) pbpcount / SSRbpcount) + "</td></tr>"); } if (box2.isSelected()) { relfreq += (float) imcount / SSRcount; abfreq += (float) imbpcount / SSRbpcount; out.printf( "|Imperfect |" + cell(Integer.toString(imcount), 7) + "|" + cell(Long.toString(imbpcount), 12) + "|%s|%s|%s|%s|" + cell((float) imcount / SSRcount, 15) + "|" + cell((float) imbpcount / seqcount, 15) + "|" + cell((float) imbpcount / SSRbpcount, 15) + "|\n", cell((float) (Aim * 100) / (SSRbpcount), 7), cell((float) (Tim * 100) / (SSRbpcount), 7), cell((float) (Cim * 100) / (SSRbpcount), 7), cell((float) (Gim * 100) / (SSRbpcount), 7)); out.println( "|------------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>Imperfect</b></td><td>" + imcount + "</td><td>" + imbpcount + "</td><td>" + round.format((float) Aim * 100 / SSRbpcount) + "</td><td>" + round.format((float) Tim * 100 / SSRbpcount) + "</td><td>" + round.format((float) Cim * 100 / SSRbpcount) + "</td><td>" + round.format((float) Gim * 100 / SSRbpcount) + "</td><td>" + round.format((float) imcount / SSRcount) + "</td><td>" + round.format((float) imbpcount / seqcount) + "</td><td>" + round.format((float) imbpcount / SSRbpcount) + "</td></tr>"); } if (box3.isSelected()) { if (com.isSelected()) { abfreq += (float) cbpcount / SSRbpcount; relfreq += (float) ccount / SSRcount; out.printf( "|Compound Per|" + cell(Integer.toString(ccount), 7) + "|" + cell(Long.toString(cbpcount), 12) + "|%s|%s|%s|%s|" + cell((float) ccount / SSRcount, 15) + "|" + cell((float) cbpcount / seqcount, 15) + "|" + cell((float) cbpcount / SSRbpcount, 15) + "|\n", cell((float) (Ac * 100) / (SSRbpcount), 7), cell((float) (Tc * 100) / (SSRbpcount), 7), cell((float) (Cc * 100) / (SSRbpcount), 7), cell((float) (Gc * 100) / (SSRbpcount), 7)); out.println( "|------------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>Compound Perf.</b></td><td>" + ccount + "</td><td>" + cbpcount + "</td><td>" + round.format((float) Ac * 100 / SSRbpcount) + "</td><td>" + round.format((float) Tc * 100 / SSRbpcount) + "</td><td>" + round.format((float) Cc * 100 / SSRbpcount) + "</td><td>" + round.format((float) Gc * 100 / SSRbpcount) + "</td><td>" + round.format((float) ccount / SSRcount) + "</td><td>" + round.format((float) cbpcount / seqcount) + "</td><td>" + round.format((float) cbpcount / SSRbpcount) + "</td></tr>"); } if (incom.isSelected()) { abfreq += (float) cibpcount / SSRbpcount; relfreq += (float) cicount / SSRcount; out.printf( "|Compound Imp|" + cell(Integer.toString(cicount), 7) + "|" + cell(Long.toString(cibpcount), 12) + "|%s|%s|%s|%s|" + cell((float) cicount / SSRcount, 15) + "|" + cell((float) cibpcount / seqcount, 15) + "|" + cell((float) cibpcount / SSRbpcount, 15) + "|\n", cell((float) (Aci * 100) / (SSRbpcount), 7), cell((float) (Tci * 100) / (SSRbpcount), 7), cell((float) (Cci * 100) / (SSRbpcount), 7), cell((float) (Gci * 100) / (SSRbpcount), 7)); out.println( "|------------|-------|------------|-------|-------|-------|-------|---------------|---------------|---------------|"); html.println("<tr><td><b>Compound Imperf.</b></td><td>" + cicount + "</td><td>" + cibpcount + "</td><td>" + round.format((float) Aci * 100 / SSRbpcount) + "</td><td>" + round.format((float) Tci * 100 / SSRbpcount) + "</td><td>" + round.format((float) Cci * 100 / SSRbpcount) + "</td><td>" + round.format((float) Gci * 100 / SSRbpcount) + "</td><td>" + round.format((float) cicount / SSRcount) + "</td><td>" + round.format((float) cibpcount / seqcount) + "</td><td>" + round.format((float) cibpcount / SSRbpcount) + "</td></tr>"); } } out.println("|TOTAL |" + cell(Integer.toString(SSRcount), 7) + "|" + cell(Long.toString(SSRbpcount), 12) + "|" + cell((float) A * 100 / SSRbpcount, 7) + "|" + cell((float) T * 100 / SSRbpcount, 7) + "|" + cell((float) C * 100 / SSRbpcount, 7) + "|" + cell((float) G * 100 / SSRbpcount, 7) + "|" + cell(relfreq, 15) + "|" + cell((float) SSRbpcount / seqcount, 15) + "|" + cell((float) abfreq, 15) + "|"); out.println( "|____________|_______|____________|_______|_______|_______|_______|_______________|_______________|_______________|"); out.println("Genome length (bp): " + seqcount); out.println("Relative Frequency: Count of each motif type / total SSR count"); out.println("Abundance: bp of each motif type / total sequence bp"); out.println("Relative Abundance: bp of each motif type / total microsatellites bp"); out.println(); out.println(); out.close(); html.println("<tr><td><b>TOTAL</b></td><td>" + SSRcount + "</td><td>" + SSRbpcount + "</td><td>" + round.format((float) A * 100 / SSRbpcount) + "</td><td>" + round.format((float) T * 100 / SSRbpcount) + "</td><td>" + round.format((float) C * 100 / SSRbpcount) + "</td><td>" + round.format((float) G * 100 / SSRbpcount) + "</td><td>" + round.format((float) relfreq) + "</td><td>" + round.format((float) SSRbpcount / seqcount) + "</td><td>" + round.format((float) abfreq) + "</td></tr></table></html>"); html.close(); try { Runtime.getRuntime().exec("notepad " + file); } catch (IOException ex) { Logger.getLogger(StatsSelection.class.getName()).log(Level.SEVERE, null, ex); } } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); selectsp = new JButton("Select new Species"); selectsp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { input_frame frame = new input_frame(); } catch (ClassNotFoundException ex) { Logger.getLogger(updateframe.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(updateframe.class.getName()).log(Level.SEVERE, null, ex); } dispose(); } }); quit = new JButton("Quit"); quit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); tab = new JTabbedPane(); tab.setSize(790, 590); // about us panel ImageIcon image = new ImageIcon("miga.png"); JLabel label = new JLabel("", image, JLabel.CENTER); contact = new JLabel( "<html><b><p>Machine Learning and Knowledge Discovery Group</p><p>Computer Science Department</p><p>Aristotle University of Thessaloniki</p><p> </p><p>In collaboration with the laboratory of</p><p> </p><p>Population Genetics of Animal Organisms</p><p>Department of Genetics, Development and Molecular Biology</p><p>School of Biology</p><p>Aristotle University of Thessaloniki</p><p> </p><p> </p><p>For any comments or information please contact with:</p><p><a href=\"mailto:ikavak@csd.auth.gr\">ikavak@csd.auth.gr</a></p></b></html>"); about = new JPanel(); about.setLayout(new GridBagLayout()); GridBagConstraints ab = new GridBagConstraints(); ab.fill = GridBagConstraints.WEST; ab.weightx = 0.5; ab.weighty = 0.5; ab.gridx = 0; ab.gridy = 0; about.add(label, ab); ab.fill = GridBagConstraints.WEST; ab.weightx = 0.5; ab.weighty = 0.5; ab.gridx = 0; ab.gridy = 1; about.add(contact, ab); //end of about us //below are the rest of th panels paneltop = new JPanel(); TitledBorder t = BorderFactory.createTitledBorder("Select Period"); paneltop.setBorder(t); paneltop.setLayout(new GridBagLayout()); GridBagConstraints pt = new GridBagConstraints(); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = 0; paneltop.add(mono, pt); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = -1; paneltop.add(di, pt); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = -2; paneltop.add(tri, pt); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = -3; paneltop.add(tetra, pt); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = -4; paneltop.add(penta, pt); pt.fill = GridBagConstraints.HORIZONTAL; pt.weightx = 0.5; pt.weighty = 0.5; pt.gridx = 0; pt.gridy = -5; paneltop.add(hexa, pt); panel1 = new JPanel(); TitledBorder title = BorderFactory.createTitledBorder("Type"); panel1.setBorder(title); panel1.setLayout(new GridBagLayout()); GridBagConstraints a = new GridBagConstraints(); a.fill = GridBagConstraints.HORIZONTAL; a.weightx = 0.5; a.weighty = 0.5; a.gridx = 0; a.gridy = 0; panel1.add(select, a); a.fill = GridBagConstraints.HORIZONTAL; a.weightx = 0.5; a.weighty = 0.5; a.gridx = 0; a.gridy = -1; panel1.add(box1, a); a.fill = GridBagConstraints.HORIZONTAL; a.weightx = 0.5; a.weighty = 0.5; a.gridx = 0; a.gridy = -2; panel1.add(box2, a); a.fill = GridBagConstraints.HORIZONTAL; a.weightx = 0.5; a.weighty = 0.5; a.gridx = 0; a.gridy = -3; panel1.add(box3, a); panel2 = new JPanel(); panel2.setVisible(false); TitledBorder title2 = BorderFactory.createTitledBorder("More Options"); panel2.setBorder(title2); panel2.setLayout(new GridBagLayout()); GridBagConstraints b = new GridBagConstraints(); b.fill = GridBagConstraints.HORIZONTAL; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 0; b.gridy = 0; panel2.add(minimumssrlen, b); b.fill = GridBagConstraints.CENTER; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 1; b.gridy = 0; panel2.add(score, b); b.fill = GridBagConstraints.HORIZONTAL; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 0; b.gridy = -1; panel2.add(gapmax, b); b.fill = GridBagConstraints.CENTER; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 1; b.gridy = -1; panel2.add(max, b); b.fill = GridBagConstraints.HORIZONTAL; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 0; b.gridy = -2; panel2.add(minlenpregap, b); b.fill = GridBagConstraints.CENTER; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 1; b.gridy = -2; panel2.add(minpregap, b); b.fill = GridBagConstraints.HORIZONTAL; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 0; b.gridy = -3; panel2.add(gapcomp, b); b.fill = GridBagConstraints.CENTER; b.weightx = 0.5; b.weighty = 0.5; b.gridx = 1; b.gridy = -3; panel2.add(maxgapcomp, b); paneldownleft = new JPanel(); paneldownleft.setVisible(false); TitledBorder titledl = BorderFactory.createTitledBorder("Compound SSR options"); paneldownleft.setBorder(titledl); paneldownleft.setLayout(new GridBagLayout()); GridBagConstraints dl = new GridBagConstraints(); dl.fill = GridBagConstraints.CENTER; dl.weightx = 0.5; dl.weighty = 0.5; dl.gridx = 0; dl.gridy = 0; paneldownleft.add(com, dl); dl.fill = GridBagConstraints.CENTER; dl.weightx = 0.5; dl.weighty = 0.5; dl.gridx = 0; dl.gridy = -1; paneldownleft.add(incom, dl); paneldownright = new JPanel(); paneldownright.setLayout(new GridBagLayout()); GridBagConstraints dr = new GridBagConstraints(); dr.fill = GridBagConstraints.CENTER; dr.weightx = 0.5; dr.weighty = 0.5; dr.gridx = 0; dr.gridy = 0; paneldownright.add(show, dr); dr.fill = GridBagConstraints.CENTER; dr.weightx = 0.5; dr.weighty = 0.5; dr.gridx = 0; dr.gridy = -1; paneldownright.add(selectsp, dr); dr.fill = GridBagConstraints.CENTER; dr.weightx = 0.5; dr.weighty = 0.5; dr.gridx = 0; dr.gridy = -2; paneldownright.add(quit, dr); panelup = new JPanel(); TitledBorder titleup = BorderFactory.createTitledBorder("Statistics"); panelup.setBorder(titleup); panelup.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = 0; panelup.add(paneltop, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 1; c.gridy = 0; panelup.add(panel1, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = -1; panelup.add(paneldownleft, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 1; c.gridy = -1; panelup.add(panel2, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = -2; panelup.add(paneldownright, c); TitledBorder s = BorderFactory.createTitledBorder("Standardization"); std.setBorder(s); std.add(no_st); std.add(part_st); std.add(full_st); std.setEnabled(false); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = -3; panelup.add(std, c); tab.add(panelup, "Statistics"); panelshow = new JPanel(); TitledBorder ps = BorderFactory.createTitledBorder("Sequence Retrieval"); panelshow.setBorder(ps); panelshow.setLayout(new GridBagLayout()); GridBagConstraints psg = new GridBagConstraints(); panelshowup = new JPanel(); panelshowup.setLayout(new GridBagLayout()); GridBagConstraints p = new GridBagConstraints(); p.fill = GridBagConstraints.WEST; p.weightx = 0.5; p.weighty = 0.5; p.gridx = 0; p.gridy = 0; panelshowup.add(lab, p); panelshowd = new JPanel(); panelshowd.setLayout(new GridBagLayout()); GridBagConstraints pd = new GridBagConstraints(); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -1; panelshowd.add(startlab, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -1; panelshowd.add(startnum, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -2; panelshowd.add(endlab, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -2; panelshowd.add(endnum, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -3; panelshowd.add(titlelab, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -3; panelshowd.add(titlef, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -4; panelshowd.add(flk, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -4; panelshowd.add(new JLabel(" "), pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -5; panelshowd.add(flankst, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -5; panelshowd.add(flankstn, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 0; pd.gridy = -6; panelshowd.add(flankend, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -6; panelshowd.add(flankendn, pd); pd.fill = GridBagConstraints.CENTER; pd.weightx = 0.5; pd.weighty = 0.5; pd.gridx = 1; pd.gridy = -7; panelshowd.add(retrieve, pd); psg.fill = GridBagConstraints.CENTER; psg.weightx = 0.5; psg.weighty = 0.5; psg.gridx = 0; psg.gridy = 0; panelshow.add(panelshowup, psg); psg.fill = GridBagConstraints.CENTER; psg.weightx = 0.5; psg.weighty = 0.5; psg.gridx = 0; psg.gridy = -1; panelshow.add(panelshowd, psg); psg.fill = GridBagConstraints.CENTER; psg.weightx = 0.5; psg.weighty = 0.5; psg.gridx = 0; psg.gridy = -2; panelshow.add(sbrText, psg); tab.add(panelshow, "Sequence Retrieval"); tab.add(about, "About us"); add(tab); setVisible(true); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Executes the query(ies). It is expected that this will be * run on its own thread -- hence it is a run method. *///ww w. ja va2s .com public void run() { this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); (flashRunIndicator = new Thread( new FlashForeground(runIndicator, Color.red.brighter(), Color.lightGray, 5))).start(); (timeRunIndicator = new Thread(new InsertTime(timeIndicator, new java.util.Date().getTime(), QUERY_EXECUTION_TIMER_UPDATE_DELAY_MS))).start(); try { if (runType == RUNTYPE_ALL) { runAllQueries(); } else if (runType == RUNTYPE_TRIPLE_EXPORT) { message.setText(""); messageOut(Resources.getString("msgStartExportToFile", exportFile.getAbsolutePath()), STYLE_BOLD); messageOut(""); execute(getQuery().getSql(), new ListTableModel<Object>(), exportFile); } else { checkForNewString(querySelection); checkForNewString(connectString); processStatement(); } } catch (Throwable any) { LOGGER.error("Failure while trying to execute query", any); messageOut(Resources.getString("errFailSQLText", any.getMessage()), STYLE_RED); } flashRunIndicator.interrupt(); flashRunIndicator = null; timeRunIndicator.interrupt(); timeRunIndicator = null; this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }