bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected void translateAllComponents(int xdist, int ydist) { Rectangle visibleArea = parent.getVisibleRect(); Point p = new Point(); for (int i = 0, n = parent.getComponentCount(); i < n; i++) { JComponent c = (JComponent) parent.getComponent(i); p = c.getLocation(p); p.x += xdist; p.y += ydist; c.setLocation(p); } visibleArea.x += xdist; visibleArea.y += ydist; parent.scrollRectToVisible(visibleArea); }
|
protected void translateAllComponents(int xdist, int ydist) { Rectangle visibleArea = parent.getVisibleRect(); Point p = new Point(); for (int i = 0, n = parent.getComponentCount(); i < n; i++) { JComponent c = (JComponent) parent.getComponent(i); p = c.getLocation(p); p.x += xdist; p.y += ydist; c.setLocation(p); } visibleArea.x += xdist; visibleArea.y += ydist; parent.scrollRectToVisible(visibleArea); }
| 1,109,808
|
protected void translateAllComponents(int xdist, int ydist) { Rectangle visibleArea = parent.getVisibleRect(); Point p = new Point(); for (int i = 0, n = parent.getComponentCount(); i < n; i++) { JComponent c = (JComponent) parent.getComponent(i); p = c.getLocation(p); p.x += xdist; p.y += ydist; c.setLocation(p); } visibleArea.x += xdist; visibleArea.y += ydist; parent.scrollRectToVisible(visibleArea); }
|
protected void translateAllComponents(int xdist, int ydist) { Rectangle visibleArea = parent.getVisibleRect(); Point p = new Point(); for (int i = 0, n = parent.getComponentCount(); i < n; i++) { JComponent c = (JComponent) parent.getComponent(i); p = c.getLocation(p); p.x += xdist; p.y += ydist; c.setLocation(p); } visibleArea.x += xdist; visibleArea.y += ydist; parent.scrollRectToVisible(visibleArea); }
| 1,109,809
|
public PlayPen() { super(); setLayout(new PlayPenLayout(this)); setName("Play Pen"); setMinimumSize(new Dimension(200,200)); setOpaque(true); dt = new DropTarget(this, new PlayPenDropListener()); }
|
public PlayPen(SQLDatabase db) { super(); setLayout(new PlayPenLayout(this)); setName("Play Pen"); setMinimumSize(new Dimension(200,200)); setOpaque(true); dt = new DropTarget(this, new PlayPenDropListener()); }
| 1,109,810
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); LoginForm loginForm = (LoginForm) actionForm; AuthService authService = ServiceFactory.getAuthService(); try{ authService.login(Utils.getServiceContext(context), loginForm.getUsername(), loginForm.getPassword()); }catch(ServiceException se){ errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.WEB_UI_ERROR_KEY, se.getMessage())); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); }catch(Exception ex){ //TODO Architcture should handle this (ExceptionHandler) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.UNKNOWN_ERROR)); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); } return mapping.findForward(Forwards.SUCCESS); }
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { LoginForm loginForm = (LoginForm) actionForm; AuthService authService = ServiceFactory.getAuthService(); try{ authService.login(Utils.getServiceContext(context), loginForm.getUsername(), loginForm.getPassword()); }catch(ServiceException se){ errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.WEB_UI_ERROR_KEY, se.getMessage())); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); }catch(Exception ex){ //TODO Architcture should handle this (ExceptionHandler) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.UNKNOWN_ERROR)); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); } return mapping.findForward(Forwards.SUCCESS); }
| 1,109,812
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); LoginForm loginForm = (LoginForm) actionForm; AuthService authService = ServiceFactory.getAuthService(); try{ authService.login(Utils.getServiceContext(context), loginForm.getUsername(), loginForm.getPassword()); }catch(ServiceException se){ errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.WEB_UI_ERROR_KEY, se.getMessage())); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); }catch(Exception ex){ //TODO Architcture should handle this (ExceptionHandler) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.UNKNOWN_ERROR)); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); } return mapping.findForward(Forwards.SUCCESS); }
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); LoginForm loginForm = (LoginForm) actionForm; AuthService authService = ServiceFactory.getAuthService(); try{ authService.login(Utils.getServiceContext(context), loginForm.getUsername(), loginForm.getPassword()); }catch(ServiceException se){ errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.WEB_UI_ERROR_KEY, se.getMessage())); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); }catch(Exception ex){ //TODO Architcture should handle this (ExceptionHandler) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ErrorCodes.UNKNOWN_ERROR)); request.setAttribute(Globals.ERROR_KEY, errors); return mapping.getInputForward(); } return mapping.findForward(Forwards.SUCCESS); }
| 1,109,813
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == "Open"){ int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try{ theData = new HaploData(fc.getSelectedFile()); infileName = fc.getSelectedFile().getName(); //compute D primes and monitor progress progressMonitor = new ProgressMonitor(this, "Computing " + theData.getToBeCompleted() + " values of D prime","", 0, theData.getToBeCompleted()); progressMonitor.setProgress(0); progressMonitor.setMillisToDecideToPopup(2000); final SwingWorker worker = new SwingWorker(){ public Object construct(){ theData.doMonitoredComputation(); return ""; } }; timer = new javax.swing.Timer(500, new ActionListener(){ public void actionPerformed(ActionEvent evt){ progressMonitor.setProgress(theData.getComplete()); if (theData.getComplete() == theData.getToBeCompleted()){ timer.stop(); progressMonitor.close(); infoKnown=false; drawPicture(theData); loadInfoMenuItem.setEnabled(true); hapMenuItem.setEnabled(true); customizeHapsMenuItem.setEnabled(true); exportMenuItem.setEnabled(true); saveDprimeMenuItem.setEnabled(true); clearBlocksMenuItem.setEnabled(true); guessBlocksMenuItem.setEnabled(true); } } }); worker.start(); timer.start(); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (RuntimeException rtexec){ JOptionPane.showMessageDialog(this, "An error has occured. It is probably related to file format:\n"+rtexec.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (command == loadInfoStr){ int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try{ theData.prepareMarkerInput(fc.getSelectedFile()); infoKnown=true; loadInfoMenuItem.setEnabled(false); drawPicture(theData); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (RuntimeException rtexec){ JOptionPane.showMessageDialog(this, "An error has occured. It is probably related to file format:\n"+rtexec.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } }else if (command == "Clear All Blocks"){ theBlocks.clearBlocks(); }else if (command == "Define Blocks"){ defineBlocks(); }else if (command == "Customize Haplotype Output"){ customizeHaps(); }else if (command == "Tutorial"){ showHelp(); }else if (command == "Export LD Picture to JPG"){ doExportDPrime(); }else if (command == "Dump LD Output to Text"){ saveDprimeToText(); }else if (command == "Save Haplotypes to Text"){ saveHapsToText(); }else if (command == "Save Haplotypes to JPG"){ saveHapsPic(); }else if (command == "Generate Haplotypes"){ try{ drawHaplos(theData.generateHaplotypes(theData.blocks, haploThresh)); saveHapsMenuItem.setEnabled(true); saveHapsPicMenuItem.setEnabled(true); }catch (IOException ioe){} } else if (command == "Exit"){ System.exit(0); } }
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == "Open"){ int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try{ theData = new HaploData(fc.getSelectedFile()); infileName = fc.getSelectedFile().getName(); //compute D primes and monitor progress progressMonitor = new ProgressMonitor(this, "Computing " + theData.getToBeCompleted() + " values of D prime","", 0, theData.getToBeCompleted()); progressMonitor.setProgress(0); progressMonitor.setMillisToDecideToPopup(2000); final SwingWorker worker = new SwingWorker(){ public Object construct(){ theData.doMonitoredComputation(); return ""; } }; timer = new javax.swing.Timer(500, new ActionListener(){ public void actionPerformed(ActionEvent evt){ progressMonitor.setProgress(theData.getComplete()); if (theData.getComplete() == theData.getToBeCompleted()){ timer.stop(); progressMonitor.close(); infoKnown=false; drawPicture(theData); loadInfoMenuItem.setEnabled(true); hapMenuItem.setEnabled(true); customizeHapsMenuItem.setEnabled(true); exportMenuItem.setEnabled(true); saveDprimeMenuItem.setEnabled(true); clearBlocksMenuItem.setEnabled(true); guessBlocksMenuItem.setEnabled(true); } } }); worker.start(); timer.start(); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (RuntimeException rtexec){ JOptionPane.showMessageDialog(this, "An error has occured. It is probably related to file format:\n"+rtexec.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (command == loadInfoStr){ int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try{ theData.prepareMarkerInput(fc.getSelectedFile()); infoKnown=true; drawPicture(theData); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (RuntimeException rtexec){ JOptionPane.showMessageDialog(this, "An error has occured. It is probably related to file format:\n"+rtexec.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } }else if (command == "Clear All Blocks"){ theBlocks.clearBlocks(); }else if (command == "Define Blocks"){ defineBlocks(); }else if (command == "Customize Haplotype Output"){ customizeHaps(); }else if (command == "Tutorial"){ showHelp(); }else if (command == "Export LD Picture to JPG"){ doExportDPrime(); }else if (command == "Dump LD Output to Text"){ saveDprimeToText(); }else if (command == "Save Haplotypes to Text"){ saveHapsToText(); }else if (command == "Save Haplotypes to JPG"){ saveHapsPic(); }else if (command == "Generate Haplotypes"){ try{ drawHaplos(theData.generateHaplotypes(theData.blocks, haploThresh)); saveHapsMenuItem.setEnabled(true); saveHapsPicMenuItem.setEnabled(true); }catch (IOException ioe){} } else if (command == "Exit"){ System.exit(0); } }
| 1,109,814
|
void doExportDPrime(){ int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ try { int scaleSize = theData.dPrimeTable.length*30; DrawingMethods dm = new DrawingMethods(); BufferedImage image = new BufferedImage(scaleSize, scaleSize, BufferedImage.TYPE_3BYTE_BGR); dm.dPrimeDraw(theData.dPrimeTable, image.getGraphics()); dm.saveImage(image, fc.getSelectedFile().getPath()); } catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } }
|
void doExportDPrime(){ int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ try { int scaleSize = theData.dPrimeTable.length*30; DrawingMethods dm = new DrawingMethods(); BufferedImage image = new BufferedImage(scaleSize, scaleSize, BufferedImage.TYPE_3BYTE_BGR); dm.dPrimeDraw(theData.dPrimeTable, infoKnown, theData.markerInfo, image.getGraphics()); dm.saveImage(image, fc.getSelectedFile().getPath()); } catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } }
| 1,109,815
|
void drawPicture(HaploData theData){ contents = getContentPane(); contents.removeAll(); //first, draw the D' picture contents.setLayout(new BoxLayout(contents, BoxLayout.Y_AXIS)); theDPrime = new DPrimePanel(theData.dPrimeTable); JPanel holderPanel = new JPanel(); holderPanel.add(theDPrime); holderPanel.setBackground(new Color(192,192,192)); JScrollPane dPrimeScroller = new JScrollPane(holderPanel); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); contents.add(dPrimeScroller); //next add a little spacer contents.add(Box.createRigidArea(new Dimension(0,5))); //and then add the block display theBlocks = new BlockDisplay(theData.markerInfo, theData.blocks, theDPrime, infoKnown); contents.setBackground(Color.black); //put the block display in a scroll pane in case the data set is very large. JScrollPane blockScroller = new JScrollPane(theBlocks, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); blockScroller.getHorizontalScrollBar().setUnitIncrement(60); blockScroller.setMinimumSize(new Dimension(800, 100)); contents.add(blockScroller); repaint(); setVisible(true); }
|
void drawPicture(HaploData theData){ contents = getContentPane(); contents.removeAll(); //first, draw the D' picture contents.setLayout(new BoxLayout(contents, BoxLayout.Y_AXIS)); theDPrime = new DPrimePanel(theData.dPrimeTable, infoKnown, theData.markerInfo); JPanel holderPanel = new JPanel(); holderPanel.add(theDPrime); holderPanel.setBackground(new Color(192,192,192)); JScrollPane dPrimeScroller = new JScrollPane(holderPanel); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); contents.add(dPrimeScroller); //next add a little spacer contents.add(Box.createRigidArea(new Dimension(0,5))); //and then add the block display theBlocks = new BlockDisplay(theData.markerInfo, theData.blocks, theDPrime, infoKnown); contents.setBackground(Color.black); //put the block display in a scroll pane in case the data set is very large. JScrollPane blockScroller = new JScrollPane(theBlocks, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); blockScroller.getHorizontalScrollBar().setUnitIncrement(60); blockScroller.setMinimumSize(new Dimension(800, 100)); contents.add(blockScroller); repaint(); setVisible(true); }
| 1,109,816
|
public String draw(DashboardContext context) { StringBuffer output = new StringBuffer(component.draw(context)); String appId = context.getWebContext().getApplicationConfig().getApplicationId(); output.append("\n<script>"); output.append("self.setTimeout(\"refreshDBComponent("); output.append("''"); output.append(getId()); output.append("'', "); output.append(refreshInterval + ", " + appId + ")\", " + refreshInterval + ");"); output.append("</script>"); return output.toString(); }
|
public String draw(DashboardContext context) { StringBuffer output = new StringBuffer(); output.append("<div id=\"" + getId() + "\">"); output.append(component.draw(context)); output.append("</div>"); String appId = context.getWebContext().getApplicationConfig().getApplicationId(); output.append("\n<script>"); output.append("self.setTimeout(\"refreshDBComponent("); output.append("''"); output.append(getId()); output.append("'', "); output.append(refreshInterval + ", " + appId + ")\", " + refreshInterval + ");"); output.append("</script>"); return output.toString(); }
| 1,109,817
|
private void search(String searchText) { rowMapping = null; fireTableDataChanged(); List<Integer> newRowMap = new ArrayList<Integer>(); CharSequence searchSubSequence = searchText == null ? null : searchText.toLowerCase().subSequence(0,searchText.length()); for ( int row = 0; row < tableModel.getRowCount(); row++ ) { boolean match = false; if ( searchSubSequence == null ) { match = true; } else { for ( int column = 0; column < tableModel.getColumnCount(); column++ ) { String value = tableTextConverter.getTextForCell(row, column); if (value.toLowerCase().contains(searchSubSequence)) { if (logger.isDebugEnabled()) { logger.debug("Match: "+value.toLowerCase()+" contains "+searchSubSequence); } match = true; break; } } } if ( match ) newRowMap.add(row); } setSearchText(searchText); rowMapping = newRowMap; if (logger.isDebugEnabled()) { logger.debug("new row mapping after search: "+rowMapping); } fireTableDataChanged(); }
|
private void search(String searchText) { rowMapping = null; fireTableDataChanged(); List<Integer> newRowMap = new ArrayList<Integer>(); CharSequence searchSubSequence = searchText == null ? null : searchText.toLowerCase().subSequence(0,searchText.length()); for ( int row = 0; row < tableModel.getRowCount(); row++ ) { boolean match = false; if ( searchSubSequence == null ) { match = true; } else { for ( int column = 0; column < tableModel.getColumnCount(); column++ ) { String value = tableTextConverter.getTextForCell(row, column); if (value.toLowerCase().contains(searchSubSequence)) { if (logger.isDebugEnabled()) { logger.debug("Match: "+value.toLowerCase()+" contains "+searchSubSequence); } match = true; break; } } } if ( match ) newRowMap.add(row); } setSearchText(searchText); rowMapping = newRowMap; if (logger.isDebugEnabled()) { logger.debug("new row mapping after search: "+rowMapping); } fireTableDataChanged(); }
| 1,109,818
|
public void testIndexing() { int n; ExternalVolume v = new ExternalVolume( "extVol", extVolDir.getAbsolutePath() ); ExtVolIndexer indexer = new ExtVolIndexer( v ); indexer.setTopFolder( topFolder ); TestListener l = new TestListener(); indexer.addIndexerListener( l ); assertEquals( "Indexing not started -> completeness must be 0", 0, indexer.getPercentComplete() ); assertNull( "StartTime must be null before starting", indexer.getStartTime() ); indexer.run(); // Check that all the files can be found PhotoInfo[] photos1 = PhotoInfo.retrieveByOrigHash( hash1 ); assertEquals( "Only 1 photo per picture should be found", 1, photos1.length ); PhotoInfo p1 = photos1[0]; assertEquals( "2 instances should be found in photo 1", 2, p1.getNumInstances() ); ImageInstance i1 = p1.getInstance( 0 ); assertEquals( i1.getImageFile(), photo1 ); PhotoInfo[] photos2 = PhotoInfo.retrieveByOrigHash( hash2 ); assertEquals( "1 photo per picture should be found", 1, photos2.length ); PhotoInfo p2 = photos2[0]; assertEquals( "3 instances should be found in photo 2", 3, p2.getNumInstances() ); boolean found[] = {false, false}; File files[] = {photo2inst1, photo2inst2}; for ( n = 0; n < p2.getNumInstances(); n++ ) { ImageInstance i = p2.getInstance( n ); for ( int m = 0; m < found.length; m++ ) { if ( files[m].equals( i.getImageFile() ) ) { found[m] = true; } } } for ( n = 0; n < found.length; n++ ) { assertTrue( "Photo " + n + " not found", found[n] ); } // Check that the folders have the correct photos PhotoInfo[] photosInTopFolder = { p1, p2 }; assertFolderHasPhotos( topFolder, photosInTopFolder ); PhotoFolder subFolder = topFolder.getSubfolder( 0 ); assertEquals( "Subfolder name not correct", "test", subFolder.getName() ); PhotoInfo[] photosInSubFolder = { p2 }; assertFolderHasPhotos( subFolder, photosInSubFolder ); // Check that the listener was called correctly assertEquals( "Wrong photo count in listener", 2, l.photoCount ); assertEquals( "Wrong photo count in indexer statistics", 2, indexer.getNewPhotoCount() ); assertEquals( "Wrong instance count in listener", 3, l.instanceCount ); assertEquals( "Wrong instance count in indexer statistics", 3, indexer.getNewInstanceCount() ); assertEquals( "Indexing complete 100%", 100, indexer.getPercentComplete() ); assertNotNull( "StartTime still null", indexer.getStartTime() ); }
|
public void testIndexing() { int n; ExternalVolume v = new ExternalVolume( "extVol", extVolDir.getAbsolutePath() ); ExtVolIndexer indexer = new ExtVolIndexer( v ); indexer.setTopFolder( topFolder ); TestListener l = new TestListener(); indexer.addIndexerListener( l ); assertEquals( "Indexing not started -> completeness must be 0", 0, indexer.getPercentComplete() ); assertNull( "StartTime must be null before starting", indexer.getStartTime() ); indexer.run(); // Check that all the files can be found PhotoInfo[] photos1 = PhotoInfo.retrieveByOrigHash( hash1 ); assertEquals( "Only 1 photo per picture should be found", 1, photos1.length ); PhotoInfo p1 = photos1[0]; assertEquals( "2 instances should be found in photo 1", 2, p1.getNumInstances() ); ImageInstance i1 = p1.getInstance( 0 ); assertEquals( i1.getImageFile(), photo1 ); PhotoInfo[] photos2 = PhotoInfo.retrieveByOrigHash( hash2 ); assertEquals( "1 photo per picture should be found", 1, photos2.length ); PhotoInfo p2 = photos2[0]; assertEquals( "3 instances should be found in photo 2", 3, p2.getNumInstances() ); boolean found[] = {false, false}; File files[] = {photo2inst1, photo2inst2}; for ( n = 0; n < p2.getNumInstances(); n++ ) { ImageInstance i = p2.getInstance( n ); for ( int m = 0; m < found.length; m++ ) { if ( files[m].equals( i.getImageFile() ) ) { found[m] = true; } } } for ( n = 0; n < found.length; n++ ) { assertTrue( "Photo " + n + " not found", found[n] ); } // Check that the folders have the correct photos PhotoInfo[] photosInTopFolder = { p1, p2 }; assertFolderHasPhotos( topFolder, photosInTopFolder ); PhotoFolder subFolder = topFolder.getSubfolder( 0 ); assertEquals( "Subfolder name not correct", "test", subFolder.getName() ); PhotoInfo[] photosInSubFolder = { p2 }; assertFolderHasPhotos( subFolder, photosInSubFolder ); // Check that the listener was called correctly assertEquals( "Wrong photo count in listener", 2, l.photoCount ); assertEquals( "Wrong photo count in indexer statistics", 2, indexer.getNewPhotoCount() ); assertEquals( "Wrong instance count in listener", 3, l.instanceCount ); assertEquals( "Wrong instance count in indexer statistics", 3, indexer.getNewInstanceCount() ); assertEquals( "Indexing complete 100%", 100, indexer.getPercentComplete() ); assertNotNull( "StartTime still null", indexer.getStartTime() ); }
| 1,109,821
|
public boolean doConsistencyCheck() { boolean isConsistent = true; boolean needsHashCheck = false; ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.WRITE ); File f = this.getImageFile(); if ( f.exists() ) { long size = f.length(); if ( size != this.fileSize ) { isConsistent = false; if ( this.fileSize == 0 ) { needsHashCheck = true; } } long mtime = f.lastModified(); if ( mtime != this.mtime ) { needsHashCheck = true; } if ( needsHashCheck ) { byte[] dbHash = hash.clone(); calcHash(); byte[] realHash = hash.clone(); isConsistent = (dbHash.equals( realHash ) ); if ( isConsistent ) { txw.lock( this, Transaction.WRITE ); this.mtime = mtime; this.fileSize = size; } } } /* Update the database with check result if it was positive */ if ( isConsistent ) { txw.lock( this, Transaction.WRITE ); this.checkTime = new java.util.Date(); } txw.commit(); return isConsistent; }
|
public boolean doConsistencyCheck() { boolean isConsistent = true; boolean needsHashCheck = false; ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.WRITE ); File f = this.getImageFile(); if ( f.exists() ) { long size = f.length(); if ( size != this.fileSize ) { isConsistent = false; if ( this.fileSize == 0 ) { needsHashCheck = true; } } long mtime = f.lastModified(); if ( mtime != this.mtime ) { needsHashCheck = true; } if ( needsHashCheck ) { byte[] dbHash = hash.clone(); calcHash(); byte[] realHash = hash.clone(); isConsistent = Arrays.equals( dbHash, realHash ); if ( isConsistent ) { txw.lock( this, Transaction.WRITE ); this.mtime = mtime; this.fileSize = size; } } } /* Update the database with check result if it was positive */ if ( isConsistent ) { txw.lock( this, Transaction.WRITE ); this.checkTime = new java.util.Date(); } txw.commit(); return isConsistent; }
| 1,109,823
|
private boolean isProperJoin(StorableProperty<?> property) throws SupportException, RepositoryException { if (!property.isJoin() || property.isQuery()) { return false; } // Make up a filter over the join's internal properties and then search // for an index that filters with no remainder. Filter<?> filter = Filter.getOpenFilter((Class<? extends Storable>) property.getType()); int count = property.getJoinElementCount(); for (int i=0; i<count; i++) { filter = filter.and(property.getExternalJoinElement(i).getName(), RelOp.EQ); } // Java generics are letting me down. I cannot use proper specification // because compiler gets confused with all the wildcards. Collection indexes = indexesFor(filter.getStorableType()); if (indexes != null) { for (Object index : indexes) { FilteringScore score = FilteringScore.evaluate((StorableIndex) index, filter); if (score.getRemainderCount() == 0) { return true; } } } return false; }
|
private boolean isProperJoin(StorableProperty<?> property) throws SupportException, RepositoryException { if (!property.isJoin() || property.isQuery()) { return false; } // Make up a filter over the join's internal properties and then search // for an index that filters with no remainder. Filter<?> filter = Filter.getOpenFilter(property.getEnclosingType()); int count = property.getJoinElementCount(); for (int i=0; i<count; i++) { filter = filter.and(property.getExternalJoinElement(i).getName(), RelOp.EQ); } // Java generics are letting me down. I cannot use proper specification // because compiler gets confused with all the wildcards. Collection indexes = indexesFor(filter.getStorableType()); if (indexes != null) { for (Object index : indexes) { FilteringScore score = FilteringScore.evaluate((StorableIndex) index, filter); if (score.getRemainderCount() == 0) { return true; } } } return false; }
| 1,109,824
|
private boolean isProperJoin(StorableProperty<?> property) throws SupportException, RepositoryException { if (!property.isJoin() || property.isQuery()) { return false; } // Make up a filter over the join's internal properties and then search // for an index that filters with no remainder. Filter<?> filter = Filter.getOpenFilter((Class<? extends Storable>) property.getType()); int count = property.getJoinElementCount(); for (int i=0; i<count; i++) { filter = filter.and(property.getExternalJoinElement(i).getName(), RelOp.EQ); } // Java generics are letting me down. I cannot use proper specification // because compiler gets confused with all the wildcards. Collection indexes = indexesFor(filter.getStorableType()); if (indexes != null) { for (Object index : indexes) { FilteringScore score = FilteringScore.evaluate((StorableIndex) index, filter); if (score.getRemainderCount() == 0) { return true; } } } return false; }
|
private boolean isProperJoin(StorableProperty<?> property) throws SupportException, RepositoryException { if (!property.isJoin() || property.isQuery()) { return false; } // Make up a filter over the join's internal properties and then search // for an index that filters with no remainder. Filter<?> filter = Filter.getOpenFilter((Class<? extends Storable>) property.getType()); int count = property.getJoinElementCount(); for (int i=0; i<count; i++) { filter = filter.and(property.getInternalJoinElement(i).getName(), RelOp.EQ); } // Java generics are letting me down. I cannot use proper specification // because compiler gets confused with all the wildcards. Collection indexes = indexesFor(filter.getStorableType()); if (indexes != null) { for (Object index : indexes) { FilteringScore score = FilteringScore.evaluate((StorableIndex) index, filter); if (score.getRemainderCount() == 0) { return true; } } } return false; }
| 1,109,825
|
public void testRotationChange() { ThumbnailView view = new ThumbnailView(); view.setPhoto( photo ); pane.add( view ); showFrame(); Iterator writers = ImageIO.getImageWritersByFormatName("png"); ImageWriter writer = (ImageWriter)writers.next(); tester.waitForIdle(); // TODO: FIX for build errors // BufferedImage bi = abbot.tester.Robot.capture( view ); BufferedImage bi = null; File f = new File( testRefImageDir, "thumbnailRotation1.png" ); assertTrue( "thumbnailRotationnnot correct", photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); photo.setPrefRotation( 107 ); tester.waitForIdle(); // TODO: FIX for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailRotation2.png" ); assertTrue( "107 deg rotation not correct", photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); }
|
public void testRotationChange() { ThumbnailView view = new ThumbnailView(); view.setPhoto( photo ); pane.add( view ); showFrame(); Iterator writers = ImageIO.getImageWritersByFormatName("png"); ImageWriter writer = (ImageWriter)writers.next(); tester.waitForIdle(); // TODO: FIX for build errors // BufferedImage bi = abbot.tester.Robot.capture( view ); File f = new File( testRefImageDir, "thumbnailRotation1.png" ); assertTrue( "thumbnailRotationnnot correct", photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); photo.setPrefRotation( 107 ); tester.waitForIdle(); // TODO: FIX for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailRotation2.png" ); assertTrue( "107 deg rotation not correct", photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); }
| 1,109,826
|
public void testThumbnailShow() { ThumbnailView view = new ThumbnailView(); view.setPhoto( photo ); pane.add( view ); showFrame(); view.repaint(); tester.waitForIdle();// Iterator writers = ImageIO.getImageWritersByFormatName("png");// ImageWriter writer = (ImageWriter)writers.next();// BufferedImage bi = abbot.tester.Robot.capture( view ); // TODO: Fix for build problem BufferedImage bi = null; File f = new File( testRefImageDir, "thumbnailShow1.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); view.setShowShootingTime( false ); tester.waitForIdle(); // TODO: Fix for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailShow2.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); view.setShowShootingPlace( false ); tester.waitForIdle(); // TODO: FIX for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailShow3.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); }
|
public void testThumbnailShow() { ThumbnailView view = new ThumbnailView(); view.setPhoto( photo ); pane.add( view ); showFrame(); view.repaint(); tester.waitForIdle();// Iterator writers = ImageIO.getImageWritersByFormatName("png");// ImageWriter writer = (ImageWriter)writers.next();// BufferedImage bi = abbot.tester.Robot.capture( view ); // TODO: Fix for build problem BufferedImage bi = tester.capture( view ); File f = new File( testRefImageDir, "thumbnailShow1.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); view.setShowShootingTime( false ); tester.waitForIdle(); // TODO: Fix for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailShow2.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); view.setShowShootingPlace( false ); tester.waitForIdle(); // TODO: FIX for build errors // bi = abbot.tester.Robot.capture( view ); f = new File( testRefImageDir, "thumbnailShow3.png" ); assertTrue( photovault.test.ImgTestUtils.compareImgToFile( bi, f ) ); }
| 1,109,828
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String title = tabs.getTitleAt(tabs.getSelectedIndex()); if (title.equals(VIEW_DPRIME) || title.equals(VIEW_HAPLOTYPES)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); exportMenuItems[2].setEnabled(true); }else if (title.equals(VIEW_ASSOC) || title.equals(VIEW_CHECK_PANEL) || title.equals(VIEW_TAGGER)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); exportMenuItems[2].setEnabled(true); }else if (title.equals(VIEW_PLINK)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); exportMenuItems[2].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (title.equals(VIEW_ASSOC)){ JTabbedPane metaAssoc = ((JTabbedPane)((HaploviewTab)tabs.getSelectedComponent()).getComponent(0)); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold() && !Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } } if (title.equals(VIEW_DPRIME)){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); dPrimeDisplay.revalidate(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE ){ //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } if (theData.finished){ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String title = tabs.getTitleAt(tabs.getSelectedIndex()); if (title.equals(VIEW_DPRIME) || title.equals(VIEW_HAPLOTYPES)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); exportMenuItems[2].setEnabled(true); }else if (title.equals(VIEW_ASSOC) || title.equals(VIEW_CHECK_PANEL) || title.equals(VIEW_TAGGER)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); exportMenuItems[2].setEnabled(true); }else if (title.equals(VIEW_PLINK)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); exportMenuItems[2].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (title.equals(VIEW_ASSOC)){ JTabbedPane metaAssoc = ((JTabbedPane)((HaploviewTab)tabs.getSelectedComponent()).getComponent(0)); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold() && !Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } } if (title.equals(VIEW_DPRIME)){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); dPrimeDisplay.revalidate(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE ){ //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); AssociationTestSet custSet = null; if (custAssocPanel != null){ custSet = custAssocPanel.getTestSet(); } AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet( new PermutationTestSet(0,theData.getPedFile(),custSet,permSet)); } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } if (theData.finished){ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
| 1,109,830
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer enum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer dimensionEnum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
| 1,109,831
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer enum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer enum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
| 1,109,832
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer enum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
|
public Object convert(Class type, Object value) { if ( value != null ) { String text = value.toString(); StringTokenizer enum = new StringTokenizer( text, "," ); int width = 0; int height = 0; if ( enum.hasMoreTokens() ) { width = parseNumber( enum.nextToken() ); } if ( enum.hasMoreTokens() ) { height = parseNumber( enum.nextToken() ); }
| 1,109,833
|
static Vector do4Gamete(PairwiseLinkage[][] dPrime){ Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first make a list of marker pairs with < 4 gametes, sorted by distance apart for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null) { continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > fourGameteCutoff) numGam++; } if (numGam > 3){ continue; } Vector addMe = new Vector(); //a vector of x, y, separation int sep = y - x - 1; //compute separation of two markers addMe.add(String.valueOf(x)); addMe.add(String.valueOf(y)); addMe.add(String.valueOf(sep)); if (strongPairs.size() == 0){ //put first pair first strongPairs.add(addMe); }else{ //sort by descending separation of markers in each pair boolean unplaced = true; for (int v = 0; v < strongPairs.size(); v ++){ if (sep >= Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))){ strongPairs.insertElementAt(addMe, v); unplaced = false; break; } } if (unplaced) {strongPairs.add(addMe);} } } } //now take this list of pairs with 3 gametes and construct blocks boolean[] usedInBlock = new boolean[dPrime.length + 1]; for (int v = 0; v < strongPairs.size(); v++){ boolean isABlock = true; int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //test this block. for (int y = first+1; y <= last; y++){ //loop over columns in row y for (int x = first; x < y; x++){ PairwiseLinkage thisPair = dPrime[x][y]; if(thisPair == null){ continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > fourGameteCutoff) numGam++; } if (numGam > 3){ isABlock = false; } } } if (isABlock){ //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(first + " " + last); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ StringTokenizer st = new StringTokenizer((String)blocks.elementAt(b)); if (first < Integer.parseInt(st.nextToken())){ blocks.insertElementAt(first + " " + last, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(first + " " + last); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return stringVec2intVec(blocks); }
|
static Vector do4Gamete(PairwiseLinkage[][] dPrime){ Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first make a list of marker pairs with < 4 gametes, sorted by distance apart for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null) { continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > fourGameteCutoff + 1E-8) numGam++; } if (numGam > 3){ continue; } Vector addMe = new Vector(); //a vector of x, y, separation int sep = y - x - 1; //compute separation of two markers addMe.add(String.valueOf(x)); addMe.add(String.valueOf(y)); addMe.add(String.valueOf(sep)); if (strongPairs.size() == 0){ //put first pair first strongPairs.add(addMe); }else{ //sort by descending separation of markers in each pair boolean unplaced = true; for (int v = 0; v < strongPairs.size(); v ++){ if (sep >= Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))){ strongPairs.insertElementAt(addMe, v); unplaced = false; break; } } if (unplaced) {strongPairs.add(addMe);} } } } //now take this list of pairs with 3 gametes and construct blocks boolean[] usedInBlock = new boolean[dPrime.length + 1]; for (int v = 0; v < strongPairs.size(); v++){ boolean isABlock = true; int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //test this block. for (int y = first+1; y <= last; y++){ //loop over columns in row y for (int x = first; x < y; x++){ PairwiseLinkage thisPair = dPrime[x][y]; if(thisPair == null){ continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > fourGameteCutoff + 1E-8) numGam++; } if (numGam > 3){ isABlock = false; } } } if (isABlock){ //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(first + " " + last); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ StringTokenizer st = new StringTokenizer((String)blocks.elementAt(b)); if (first < Integer.parseInt(st.nextToken())){ blocks.insertElementAt(first + " " + last, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(first + " " + last); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return stringVec2intVec(blocks); }
| 1,109,835
|
protected void processBean(String var, Object bean) throws Exception { if (var != null) { context.setVariable(var, bean); } // now lets try set the parent property via calling the adder or the setter method if (bean != null) { Object parentObject = getParentObject(); if (parentObject != null) { if (parentObject instanceof Collection) { Collection collection = (Collection) parentObject; collection.add(bean); } else { // lets see if there's a setter method... Method method = findAddMethod(parentObject.getClass(), bean.getClass()); if (method != null) { Object[] args = { bean }; try { method.invoke(parentObject, args); } catch (Exception e) { throw new JellyException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e ); } } else { BeanUtils.setProperty(parentObject, tagName, bean); } } } else { // lets try find a parent List to add this bean to CollectionTag tag = (CollectionTag) findAncestorWithClass(CollectionTag.class); if (tag != null) { tag.addItem(bean); } else { log.warn( "Could not add bean to parent for bean: " + bean ); } } } }
|
protected void processBean(String var, Object bean) throws Exception { if (var != null) { context.setVariable(var, bean); } // now lets try set the parent property via calling the adder or the setter method if (bean != null) { Object parentObject = getParentObject(); if (parentObject != null) { if (parentObject instanceof Collection) { Collection collection = (Collection) parentObject; collection.add(bean); } else if(var == null) { // lets see if there's a setter method... Method method = findAddMethod(parentObject.getClass(), bean.getClass()); if (method != null) { Object[] args = { bean }; try { method.invoke(parentObject, args); } catch (Exception e) { throw new JellyException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e ); } } else if(var == null) { BeanUtils.setProperty(parentObject, tagName, bean); } } } else if(var == null) { // lets try find a parent List to add this bean to CollectionTag tag = (CollectionTag) findAncestorWithClass(CollectionTag.class); if (tag != null) { tag.addItem(bean); } else if(var == null) { log.warn( "Could not add bean to parent for bean: " + bean ); } } } }
| 1,109,836
|
private static void createAndShowGUI() { contentFrame = new JFrame("Haploview Error Log"); contentFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); JComponent newContentPane = new JPanel(); newContentPane.setOpaque(true); //content panes must be opaque errorTextArea = new JTextArea(15,50); errorTextArea.setEditable(false); errorTextArea.setLineWrap(true); JScrollPane scrollPane = new JScrollPane(errorTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); errorTextArea.append("*************************\n"+ "If you are reporting a problem please include the contents of this log.\njcbarret@broad.mit.edu\n"+ "*************************\n"); newContentPane.add(scrollPane); contentFrame.setContentPane(newContentPane); contentFrame.pack(); contentFrame.setVisible(true); }
|
private static void createAndShowGUI() { contentFrame = new JFrame("Haploview Error Log"); contentFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); JComponent newContentPane = new JPanel(); newContentPane.setOpaque(true); //content panes must be opaque errorTextArea = new JTextArea(15,50); errorTextArea.setEditable(false); errorTextArea.setLineWrap(true); JScrollPane scrollPane = new JScrollPane(errorTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); errorTextArea.append("*************************\n"+ "If you are reporting a problem please include the contents of this log.\n"+ Constants.EMAIL_STRING+"\n"+ "*************************\n"); newContentPane.add(scrollPane); contentFrame.setContentPane(newContentPane); contentFrame.pack(); contentFrame.setVisible(true); }
| 1,109,837
|
public String getURL(String action) { return doc.getURL(action, context); }
|
public String getURL(String action) { return doc.getURL(action, context); }
| 1,109,838
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = (SQLDatabase) so; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = (SQLDatabase) so; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
| 1,109,839
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = (SQLDatabase) so; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = sd; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
| 1,109,840
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = (SQLDatabase) so; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
|
public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } SQLObject so = (SQLObject) p.getLastPathComponent(); if (so instanceof SQLDatabase) { DBConnectionSpec dbcs = ((SQLDatabase) so).getConnectionSpec(); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = (SQLDatabase) so; dbcsPanel.setDbcs(dbcs); propDialog.setVisible(true); propDialog.requestFocus(); } else if (so instanceof SQLCatalog) { // XXX: no action yet } else if (so instanceof SQLSchema) { // XXX: no action yet } else if (so instanceof SQLTable) { // XXX: no action yet } else if (so instanceof SQLColumn) { // XXX: no action yet } }
| 1,109,841
|
public void cleanup() throws ArchitectException { setCleanupExceptionMessage("Could not populate catalog dropdown!"); catalogComboBox.removeAllItems(); catalogComboBox.setEnabled(false); schemaComboBox.removeAllItems(); schemaComboBox.setEnabled(false); try { if (database.isCatalogContainer()) { for (SQLObject o : (List<SQLObject>) database.getChildren()) { catalogComboBox.addItem(o); } catalogComboBox.setEnabled(true); } if (database.isSchemaContainer()) { for (SQLObject o : (List<SQLObject>) database.getChildren()) { schemaComboBox.addItem(o); } schemaComboBox.setEnabled(true); System.out.println ("Schema enabled"); } } catch (ArchitectException ex) { JOptionPane.showMessageDialog(panel, "Database Connection Erorr", "Error", JOptionPane.ERROR_MESSAGE); database = null; } finally { } }
|
public void cleanup() throws ArchitectException { setCleanupExceptionMessage("Could not populate catalog dropdown!"); catalogComboBox.removeAllItems(); catalogComboBox.setEnabled(false); schemaComboBox.removeAllItems(); schemaComboBox.setEnabled(false); try { if (database.isCatalogContainer()) { for (SQLObject o : (List<SQLObject>) database.getChildren()) { catalogComboBox.addItem(o); } catalogComboBox.setEnabled(true); } if (database.isSchemaContainer()) { for (SQLObject o : (List<SQLObject>) database.getChildren()) { schemaComboBox.addItem(o); } schemaComboBox.setEnabled(true); logger.info("Schema enabled"); } } catch (ArchitectException ex) { JOptionPane.showMessageDialog(panel, "Database Connection Erorr", "Error", JOptionPane.ERROR_MESSAGE); database = null; } finally { } }
| 1,109,842
|
public void testPhotoAddition() { String testImgDir = "c:\\java\\photovault\\testfiles"; String fname = "test1.jpg"; File f = new File( testImgDir, fname ); PhotoInfo photo = null; try { photo = PhotoInfo.addToDB( f ); } catch ( PhotoNotFoundException e ) { fail( "Could not find photo: " + e.getMessage() ); } PhotoFolder folder = null; // Create a folder for the photo try { folder = PhotoFolder.create( "PhotoAdditionTest", PhotoFolder.getRoot() ); folder.addPhoto( photo ); assertEquals( "Photo not visible in folders' photo count", folder.getPhotoCount(), 1 ); } finally { // Clean up the test folder PhotoFolder parent = folder.getParentFolder(); parent.removeSubfolder( folder ); } }
|
public void testPhotoAddition() { String fname = "test1.jpg"; File f = new File( testImgDir, fname ); PhotoInfo photo = null; try { photo = PhotoInfo.addToDB( f ); } catch ( PhotoNotFoundException e ) { fail( "Could not find photo: " + e.getMessage() ); } PhotoFolder folder = null; // Create a folder for the photo try { folder = PhotoFolder.create( "PhotoAdditionTest", PhotoFolder.getRoot() ); folder.addPhoto( photo ); assertEquals( "Photo not visible in folders' photo count", folder.getPhotoCount(), 1 ); } finally { // Clean up the test folder PhotoFolder parent = folder.getParentFolder(); parent.removeSubfolder( folder ); } }
| 1,109,843
|
public void actionPerformed(ActionEvent evt) { // update the progress bar try { Integer jobSize = monitorable.getJobSize(); if (jobSize == null) { bar.setIndeterminate(true); } else { bar.setIndeterminate(false); bar.setMaximum(jobSize.intValue()); } if (label != null) { label.setVisible(true); } bar.setVisible(true); bar.setValue(monitorable.getProgress()); bar.setIndeterminate(false); } catch (ArchitectException e) { logger.error("Couldn't update progress bar (Monitorable threw an exception)", e); } finally { try { if (monitorable.isFinished()) { if (label != null) { label.setVisible(false); } bar.setVisible(false); timer.stop(); } } catch (ArchitectException e1) { logger.error("Couldn't tell if Monitorable was finished (it threw an exception)", e1); } } }
|
public void actionPerformed(ActionEvent evt) { // update the progress bar logger.debug("all done, terminating timer thread..."); try { logger.debug("monitorable.isFinished():" + monitorable.isFinished()); Integer jobSize = monitorable.getJobSize(); if (jobSize == null) { bar.setIndeterminate(true); } else { bar.setIndeterminate(false); bar.setMaximum(jobSize.intValue()); } if (label != null) { label.setVisible(true); } bar.setVisible(true); bar.setValue(monitorable.getProgress()); bar.setIndeterminate(false); } catch (ArchitectException e) { logger.error("Couldn't update progress bar (Monitorable threw an exception)", e); } finally { logger.debug("all done, terminating timer thread..."); try { logger.debug("monitorable.isFinished():" + monitorable.isFinished()); if (monitorable.isFinished()) { if (label != null) { label.setVisible(false); } bar.setVisible(false); timer.stop(); } } catch (ArchitectException e1) { logger.error("Couldn't tell if Monitorable was finished (it threw an exception)", e1); } } }
| 1,109,844
|
protected void revertToUserSettings() throws ArchitectException { dtm.setRoot(new DefaultMutableTreeNode()); LoadJDBCDrivers ljd = new LoadJDBCDrivers(session.getDriverJarList()); LoadJDBCDriversWorker worker = new LoadJDBCDriversWorker(ljd); ProgressWatcher watcher = new ProgressWatcher(progressBar,ljd,progressLabel); new javax.swing.Timer(50, watcher).start(); new Thread(worker).start(); }
|
protected void revertToUserSettings() throws ArchitectException { dtm.setRoot(new DefaultMutableTreeNode()); LoadJDBCDrivers ljd = new LoadJDBCDrivers(session.getDriverJarList()); LoadJDBCDriversWorker worker = new LoadJDBCDriversWorker(ljd); ProgressWatcher watcher = new ProgressWatcher(progressBar,ljd,progressLabel); new Thread(worker).start(); }
| 1,109,848
|
public void doStuff() { finished = false; hasStarted = true; if (isCanceled() || finished) return; SQLDatabase target = new SQLDatabase(targetDataSource); statusLabel.setText("Creating objects in target database " + target.getDataSource() ); // XXX This is not being used but possibly should be?? //ProgressWatcher pw = new ProgressWatcher(progressBar, this, statusLabel); stmtsTried = 0; stmtsCompleted = 0; logger.debug("the Target Database is: " + target.getDataSource()); Connection con; Statement stmt; try { con = target.getConnection(); } catch (ArchitectException ex) { finished = true; throw new RuntimeException( "Couldn't connect to target database: "+ex.getMessage() +"\nPlease check the connection settings and try again.", ex); } catch (Exception ex) { finished = true; logger.error("Unexpected exception in DDL generation", ex); throw new RuntimeException("You have to specify a target database connection" +"\nbefore executing this script."); } try { logger.debug("the connection thinks it is: " + con.getMetaData().getURL()); stmt = con.createStatement(); } catch (SQLException ex) { finished = true; throw new RuntimeException("Couldn't generate DDL statements: " +ex.getMessage()+"\nThe problem was reported by " + "the target database."); } LogWriter logWriter = null; try { logWriter = new LogWriter(ArchitectSession.getInstance().getUserSettings().getDDLUserSettings().getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); } catch (ArchitectException ex) { finished = true; final Exception fex = ex; throw new RuntimeException("A problem with the DDL log file " + "prevented\n DDL generation from running:\n\n"+fex.getMessage()); } try { logWriter.info("Starting DDL Generation at " + new java.util.Date(System.currentTimeMillis())); logWriter.info("Database Target: " + target.getDataSource()); logWriter.info("Playpen Dump: " + target.getDataSource()); statementResultList.add(new LabelValueBean("Target Table Creation Log" ,"\n")); Iterator it = statements.iterator(); while (it.hasNext() && !finished && !isCanceled()) { DDLStatement ddlStmt = (DDLStatement) it.next(); String status = "Unknown"; try { stmtsTried++; logWriter.info("executing: " + ddlStmt.getSQLText()); stmt.executeUpdate(ddlStmt.getSQLText()); stmtsCompleted++; status = "OK"; } catch (SQLException ex) { final Exception fex = ex; final String fsql = ddlStmt.getSQLText(); final LogWriter fLogWriter = logWriter; logWriter.info("sql statement failed: " + ex.getMessage()); status = "SQL statement failed: " + ex.getMessage(); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { JTextArea jta = new JTextArea(fsql,25,40); jta.setEditable(false); JScrollPane jsp = new JScrollPane(jta); JLabel errorLabel = new JLabel("<html>This SQL statement failed: "+fex.getMessage() +"<p>Do you want to continue?</html>"); JPanel jp = new JPanel(new BorderLayout()); jp.add(jsp,BorderLayout.CENTER); jp.add(errorLabel,BorderLayout.SOUTH); int decision = JOptionPane.showConfirmDialog (SQLScriptDialog.this, jp, "SQL Failure", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { fLogWriter.info("Export cancelled by user."); statementResultList.add( new LabelValueBean("Wizard cancelled by user", "")); cancelJob(); } } }); } catch (InterruptedException ex2) { logger.warn("DDL Worker was interrupted during InvokeAndWait", ex2); status = "DDL Worker was interrupted during InvokeAndWait"; } catch (InvocationTargetException ex2) { final Exception fex2 = ex2; status = "Worker thread died: " +fex2.getMessage(); throw new RuntimeException("Worker thread died: " +fex2.getMessage()); } if (isCanceled()) { finished = true; // don't return, we might as well display how many statements ended up being processed... } } finally { statementResultList.add(new LabelValueBean( ddlStmt.toString(),status)); } } } catch (Exception exc){ logWriter.info("Caught Unexpected Exception " + exc); ASUtils.showExceptionDialog( SQLScriptDialog.this, "Couldn't finish running this SQL Script due to the following unexpected exception:", exc); } finally { final String resultsMessage = (stmtsCompleted == 0 ? "Did not execute any out of " : "Successfully executed " + stmtsCompleted + " out of ") + stmtsTried + " statements."; logWriter.info(resultsMessage); JOptionPane.showMessageDialog(SQLScriptDialog.this, resultsMessage); // flush and close the LogWriter logWriter.flush(); logWriter.close(); try { if (stmt != null) stmt.close(); } catch (SQLException ex) { logger.error("SQLException while closing statement", ex); } try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } finished = true; }
|
public void doStuff() { finished = false; hasStarted = true; if (isCanceled() || finished) return; SQLDatabase target = new SQLDatabase(targetDataSource); statusLabel.setText("Creating objects in target database " + target.getDataSource() ); // XXX This is not being used but possibly should be?? //ProgressWatcher pw = new ProgressWatcher(progressBar, this, statusLabel); stmtsTried = 0; stmtsCompleted = 0; logger.debug("the Target Database is: " + target.getDataSource()); Connection con; Statement stmt; try { con = target.getConnection(); } catch (ArchitectException ex) { finished = true; throw new RuntimeException( "Couldn't connect to target database: "+ex.getMessage() +"\nPlease check the connection settings and try again.", ex); } catch (Exception ex) { finished = true; logger.error("Unexpected exception in DDL generation", ex); throw new RuntimeException("You have to specify a target database connection" +"\nbefore executing this script."); } try { logger.debug("the connection thinks it is: " + con.getMetaData().getURL()); stmt = con.createStatement(); } catch (SQLException ex) { finished = true; throw new RuntimeException("Couldn't generate DDL statements: " +ex.getMessage()+"\nThe problem was reported by " + "the target database."); } LogWriter logWriter = null; try { logWriter = new LogWriter(ArchitectSessionImpl.getInstance().getUserSettings().getDDLUserSettings().getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); } catch (ArchitectException ex) { finished = true; final Exception fex = ex; throw new RuntimeException("A problem with the DDL log file " + "prevented\n DDL generation from running:\n\n"+fex.getMessage()); } try { logWriter.info("Starting DDL Generation at " + new java.util.Date(System.currentTimeMillis())); logWriter.info("Database Target: " + target.getDataSource()); logWriter.info("Playpen Dump: " + target.getDataSource()); statementResultList.add(new LabelValueBean("Target Table Creation Log" ,"\n")); Iterator it = statements.iterator(); while (it.hasNext() && !finished && !isCanceled()) { DDLStatement ddlStmt = (DDLStatement) it.next(); String status = "Unknown"; try { stmtsTried++; logWriter.info("executing: " + ddlStmt.getSQLText()); stmt.executeUpdate(ddlStmt.getSQLText()); stmtsCompleted++; status = "OK"; } catch (SQLException ex) { final Exception fex = ex; final String fsql = ddlStmt.getSQLText(); final LogWriter fLogWriter = logWriter; logWriter.info("sql statement failed: " + ex.getMessage()); status = "SQL statement failed: " + ex.getMessage(); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { JTextArea jta = new JTextArea(fsql,25,40); jta.setEditable(false); JScrollPane jsp = new JScrollPane(jta); JLabel errorLabel = new JLabel("<html>This SQL statement failed: "+fex.getMessage() +"<p>Do you want to continue?</html>"); JPanel jp = new JPanel(new BorderLayout()); jp.add(jsp,BorderLayout.CENTER); jp.add(errorLabel,BorderLayout.SOUTH); int decision = JOptionPane.showConfirmDialog (SQLScriptDialog.this, jp, "SQL Failure", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { fLogWriter.info("Export cancelled by user."); statementResultList.add( new LabelValueBean("Wizard cancelled by user", "")); cancelJob(); } } }); } catch (InterruptedException ex2) { logger.warn("DDL Worker was interrupted during InvokeAndWait", ex2); status = "DDL Worker was interrupted during InvokeAndWait"; } catch (InvocationTargetException ex2) { final Exception fex2 = ex2; status = "Worker thread died: " +fex2.getMessage(); throw new RuntimeException("Worker thread died: " +fex2.getMessage()); } if (isCanceled()) { finished = true; // don't return, we might as well display how many statements ended up being processed... } } finally { statementResultList.add(new LabelValueBean( ddlStmt.toString(),status)); } } } catch (Exception exc){ logWriter.info("Caught Unexpected Exception " + exc); ASUtils.showExceptionDialog( SQLScriptDialog.this, "Couldn't finish running this SQL Script due to the following unexpected exception:", exc); } finally { final String resultsMessage = (stmtsCompleted == 0 ? "Did not execute any out of " : "Successfully executed " + stmtsCompleted + " out of ") + stmtsTried + " statements."; logWriter.info(resultsMessage); JOptionPane.showMessageDialog(SQLScriptDialog.this, resultsMessage); // flush and close the LogWriter logWriter.flush(); logWriter.close(); try { if (stmt != null) stmt.close(); } catch (SQLException ex) { logger.error("SQLException while closing statement", ex); } try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } finished = true; }
| 1,109,849
|
public CoreUserSettings read(ArchitectSession session) throws IOException { logger.debug("loading UserSettings from java.util.prefs."); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } logger.debug("Preferences class = " + prefs.getClass()); CoreUserSettings userSettings = new CoreUserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } // XXX Put prefs in sub-node, just delete it before you start. for (; i <= 99; i++) { if (prefs.get(jarFilePrefName(i), null) != null) { prefs.remove(jarFilePrefName(i)); } } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", null)); UserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setString(ETLUserSettings.PROP_PL_ENGINE_PATH, prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setString(ETLUserSettings.PROP_ETL_LOG_PATH, prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setString(DDLUserSettings.PROP_DDL_LOG_PATH,prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); qfaUserSettings.setBoolean(QFAUserSettings.EXCEPTION_REPORTING,prefs.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
|
public CoreUserSettings read(ArchitectSession session) throws IOException { logger.debug("loading UserSettings from java.util.prefs."); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } logger.debug("Preferences class = " + prefs.getClass()); CoreUserSettings userSettings = new CoreUserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } // XXX Put prefs in sub-node, just delete it before you start. for (; i <= 99; i++) { if (prefs.get(jarFilePrefName(i), null) != null) { prefs.remove(jarFilePrefName(i)); } } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", null)); UserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setString(ETLUserSettings.PROP_PL_ENGINE_PATH, prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setString(ETLUserSettings.PROP_ETL_LOG_PATH, prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setString(DDLUserSettings.PROP_DDL_LOG_PATH,prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); qfaUserSettings.setBoolean(QFAUserSettings.EXCEPTION_REPORTING,prefs.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
| 1,109,850
|
public CoreUserSettings read(ArchitectSession session) throws IOException { logger.debug("loading UserSettings from java.util.prefs."); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } logger.debug("Preferences class = " + prefs.getClass()); CoreUserSettings userSettings = new CoreUserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } // XXX Put prefs in sub-node, just delete it before you start. for (; i <= 99; i++) { if (prefs.get(jarFilePrefName(i), null) != null) { prefs.remove(jarFilePrefName(i)); } } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", null)); UserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setString(ETLUserSettings.PROP_PL_ENGINE_PATH, prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setString(ETLUserSettings.PROP_ETL_LOG_PATH, prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setString(DDLUserSettings.PROP_DDL_LOG_PATH,prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); qfaUserSettings.setBoolean(QFAUserSettings.EXCEPTION_REPORTING,prefs.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
|
public CoreUserSettings read(ArchitectSession session) throws IOException { logger.debug("loading UserSettings from java.util.prefs."); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } logger.debug("Preferences class = " + prefs.getClass()); CoreUserSettings userSettings = new CoreUserSettings(); int i; for (i = 0; i <= 99; i++) { String jarName = prefs.get(jarFilePrefName(i), null); logger.debug("read Jar File entry: " + jarName); if (jarName == null) { break; } logger.debug("Adding JarName: " + jarName); session.addDriverJar(jarName); } // XXX Put prefs in sub-node, just delete it before you start. for (; i <= 99; i++) { if (prefs.get(jarFilePrefName(i), null) != null) { prefs.remove(jarFilePrefName(i)); } } userSettings.setPlDotIniPath(prefs.get("PL.INI.PATH", null)); UserSettings swingUserSettings = userSettings.getSwingSettings(); swingUserSettings.setBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, prefs.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); etlUserSettings.setString(ETLUserSettings.PROP_PL_ENGINE_PATH, prefs.get(ETLUserSettings.PROP_PL_ENGINE_PATH, "")); etlUserSettings.setString(ETLUserSettings.PROP_ETL_LOG_PATH, prefs.get(ETLUserSettings.PROP_ETL_LOG_PATH, defaultHomeFile("etl.log"))); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); ddlUserSettings.setString(DDLUserSettings.PROP_DDL_LOG_PATH,prefs.get(DDLUserSettings.PROP_DDL_LOG_PATH, defaultHomeFile("ddl.log"))); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); qfaUserSettings.setBoolean(QFAUserSettings.EXCEPTION_REPORTING,prefs.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); printUserSettings.setDefaultPrinterName( prefs.get(PrintUserSettings.DEFAULT_PRINTER_NAME, "")); return userSettings; }
| 1,109,851
|
public void write(ArchitectSession session) throws ArchitectException { logger.debug("Saving prefs to java.util.prefs"); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } CoreUserSettings userSettings = session.getUserSettings(); List<String> driverJarList = session.getDriverJarList(); Iterator<String> it = driverJarList.iterator(); for (int i = 0 ; i <= 99; i++) { if (it.hasNext()) { String name = it.next(); logger.debug("Putting JAR " + i + " " + name); prefs.put(jarFilePrefName(i), name); } else { // XXX optimize this - make jar file be its own node, just delete the node before starting. prefs.remove(jarFilePrefName(i)); } } prefs.put("PL.INI.PATH", userSettings.getPlDotIniPath()); UserSettings swingUserSettings = userSettings.getSwingSettings(); prefs.putBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, swingUserSettings.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); prefs.put(ETLUserSettings.PROP_PL_ENGINE_PATH, etlUserSettings.getString(ETLUserSettings.PROP_PL_ENGINE_PATH,"")); prefs.put(ETLUserSettings.PROP_ETL_LOG_PATH, etlUserSettings.getString(ETLUserSettings.PROP_ETL_LOG_PATH,"")); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); prefs.put(DDLUserSettings.PROP_DDL_LOG_PATH, ddlUserSettings.getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); prefs.putBoolean(QFAUserSettings.EXCEPTION_REPORTING,qfaUserSettings.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); prefs.put(PrintUserSettings.DEFAULT_PRINTER_NAME, printUserSettings.getDefaultPrinterName()); try { prefs.flush(); } catch (BackingStoreException e) { throw new ArchitectException("Unable to flush Java preferences", e); } }
|
public void write(ArchitectSession session) throws ArchitectException { logger.debug("Saving prefs to java.util.prefs"); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } CoreUserSettings userSettings = session.getUserSettings(); List<String> driverJarList = session.getDriverJarList(); Iterator<String> it = driverJarList.iterator(); for (int i = 0 ; i <= 99; i++) { if (it.hasNext()) { String name = it.next(); logger.debug("Putting JAR " + i + " " + name); prefs.put(jarFilePrefName(i), name); } else { // XXX optimize this - make jar file be its own node, just delete the node before starting. prefs.remove(jarFilePrefName(i)); } } prefs.put("PL.INI.PATH", userSettings.getPlDotIniPath()); UserSettings swingUserSettings = userSettings.getSwingSettings(); prefs.putBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, swingUserSettings.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); prefs.put(ETLUserSettings.PROP_PL_ENGINE_PATH, etlUserSettings.getString(ETLUserSettings.PROP_PL_ENGINE_PATH,"")); prefs.put(ETLUserSettings.PROP_ETL_LOG_PATH, etlUserSettings.getString(ETLUserSettings.PROP_ETL_LOG_PATH,"")); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); prefs.put(DDLUserSettings.PROP_DDL_LOG_PATH, ddlUserSettings.getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); prefs.putBoolean(QFAUserSettings.EXCEPTION_REPORTING,qfaUserSettings.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); prefs.put(PrintUserSettings.DEFAULT_PRINTER_NAME, printUserSettings.getDefaultPrinterName()); try { prefs.flush(); } catch (BackingStoreException e) { throw new ArchitectException("Unable to flush Java preferences", e); } }
| 1,109,852
|
public void write(ArchitectSession session) throws ArchitectException { logger.debug("Saving prefs to java.util.prefs"); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } CoreUserSettings userSettings = session.getUserSettings(); List<String> driverJarList = session.getDriverJarList(); Iterator<String> it = driverJarList.iterator(); for (int i = 0 ; i <= 99; i++) { if (it.hasNext()) { String name = it.next(); logger.debug("Putting JAR " + i + " " + name); prefs.put(jarFilePrefName(i), name); } else { // XXX optimize this - make jar file be its own node, just delete the node before starting. prefs.remove(jarFilePrefName(i)); } } prefs.put("PL.INI.PATH", userSettings.getPlDotIniPath()); UserSettings swingUserSettings = userSettings.getSwingSettings(); prefs.putBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, swingUserSettings.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); prefs.put(ETLUserSettings.PROP_PL_ENGINE_PATH, etlUserSettings.getString(ETLUserSettings.PROP_PL_ENGINE_PATH,"")); prefs.put(ETLUserSettings.PROP_ETL_LOG_PATH, etlUserSettings.getString(ETLUserSettings.PROP_ETL_LOG_PATH,"")); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); prefs.put(DDLUserSettings.PROP_DDL_LOG_PATH, ddlUserSettings.getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); prefs.putBoolean(QFAUserSettings.EXCEPTION_REPORTING,qfaUserSettings.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); prefs.put(PrintUserSettings.DEFAULT_PRINTER_NAME, printUserSettings.getDefaultPrinterName()); try { prefs.flush(); } catch (BackingStoreException e) { throw new ArchitectException("Unable to flush Java preferences", e); } }
|
public void write(ArchitectSession session) throws ArchitectException { logger.debug("Saving prefs to java.util.prefs"); if ( prefs == null ) { prefs = ArchitectFrame.getMainInstance().getPrefs(); } CoreUserSettings userSettings = session.getUserSettings(); List<String> driverJarList = session.getDriverJarList(); Iterator<String> it = driverJarList.iterator(); for (int i = 0 ; i <= 99; i++) { if (it.hasNext()) { String name = it.next(); logger.debug("Putting JAR " + i + " " + name); prefs.put(jarFilePrefName(i), name); } else { // XXX optimize this - make jar file be its own node, just delete the node before starting. prefs.remove(jarFilePrefName(i)); } } prefs.put("PL.INI.PATH", userSettings.getPlDotIniPath()); UserSettings swingUserSettings = userSettings.getSwingSettings(); prefs.putBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, swingUserSettings.getBoolean(SwingUserSettings.PLAYPEN_RENDER_ANTIALIASED, false)); ETLUserSettings etlUserSettings = userSettings.getETLUserSettings(); prefs.put(ETLUserSettings.PROP_PL_ENGINE_PATH, etlUserSettings.getString(ETLUserSettings.PROP_PL_ENGINE_PATH,"")); prefs.put(ETLUserSettings.PROP_ETL_LOG_PATH, etlUserSettings.getString(ETLUserSettings.PROP_ETL_LOG_PATH,"")); DDLUserSettings ddlUserSettings = userSettings.getDDLUserSettings(); prefs.put(DDLUserSettings.PROP_DDL_LOG_PATH, ddlUserSettings.getString(DDLUserSettings.PROP_DDL_LOG_PATH,"")); QFAUserSettings qfaUserSettings = userSettings.getQfaUserSettings(); prefs.putBoolean(QFAUserSettings.EXCEPTION_REPORTING,qfaUserSettings.getBoolean(QFAUserSettings.EXCEPTION_REPORTING,true)); PrintUserSettings printUserSettings = userSettings.getPrintUserSettings(); prefs.put(PrintUserSettings.DEFAULT_PRINTER_NAME, printUserSettings.getDefaultPrinterName()); try { prefs.flush(); } catch (BackingStoreException e) { throw new ArchitectException("Unable to flush Java preferences", e); } }
| 1,109,853
|
public void removeAllDriverJars() { driverJarList.clear(); }
|
public void removeAllDriverJars() { driverJarList.clear(); }
| 1,109,855
|
public List getConnections() { List connections = new ArrayList(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add(next); } } Collections.sort(connections); return connections; }
|
public List getConnections() { List<ArchitectDataSource> connections = new ArrayList<ArchitectDataSource>(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add(next); } } Collections.sort(connections); return connections; }
| 1,109,857
|
public List getConnections() { List connections = new ArrayList(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add(next); } } Collections.sort(connections); return connections; }
|
public List getConnections() { List connections = new ArrayList(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add((ArchitectDataSource) next); } } Collections.sort(connections); return connections; }
| 1,109,858
|
public List getConnections() { List connections = new ArrayList(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add(next); } } Collections.sort(connections); return connections; }
|
public List getConnections() { List connections = new ArrayList(); Iterator it = fileSections.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof ArchitectDataSource) { connections.add(next); } } Collections.sort(connections); return connections; }
| 1,109,859
|
public void actionPerformed(ActionEvent evt) { pp.fireCancel(); SQLTable t = new SQLTable(); try { t.initFolders(true); } catch (ArchitectException e) { logger.error("Couldn't add folder to table \""+t.getName()+"\"", e); JOptionPane.showMessageDialog(null, "Failed to add folder to table:\n"+e.getMessage()); } t.setName("New_Table"); TablePane tp = new TablePane(t, pp); pp.addFloating(tp); PlayPen.setMouseMode(PlayPen.MouseModeType.CREATING_TABLE); }
|
public void actionPerformed(ActionEvent evt) { pp.fireCancel(); SQLTable t = null; try { t.initFolders(true); } catch (ArchitectException e) { logger.error("Couldn't add folder to table \""+t.getName()+"\"", e); JOptionPane.showMessageDialog(null, "Failed to add folder to table:\n"+e.getMessage()); } t.setName("New_Table"); TablePane tp = new TablePane(t, pp); pp.addFloating(tp); PlayPen.setMouseMode(PlayPen.MouseModeType.CREATING_TABLE); }
| 1,109,861
|
public void doTag(XMLOutput output) throws Exception { Object obj = getObject(); if ( this.task != null ) { Method method = MethodUtils.getAccessibleMethod( this.task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } else { getBody().run(context, output); } this.task.perform(); } else { getBody().run( context, output ); AntTagSupport parent = (AntTagSupport) getParent(); Object parentObj = parent.getObject(); IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( getAntProject(), parentObj, getObject(), getTagName() ); } catch (Exception e) { } } }
|
public void doTag(XMLOutput output) throws Exception { Object obj = getObject(); if ( this.task != null ) { Method method = MethodUtils.getAccessibleMethod( this.task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } else { getBody().run(context, output); } this.task.perform(); } else { getBody().run( context, output ); AntTagSupport parent = (AntTagSupport) findAncestorWithClass(AntTagSupport.class); Object parentObj = parent.getObject(); IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( getAntProject(), parentObj, getObject(), getTagName() ); } catch (Exception e) { } } }
| 1,109,863
|
public Connection createConnection() throws SQLException { try { if (dataSource.getDriverClass() == null || dataSource.getDriverClass().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC Driver class specified."); } if (dataSource.getUrl() == null || dataSource.getUrl().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC URL."); } if (dataSource.getUser() == null || dataSource.getUser().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC username."); } ArchitectSession session = ArchitectSession.getInstance(); if (session == null) { throw new SQLException ("Can't connect to database \""+dataSource.getName()+ "\" because ArchitectSession.getInstance() returned null"); } if (logger.isDebugEnabled()) { ClassLoader cl = this.getClass().getClassLoader(); StringBuffer loaders = new StringBuffer(); loaders.append("Local Classloader chain: "); while (cl != null) { loaders.append(cl).append(", "); cl = cl.getParent(); } logger.debug(loaders); } Driver driver = (Driver) Class.forName(dataSource.getDriverClass(), true, session.getJDBCClassLoader()).newInstance(); logger.info("Driver Class "+dataSource.getDriverClass()+" loaded without exception"); if (!driver.acceptsURL(dataSource.getUrl())) { throw new SQLException("Couldn't connect to database:\n" +"JDBC Driver "+dataSource.getDriverClass()+"\n" +"does not accept the URL "+dataSource.getUrl()); } Properties connectionProps = new Properties(); connectionProps.setProperty("user", dataSource.getUser()); connectionProps.setProperty("password", dataSource.getPass()); Connection realConnection = driver.connect(dataSource.getUrl(), connectionProps); if (realConnection == null) { throw new SQLException("JDBC Driver returned a null connection!"); } Connection connection = ConnectionDecorator.createFacade(realConnection); logger.debug("Connection class is: " + connection.getClass().getName()); return connection; } catch (ClassNotFoundException e) { logger.warn("Driver Class not found", e); throw new SQLException("JDBC Driver \""+dataSource.getDriverClass() +"\" not found."); } catch (InstantiationException e) { logger.error("Creating SQL Exception to conform to interface. Real exception is: ", e); throw new SQLException("Couldn't create an instance of the " + "JDBC driver '"+dataSource.getDriverClass()+"'. "+e.getMessage()); } catch (IllegalAccessException e) { logger.error("Creating SQL Exception to conform to interface. Real exception is: ", e); throw new SQLException("Couldn't connect to database because the " + "JDBC driver has no public constructor (this is bad). "+e.getMessage()); } }
|
public Connection createConnection() throws SQLException { try { if (dataSource.getDriverClass() == null || dataSource.getDriverClass().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC Driver class specified."); } if (dataSource.getUrl() == null || dataSource.getUrl().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC URL."); } if (dataSource.getUser() == null || dataSource.getUser().trim().length() == 0) { throw new SQLException("Connection \""+dataSource.getName()+"\" has no JDBC username."); } ArchitectSession session = ArchitectSessionImpl.getInstance(); if (session == null) { throw new SQLException ("Can't connect to database \""+dataSource.getName()+ "\" because ArchitectSession.getInstance() returned null"); } if (logger.isDebugEnabled()) { ClassLoader cl = this.getClass().getClassLoader(); StringBuffer loaders = new StringBuffer(); loaders.append("Local Classloader chain: "); while (cl != null) { loaders.append(cl).append(", "); cl = cl.getParent(); } logger.debug(loaders); } Driver driver = (Driver) Class.forName(dataSource.getDriverClass(), true, session.getJDBCClassLoader()).newInstance(); logger.info("Driver Class "+dataSource.getDriverClass()+" loaded without exception"); if (!driver.acceptsURL(dataSource.getUrl())) { throw new SQLException("Couldn't connect to database:\n" +"JDBC Driver "+dataSource.getDriverClass()+"\n" +"does not accept the URL "+dataSource.getUrl()); } Properties connectionProps = new Properties(); connectionProps.setProperty("user", dataSource.getUser()); connectionProps.setProperty("password", dataSource.getPass()); Connection realConnection = driver.connect(dataSource.getUrl(), connectionProps); if (realConnection == null) { throw new SQLException("JDBC Driver returned a null connection!"); } Connection connection = ConnectionDecorator.createFacade(realConnection); logger.debug("Connection class is: " + connection.getClass().getName()); return connection; } catch (ClassNotFoundException e) { logger.warn("Driver Class not found", e); throw new SQLException("JDBC Driver \""+dataSource.getDriverClass() +"\" not found."); } catch (InstantiationException e) { logger.error("Creating SQL Exception to conform to interface. Real exception is: ", e); throw new SQLException("Couldn't create an instance of the " + "JDBC driver '"+dataSource.getDriverClass()+"'. "+e.getMessage()); } catch (IllegalAccessException e) { logger.error("Creating SQL Exception to conform to interface. Real exception is: ", e); throw new SQLException("Couldn't connect to database because the " + "JDBC driver has no public constructor (this is bad). "+e.getMessage()); } }
| 1,109,864
|
public static void main(String[] args) { int exitValue = 0; String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); //TODO:do some version checking and bitch at people with old JVMs /*StringTokenizer st = new StringTokenizer(ver, "."); while (st.hasMoreTokens()){ System.out.println(st.nextToken()); } */ String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n") || args[a].equalsIgnoreCase("-nogui")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx1024m -classpath \"" + jarfile + "\""; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); //start up a thread to simply pump out all messages to stdout StreamGobbler isg = new StreamGobbler(child.getInputStream()); isg.start(); //while the child is alive we wait for error messages boolean dead = false; StringBuffer errorMsg = new StringBuffer("Fatal Error:\n"); BufferedReader besr = new BufferedReader(new InputStreamReader(child.getErrorStream())); String line = null; while ( !dead && (line = besr.readLine()) != null) { if(line.lastIndexOf("Memory") != -1) { errorMsg.append(line); //if the child generated an "Out of Memory" error message, kill it child.destroy(); dead = true; }else { //for any other errors we show them to the user if(headless) { //if were in headless (command line) mode, then print the error text to command line System.err.println(line); } else { //otherwise print it to the error textarea if(errorTextArea == null) { //if this is the first error line then we need to create the JFrame with the //text area javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); } //if the user closed the contentFrame, then we want to reopen it when theres error text if(!contentFrame.isVisible()) { contentFrame.setVisible(true); } errorTextArea.append(line + "\n"); errorTextArea.setCaretPosition(errorTextArea.getDocument().getLength()); } } } final String realErrorMsg = errorMsg.toString(); //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.err.println(errorMsg); }else{ Runnable showRip = new Runnable() { public void run() { JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, realErrorMsg, null, JOptionPane.ERROR_MESSAGE);} }; SwingUtilities.invokeAndWait(showRip); } exitValue = -1; } } catch (Exception e) { if (headless){ System.err.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } } System.exit(exitValue); }
|
public static void main(String[] args) { int exitValue = 0; String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); //TODO:do some version checking and bitch at people with old JVMs /*StringTokenizer st = new StringTokenizer(ver, "."); while (st.hasMoreTokens()){ System.out.println(st.nextToken()); } */ String jarfile; if (System.getProperty("java.class.path").indexOf(" ") > 0 ){ jarfile = ("\""); jarfile += System.getProperty("java.class.path"); jarfile += "\""; }else{ jarfile = System.getProperty("java.class.path"); } String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n") || args[a].equalsIgnoreCase("-nogui")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx1024m -classpath \"" + jarfile + "\""; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); //start up a thread to simply pump out all messages to stdout StreamGobbler isg = new StreamGobbler(child.getInputStream()); isg.start(); //while the child is alive we wait for error messages boolean dead = false; StringBuffer errorMsg = new StringBuffer("Fatal Error:\n"); BufferedReader besr = new BufferedReader(new InputStreamReader(child.getErrorStream())); String line = null; while ( !dead && (line = besr.readLine()) != null) { if(line.lastIndexOf("Memory") != -1) { errorMsg.append(line); //if the child generated an "Out of Memory" error message, kill it child.destroy(); dead = true; }else { //for any other errors we show them to the user if(headless) { //if were in headless (command line) mode, then print the error text to command line System.err.println(line); } else { //otherwise print it to the error textarea if(errorTextArea == null) { //if this is the first error line then we need to create the JFrame with the //text area javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); } //if the user closed the contentFrame, then we want to reopen it when theres error text if(!contentFrame.isVisible()) { contentFrame.setVisible(true); } errorTextArea.append(line + "\n"); errorTextArea.setCaretPosition(errorTextArea.getDocument().getLength()); } } } final String realErrorMsg = errorMsg.toString(); //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.err.println(errorMsg); }else{ Runnable showRip = new Runnable() { public void run() { JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, realErrorMsg, null, JOptionPane.ERROR_MESSAGE);} }; SwingUtilities.invokeAndWait(showRip); } exitValue = -1; } } catch (Exception e) { if (headless){ System.err.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } } System.exit(exitValue); }
| 1,109,865
|
public static void main(String[] args) { int exitValue = 0; String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); //TODO:do some version checking and bitch at people with old JVMs /*StringTokenizer st = new StringTokenizer(ver, "."); while (st.hasMoreTokens()){ System.out.println(st.nextToken()); } */ String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n") || args[a].equalsIgnoreCase("-nogui")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx1024m -classpath \"" + jarfile + "\""; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); //start up a thread to simply pump out all messages to stdout StreamGobbler isg = new StreamGobbler(child.getInputStream()); isg.start(); //while the child is alive we wait for error messages boolean dead = false; StringBuffer errorMsg = new StringBuffer("Fatal Error:\n"); BufferedReader besr = new BufferedReader(new InputStreamReader(child.getErrorStream())); String line = null; while ( !dead && (line = besr.readLine()) != null) { if(line.lastIndexOf("Memory") != -1) { errorMsg.append(line); //if the child generated an "Out of Memory" error message, kill it child.destroy(); dead = true; }else { //for any other errors we show them to the user if(headless) { //if were in headless (command line) mode, then print the error text to command line System.err.println(line); } else { //otherwise print it to the error textarea if(errorTextArea == null) { //if this is the first error line then we need to create the JFrame with the //text area javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); } //if the user closed the contentFrame, then we want to reopen it when theres error text if(!contentFrame.isVisible()) { contentFrame.setVisible(true); } errorTextArea.append(line + "\n"); errorTextArea.setCaretPosition(errorTextArea.getDocument().getLength()); } } } final String realErrorMsg = errorMsg.toString(); //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.err.println(errorMsg); }else{ Runnable showRip = new Runnable() { public void run() { JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, realErrorMsg, null, JOptionPane.ERROR_MESSAGE);} }; SwingUtilities.invokeAndWait(showRip); } exitValue = -1; } } catch (Exception e) { if (headless){ System.err.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } } System.exit(exitValue); }
|
public static void main(String[] args) { int exitValue = 0; String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); //TODO:do some version checking and bitch at people with old JVMs /*StringTokenizer st = new StringTokenizer(ver, "."); while (st.hasMoreTokens()){ System.out.println(st.nextToken()); } */ String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n") || args[a].equalsIgnoreCase("-nogui")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx1024m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); //start up a thread to simply pump out all messages to stdout StreamGobbler isg = new StreamGobbler(child.getInputStream()); isg.start(); //while the child is alive we wait for error messages boolean dead = false; StringBuffer errorMsg = new StringBuffer("Fatal Error:\n"); BufferedReader besr = new BufferedReader(new InputStreamReader(child.getErrorStream())); String line = null; while ( !dead && (line = besr.readLine()) != null) { if(line.lastIndexOf("Memory") != -1) { errorMsg.append(line); //if the child generated an "Out of Memory" error message, kill it child.destroy(); dead = true; }else { //for any other errors we show them to the user if(headless) { //if were in headless (command line) mode, then print the error text to command line System.err.println(line); } else { //otherwise print it to the error textarea if(errorTextArea == null) { //if this is the first error line then we need to create the JFrame with the //text area javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); } //if the user closed the contentFrame, then we want to reopen it when theres error text if(!contentFrame.isVisible()) { contentFrame.setVisible(true); } errorTextArea.append(line + "\n"); errorTextArea.setCaretPosition(errorTextArea.getDocument().getLength()); } } } final String realErrorMsg = errorMsg.toString(); //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.err.println(errorMsg); }else{ Runnable showRip = new Runnable() { public void run() { JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, realErrorMsg, null, JOptionPane.ERROR_MESSAGE);} }; SwingUtilities.invokeAndWait(showRip); } exitValue = -1; } } catch (Exception e) { if (headless){ System.err.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } } System.exit(exitValue); }
| 1,109,866
|
public void saveHapsToText(Haplotype[][] finishedHaplos, double[] multidprime, File saveHapsFile) throws IOException{ if (finishedHaplos == null) return; NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); //open file for saving haps text FileWriter saveHapsWriter = new FileWriter(saveHapsFile); //go through each block and print haplos for (int i = 0; i < finishedHaplos.length; i++){ //write block header int[] markerNums = finishedHaplos[i][0].getMarkers(); saveHapsWriter.write("BLOCK " + (i+1) + ". MARKERS:"); boolean[] tags = finishedHaplos[i][0].getTags(); for (int j = 0; j < markerNums.length; j++){ saveHapsWriter.write(" " + (Chromosome.realIndex[markerNums[j]]+1)); if (tags[j]) saveHapsWriter.write("!"); } saveHapsWriter.write("\n"); //write haps and crossover percentages for (int j = 0; j < finishedHaplos[i].length; j++){ int[] theGeno = finishedHaplos[i][j].getGeno(); StringBuffer theHap = new StringBuffer(theGeno.length); for (int k = 0; k < theGeno.length; k++){ theHap.append(theGeno[k]); } saveHapsWriter.write(theHap.toString() + " (" + nf.format(finishedHaplos[i][j].getPercentage()) + ")"); if (i < finishedHaplos.length-1){ saveHapsWriter.write("\t|"); for (int crossCount = 0; crossCount < finishedHaplos[i+1].length; crossCount++){ if (crossCount != 0) saveHapsWriter.write("\t"); saveHapsWriter.write(nf.format(finishedHaplos[i][j].getCrossover(crossCount))); } saveHapsWriter.write("|"); } saveHapsWriter.write("\n"); } if (i < finishedHaplos.length - 1){ saveHapsWriter.write("Multiallelic Dprime: " + multidprime[i] + "\n"); }else{ saveHapsWriter.write("\n"); } } saveHapsWriter.close(); }
|
public void saveHapsToText(Haplotype[][] finishedHaplos, double[] multidprime, File saveHapsFile) throws IOException{ if (finishedHaplos == null) return; NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); //open file for saving haps text FileWriter saveHapsWriter = new FileWriter(saveHapsFile); //go through each block and print haplos for (int i = 0; i < finishedHaplos.length; i++){ //write block header int[] markerNums = finishedHaplos[i][0].getMarkers(); saveHapsWriter.write("BLOCK " + (i+1) + ". MARKERS:"); boolean[] tags = finishedHaplos[i][0].getTags(); for (int j = 0; j < markerNums.length; j++){ saveHapsWriter.write(" " + (Chromosome.realIndex[markerNums[j]]+1)); if (tags[j]) saveHapsWriter.write("!"); } saveHapsWriter.write("\n"); //write haps and crossover percentages for (int j = 0; j < finishedHaplos[i].length; j++){ int[] theGeno = finishedHaplos[i][j].getGeno(); StringBuffer theHap = new StringBuffer(theGeno.length); for (int k = 0; k < theGeno.length; k++){ theHap.append(theGeno[k]); } saveHapsWriter.write(theHap.toString() + " (" + nf.format(finishedHaplos[i][j].getPercentage()) + ")"); if (i < finishedHaplos.length-1){ saveHapsWriter.write("\t|"); for (int crossCount = 0; crossCount < finishedHaplos[i+1].length; crossCount++){ if (crossCount != 0) saveHapsWriter.write("\t"); saveHapsWriter.write(nf.format(finishedHaplos[i][j].getCrossover(crossCount))); } saveHapsWriter.write("|"); } saveHapsWriter.write("\n"); } if (i < finishedHaplos.length - 1){ saveHapsWriter.write("Multiallelic Dprime: " + multidprime[i] + "\n"); }else{ saveHapsWriter.write("\n"); } } saveHapsWriter.close(); }
| 1,109,869
|
protected Tag createScriptTag(String name, Attributes attributes) throws JellyException { try { return new ScriptTag( expressionFactory.getBSFEngine() ); } catch (BSFException e) { throw new JellyException("Failed to create BSFEngine: " + e, e); } }
|
protected Tag createScriptTag(String name, Attributes attributes) throws JellyException { try { return new ScriptTag( expressionFactory.getBSFEngine(), expressionFactory.getBSFManager()); } catch (BSFException e) { throw new JellyException("Failed to create BSFEngine: " + e, e); } }
| 1,109,870
|
public void doTag(XMLOutput output) throws Exception { hasIDAttribute = false; Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if (findParentTaskSource() == null && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if (findParentTaskSource() == null && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
| 1,109,871
|
public void doTag(XMLOutput output) throws Exception { hasIDAttribute = false; Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if (findParentTaskSource() == null && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
|
public void doTag(XMLOutput output) throws Exception { hasIDAttribute = false; Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if ( (parentTask == null || parentTask instanceof TaskContainer) && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
| 1,109,873
|
public void doTag(XMLOutput output) throws Exception { hasIDAttribute = false; Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if (findParentTaskSource() == null && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { hasIDAttribute = true; project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
|
public void doTag(XMLOutput output) throws Exception { hasIDAttribute = false; Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> if (findParentTaskSource() == null && project.getTaskDefinitions().containsKey( tagName )) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
| 1,109,874
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,876
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,877
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,878
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
|
public void testFullScanExempt() throws Exception { // Although not all sub-results use an index, one that does has a join // so it is exempt from folding into the full scan. UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor (Shipment.class, "shipmentNotes = ? | orderID = ? & order.orderTotal > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); assertEquals(Filter.filterFor(Shipment.class, "shipmentNotes = ?").bind(), res_0.getRemainderFilter()); assertTrue(res_1.handlesAnything()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(1, res_1.getRemainderOrdering().size()); assertEquals("+shipmentID", res_1.getRemainderOrdering().get(0).toString()); assertEquals(Filter.filterFor(Shipment.class, "order.orderTotal > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,879
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertTrue(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,881
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "orderID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,882
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
|
public void testSimpleUnion2() throws Exception { UnionQueryAnalyzer uqa = new UnionQueryAnalyzer(Shipment.class, TestIndexedQueryAnalyzer.RepoAccess.INSTANCE); Filter<Shipment> filter = Filter.filterFor(Shipment.class, "shipmentID = ? | orderID > ?"); filter = filter.bind(); UnionQueryAnalyzer.Result result = uqa.analyze(filter, null); List<IndexedQueryAnalyzer<Shipment>.Result> subResults = result.getSubResults(); assertEquals(2, subResults.size()); IndexedQueryAnalyzer<Shipment>.Result res_0 = subResults.get(0); IndexedQueryAnalyzer<Shipment>.Result res_1 = subResults.get(1); assertTrue(res_0.handlesAnything()); assertEquals(Filter.filterFor(Shipment.class, "shipmentID = ?").bind(), res_0.getCompositeScore().getFilteringScore().getIdentityFilter()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_0.getLocalIndex()); assertEquals(null, res_0.getForeignIndex()); assertEquals(null, res_0.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Note: index that has proper ordering is preferred because "orderId > ?" // filter does not specify a complete range. It is not expected to actually // filter much, so we choose to avoid a large sort instead. assertTrue(res_1.handlesAnything()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeStart()); assertFalse(res_1.getCompositeScore().getFilteringScore().hasRangeEnd()); assertEquals(makeIndex(Shipment.class, "shipmentID"), res_1.getLocalIndex()); assertEquals(null, res_1.getForeignIndex()); assertEquals(null, res_1.getForeignProperty()); assertEquals(0, res_0.getRemainderOrdering().size()); // Remainder filter exists because the "orderID" index was not chosen. assertEquals(Filter.filterFor(Shipment.class, "orderID > ?").bind(), res_1.getRemainderFilter()); }
| 1,109,883
|
public void doTag(XMLOutput output) throws Exception { // force project to be lazily constructed getProject().setDefaultGoalName( this.defaultGoalName ); org.apache.tools.ant.Project antProject = AntTagLibrary.getProject( context ); // allow access to Ant methods via the project class context.setVariable( "project", antProject ); getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { // force project to be lazily constructed getProject().setDefaultGoalName( this.defaultGoalName ); org.apache.tools.ant.Project antProject = AntTagLibrary.getProject( context ); // allow access to Ant methods via the project class context.setVariable( "project", antProject ); invokeBody(output); }
| 1,109,886
|
public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.architectFileFilter); int returnVal = chooser.showSaveDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { project.setFile(chooser.getSelectedFile()); project.setName(project.getFile().getName()); final ProgressMonitor pm = new ProgressMonitor (ArchitectFrame.this, "Saving Project", "", 0, 100);// new Thread() {// public void run() { try { project.save(pm); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't save project: "+ex.getMessage()); logger.error("Got exception while saving project", ex); }// }// }.start(); } }
|
public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.architectFileFilter); int returnVal = chooser.showSaveDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { project.setFile(chooser.getSelectedFile()); project.setName(project.getFile().getName()); final ProgressMonitor pm = new ProgressMonitor (ArchitectFrame.this, "Saving Project", "", 0, 100);// new Thread() {// public void run() { try { project.save(pm); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't save project: "+ex.getMessage()); logger.error("Got exception while saving project", ex); }// }// }.start(); } }
| 1,109,890
|
public void actionPerformed(ActionEvent e) { System.exit(0); }
|
public void actionPerformed(ActionEvent e) { saveOrSaveAs(true); }
| 1,109,891
|
public void actionPerformed(ActionEvent e) { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); try { sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); configFile.write(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
|
public void actionPerformed(ActionEvent e) { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); try { sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); configFile.write(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
| 1,109,892
|
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } if (single!=null) { if (single.booleanValue()==true) { if(value instanceof List) { List l = (List) value; if (l.size()==0) value=null; else value=l.get(0); } } else { // single == false if(! (value instanceof List) ) { if (value==null) { l = new java.util.ArrayList(0) } else { List l = new java.util.ArrayList(1); l.add(value); } value = l; } } } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
|
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } if (single!=null) { if (single.booleanValue()==true) { if(value instanceof List) { List l = (List) value; if (l.size()==0) value=null; else value=l.get(0); } } else { // single == false if(! (value instanceof List) ) { if (value==null) { l = new ArrayList(0); } else { List l = new java.util.ArrayList(1); l.add(value); } value = l; } } } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
| 1,109,894
|
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } if (single!=null) { if (single.booleanValue()==true) { if(value instanceof List) { List l = (List) value; if (l.size()==0) value=null; else value=l.get(0); } } else { // single == false if(! (value instanceof List) ) { if (value==null) { l = new java.util.ArrayList(0) } else { List l = new java.util.ArrayList(1); l.add(value); } value = l; } } } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
|
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { if (var == null) { throw new MissingAttributeException( "var" ); } if (select == null) { throw new MissingAttributeException( "select" ); } Object xpathContext = getXPathContext(); Object value = null; try { if(single!=null && single.booleanValue()==true) { value = select.selectSingleNode(xpathContext); } else { value = select.evaluate(xpathContext); } } catch (JaxenException e) { throw new JellyTagException(e); } if (value instanceof List) { // sort the list if xpCmp is set. if (xpCmp != null && (xpCmp.getXpath() != null)) { Collections.sort((List)value, xpCmp); } } if (single!=null) { if (single.booleanValue()==true) { if(value instanceof List) { List l = (List) value; if (l.size()==0) value=null; else value=l.get(0); } } else { // single == false if(! (value instanceof List) ) { if (value==null) { l = new java.util.ArrayList(0) } else { List l = new ArrayList(1); l.add(value); } value = l; } } } //log.info( "Evaluated xpath: " + select + " as: " + value + " of type: " + value.getClass().getName() ); context.setVariable(var, value); }
| 1,109,895
|
public void actionPerformed (ActionEvent e){ String command = e.getActionCommand(); if (dpButton.isSelected()){ if(txtButton.isSelected()){ adjButton.setEnabled(true); }else{ adjButton.setEnabled(false); if (adjButton.isSelected()){ allButton.setSelected(true); } } someButton.setEnabled(true); }else{ someButton.setEnabled(false); adjButton.setEnabled(false); if (adjButton.isSelected() || someButton.isSelected()){ allButton.setSelected(true); } } if (someButton.isSelected()){ upperRange.setEnabled(true); lowRange.setEnabled(true); }else{ upperRange.setEnabled(false); lowRange.setEnabled(false); } if (command.equals("ldtab") || command.equals("haptab")){ pngButton.setEnabled(true); }else if (command.equals("checktab") || command.equals("assoctab")){ pngButton.setEnabled(false); txtButton.setSelected(true); }else if (command.equals("OK")){ int format, tab; if (pngButton.isSelected()){ format = PNG_MODE; }else{ format = TXT_MODE; } if (dpButton.isSelected()){ tab = VIEW_D_NUM; } else if (hapButton.isSelected()){ tab = VIEW_HAP_NUM; } else if (checkButton.isSelected()){ tab = VIEW_CHECK_NUM; } else { tab = VIEW_TDT_NUM; } this.dispose(); if (allButton.isSelected()){ hv.export(tab,format,0,Chromosome.getSize()); }else if (someButton.isSelected()){ hv.export(tab,format,Integer.parseInt(lowRange.getText())-1, Integer.parseInt(upperRange.getText())); }else{ hv.export(tab,format,-1,-1); } }else if (command.equals("Cancel")){ this.dispose(); } }
|
public void actionPerformed (ActionEvent e){ String command = e.getActionCommand(); if (dpButton.isSelected()){ if(txtButton.isSelected()){ adjButton.setEnabled(true); }else{ adjButton.setEnabled(false); if (adjButton.isSelected()){ allButton.setSelected(true); } } someButton.setEnabled(true); }else{ someButton.setEnabled(false); adjButton.setEnabled(false); if (adjButton.isSelected() || someButton.isSelected()){ allButton.setSelected(true); } } if (someButton.isSelected()){ upperRange.setEnabled(true); lowRange.setEnabled(true); }else{ upperRange.setEnabled(false); lowRange.setEnabled(false); } if (command.equals("ldtab") || command.equals("haptab")){ pngButton.setEnabled(true); }else if (command.equals("checktab") || command.equals("assoctab")){ pngButton.setEnabled(false); txtButton.setSelected(true); }else if (command.equals("OK")){ int format, tab; if (pngButton.isSelected()){ if (compressCheckBox.isSelected()){ format = COMPRESSED_PNG_MODE; }else{ format = PNG_MODE; } }else{ format = TXT_MODE; } if (dpButton.isSelected()){ tab = VIEW_D_NUM; } else if (hapButton.isSelected()){ tab = VIEW_HAP_NUM; } else if (checkButton.isSelected()){ tab = VIEW_CHECK_NUM; } else { tab = VIEW_TDT_NUM; } this.dispose(); if (allButton.isSelected()){ hv.export(tab,format,0,Chromosome.getSize()); }else if (someButton.isSelected()){ hv.export(tab,format,Integer.parseInt(lowRange.getText())-1, Integer.parseInt(upperRange.getText())); }else{ hv.export(tab,format,-1,-1); } }else if (command.equals("Cancel")){ this.dispose(); } }
| 1,109,897
|
public void actionPerformed (ActionEvent e){ String command = e.getActionCommand(); if (dpButton.isSelected()){ if(txtButton.isSelected()){ adjButton.setEnabled(true); }else{ adjButton.setEnabled(false); if (adjButton.isSelected()){ allButton.setSelected(true); } } someButton.setEnabled(true); }else{ someButton.setEnabled(false); adjButton.setEnabled(false); if (adjButton.isSelected() || someButton.isSelected()){ allButton.setSelected(true); } } if (someButton.isSelected()){ upperRange.setEnabled(true); lowRange.setEnabled(true); }else{ upperRange.setEnabled(false); lowRange.setEnabled(false); } if (command.equals("ldtab") || command.equals("haptab")){ pngButton.setEnabled(true); }else if (command.equals("checktab") || command.equals("assoctab")){ pngButton.setEnabled(false); txtButton.setSelected(true); }else if (command.equals("OK")){ int format, tab; if (pngButton.isSelected()){ format = PNG_MODE; }else{ format = TXT_MODE; } if (dpButton.isSelected()){ tab = VIEW_D_NUM; } else if (hapButton.isSelected()){ tab = VIEW_HAP_NUM; } else if (checkButton.isSelected()){ tab = VIEW_CHECK_NUM; } else { tab = VIEW_TDT_NUM; } this.dispose(); if (allButton.isSelected()){ hv.export(tab,format,0,Chromosome.getSize()); }else if (someButton.isSelected()){ hv.export(tab,format,Integer.parseInt(lowRange.getText())-1, Integer.parseInt(upperRange.getText())); }else{ hv.export(tab,format,-1,-1); } }else if (command.equals("Cancel")){ this.dispose(); } }
|
public void actionPerformed (ActionEvent e){ String command = e.getActionCommand(); if (dpButton.isSelected()){ if(txtButton.isSelected()){ adjButton.setEnabled(true); }else{ adjButton.setEnabled(false); if (adjButton.isSelected()){ allButton.setSelected(true); } } someButton.setEnabled(true); }else{ someButton.setEnabled(false); adjButton.setEnabled(false); if (adjButton.isSelected() || someButton.isSelected()){ allButton.setSelected(true); } } if (someButton.isSelected()){ upperRange.setEnabled(true); lowRange.setEnabled(true); }else{ upperRange.setEnabled(false); lowRange.setEnabled(false); } if (command.equals("ldtab") || command.equals("haptab")){ pngButton.setEnabled(true); }else if (command.equals("checktab") || command.equals("assoctab")){ pngButton.setEnabled(false); txtButton.setSelected(true); }else if (command.equals("OK")){ int format, tab; if (pngButton.isSelected()){ format = PNG_MODE; }else{ format = TXT_MODE; } if (dpButton.isSelected()){ tab = VIEW_D_NUM; } else if (hapButton.isSelected()){ tab = VIEW_HAP_NUM; } else if (checkButton.isSelected()){ tab = VIEW_CHECK_NUM; } else { tab = VIEW_TDT_NUM; } this.dispose(); if (allButton.isSelected()){ hv.export(tab,format,0,Chromosome.getSize()); }else if (someButton.isSelected()){ try{ hv.export(tab,format,Integer.parseInt(lowRange.getText())-1, Integer.parseInt(upperRange.getText())); }catch (NumberFormatException nfe){ JOptionPane.showMessageDialog(hv, "Invalid marker range: " + lowRange.getText() + " - " + upperRange.getText(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else{ hv.export(tab,format,-1,-1); } }else if (command.equals("Cancel")){ this.dispose(); } }
| 1,109,898
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = pp; add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = job.defaultPage(); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = new PlayPen(pp); add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = job.defaultPage(); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
| 1,109,899
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = pp; add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = job.defaultPage(); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = pp; add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = new PageFormat(); pageFormat.setPaper(new Paper()); pageFormat.getPaper().setImageableArea(50, 50, pageFormat.getWidth()-(50*2), pageFormat.getHeight()-(50*2)); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
| 1,109,900
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = pp; add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = job.defaultPage(); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
|
public PrintPanel(PlayPen pp) { super(); setOpaque(true); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.pp = pp; add(new PrintPreviewPanel()); job = PrinterJob.getPrinterJob(); jobAttributes = new HashPrintRequestAttributeSet(); pageFormat = job.defaultPage(); JPanel formPanel = new JPanel(new FormLayout()); formPanel.add(new JLabel("Printer")); formPanel.add(printerBox = new JComboBox(PrinterJob.lookupPrintServices())); printerBox.setSelectedItem(getPreferredPrinter()); formPanel.add(new JLabel("Page Format")); String pf = paperToPrintable(pageFormat); formPanel.add(pageFormatLabel = new JLabel(pf.toString())); formPanel.add(new JLabel("Change Page Format")); formPanel.add(pageFormatButton = new JButton("Change Page Format")); pageFormatButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(pageFormat)); } }); formPanel.add(zoomLabel = new JLabel("Scaling = 100%")); formPanel.add(zoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 300, 100)); setZoom(1.0); zoomSlider.addChangeListener(this); add(formPanel); }
| 1,109,901
|
public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(jobAttributes)); }
|
public void actionPerformed(ActionEvent e) { setPageFormat(job.pageDialog(pageFormat)); }
| 1,109,903
|
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { Graphics2D g2 = (Graphics2D) graphics; if (pageIndex < pagesAcross*pagesDown) { double leftMargin = pageFormat.getImageableX(); double topMargin = pageFormat.getImageableY(); double width = pageFormat.getImageableWidth(); double height = pageFormat.getImageableHeight(); // which page we're printing in the big grid int col = pageIndex % pagesAcross; int row = pageIndex / pagesAcross; g2.drawString("Page "+pageIndex+" of "+(pagesAcross*pagesDown), (float) (leftMargin+10.0), (float) (topMargin+10.0)); logger.debug("Printing page "+(pageIndex+1)+" of "+(pagesAcross*pagesDown) +" at ["+col+","+row+"]"); g2.translate(leftMargin - col*width, topMargin - row*height); g2.scale(zoom, zoom); pp.print(g2); return PAGE_EXISTS; } else { return NO_SUCH_PAGE; } }
|
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { Graphics2D g2 = (Graphics2D) graphics; if (pageIndex < pagesAcross*pagesDown) { double leftMargin = pageFormat.getImageableX(); double topMargin = pageFormat.getImageableY(); double width = pageFormat.getImageableWidth(); double height = pageFormat.getImageableHeight(); // which page we're printing in the big grid int col = pageIndex % pagesAcross; int row = pageIndex / pagesAcross; g2.drawString("Page "+pageIndex+" of "+(pagesAcross*pagesDown), (float) (leftMargin+10.0), (float) (topMargin+10.0)); logger.debug("Printing page "+(pageIndex+1)+" of "+(pagesAcross*pagesDown) +" at ["+col+","+row+"]"); g2.translate(leftMargin - col*width, topMargin - row*height); g2.scale(zoom, zoom); pp.print(g2); return PAGE_EXISTS; } else { return NO_SUCH_PAGE; } }
| 1,109,904
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,907
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tab.equals(associationTab) || tab.equals(checkTab) || tab.equals(taggerTab)){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,908
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,909
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tabNum == VIEW_D_NUM){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
public void stateChanged(ChangeEvent e) { if (tabs.getSelectedIndex() != -1){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int tabNum = tabs.getSelectedIndex(); if (tabNum == VIEW_D_NUM || tabNum == VIEW_HAP_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(true); }else if (tabNum == VIEW_ASSOC_NUM || tabNum == VIEW_CHECK_NUM || tabNum == VIEW_TAGGER_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } //if we've adjusted the haps display thresh we need to change the haps ass panel if (tabNum == VIEW_ASSOC_NUM){ JTabbedPane metaAssoc= (JTabbedPane)tabs.getComponentAt(tabNum); //this is the haps ass tab inside the assoc super-tab HaploAssocPanel htp = (HaploAssocPanel) metaAssoc.getComponent(1); if (htp.initialHaplotypeDisplayThreshold != Options.getHaplotypeDisplayThreshold()){ htp.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } } if (tab.equals(ldTab)){ keyMenu.setEnabled(true); }else{ keyMenu.setEnabled(false); } viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel != null && checkPanel.changed){ //first store up the current blocks Vector currentBlocks = new Vector(); for (int blocks = 0; blocks < theData.blocks.size(); blocks++){ int thisBlock[] = (int[]) theData.blocks.elementAt(blocks); int thisBlockReal[] = new int[thisBlock.length]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlockReal[marker] = Chromosome.realIndex[thisBlock[marker]]; } currentBlocks.add(thisBlockReal); } Chromosome.doFilter(checkPanel.getMarkerResults()); //after editing the filtered marker list, needs to be prodded into //resizing correctly dPrimeDisplay.computePreferredSize(); dPrimeDisplay.colorDPrime(); hapDisplay.theData = theData; if (currentBlockDef != BLOX_CUSTOM){ changeBlocks(currentBlockDef); }else{ //adjust the blocks Vector theBlocks = new Vector(); for (int x = 0; x < currentBlocks.size(); x++){ Vector goodies = new Vector(); int currentBlock[] = (int[])currentBlocks.elementAt(x); for (int marker = 0; marker < currentBlock.length; marker++){ for (int y = 0; y < Chromosome.realIndex.length; y++){ //we only keep markers from the input that are "good" from checkdata //we also realign the input file to the current "good" subset since input is //indexed of all possible markers in the dataset if (Chromosome.realIndex[y] == currentBlock[marker]){ goodies.add(new Integer(y)); } } } int thisBlock[] = new int[goodies.size()]; for (int marker = 0; marker < thisBlock.length; marker++){ thisBlock[marker] = ((Integer)goodies.elementAt(marker)).intValue(); } if (thisBlock.length > 1){ theBlocks.add(thisBlock); } } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } if (taggerConfigPanel != null){ taggerConfigPanel.refreshTable(); } if(permutationPanel != null) { permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ try{ hapDisplay.getHaps(); if(Options.getAssocTest() != ASSOC_NONE) { //this is the haps ass tab inside the assoc super-tab hapAssocPanel.makeTable(new AssociationTestSet(theData.getHaplotypes(), null)); permutationPanel.setBlocksChanged(); if (custAssocPanel == null){ //change tests if we don't have a custom set AssociationTestSet permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); permutationPanel.setTestSet(new PermutationTestSet(0,theData.getSavedEMs(),theData.getPedFile(),permSet)); } } }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); theData.blocksChanged = false; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,910
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(GBROWSE_OPTS)){ GBrowseOptionDialog gbod = new GBrowseOptionDialog(this, "HapMap Info Track Options"); gbod.pack(); gbod.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export(tabs.getSelectedIndex(), PNG_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_TEXT)){ export(tabs.getSelectedIndex(), TXT_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("About Haploview")){ JOptionPane.showMessageDialog(this, ABOUT_STRING, "About Haploview", JOptionPane.INFORMATION_MESSAGE); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; String unableToConnect; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { unableToConnect = ioe.getMessage(); } return null; } public void finished() { window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if(uc != null) { if(unableToConnect != null) { JOptionPane.showMessageDialog(window, "An error occured while checking for update.\n " + unableToConnect , "Update Check", JOptionPane.ERROR_MESSAGE); } else if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(GBROWSE_OPTS)){ GBrowseOptionDialog gbod = new GBrowseOptionDialog(this, "HapMap Info Track Options"); gbod.pack(); gbod.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export((HaploviewTab)tabs.getSelectedComponent(), PNG_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_TEXT)){ export(tabs.getSelectedIndex(), TXT_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("About Haploview")){ JOptionPane.showMessageDialog(this, ABOUT_STRING, "About Haploview", JOptionPane.INFORMATION_MESSAGE); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; String unableToConnect; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { unableToConnect = ioe.getMessage(); } return null; } public void finished() { window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if(uc != null) { if(unableToConnect != null) { JOptionPane.showMessageDialog(window, "An error occured while checking for update.\n " + unableToConnect , "Update Check", JOptionPane.ERROR_MESSAGE); } else if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
| 1,109,911
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(GBROWSE_OPTS)){ GBrowseOptionDialog gbod = new GBrowseOptionDialog(this, "HapMap Info Track Options"); gbod.pack(); gbod.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export(tabs.getSelectedIndex(), PNG_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_TEXT)){ export(tabs.getSelectedIndex(), TXT_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("About Haploview")){ JOptionPane.showMessageDialog(this, ABOUT_STRING, "About Haploview", JOptionPane.INFORMATION_MESSAGE); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; String unableToConnect; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { unableToConnect = ioe.getMessage(); } return null; } public void finished() { window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if(uc != null) { if(unableToConnect != null) { JOptionPane.showMessageDialog(window, "An error occured while checking for update.\n " + unableToConnect , "Update Check", JOptionPane.ERROR_MESSAGE); } else if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(READ_GENOTYPES)){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command.equals(READ_MARKERS)){ //JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile(),null); } }else if (command.equals(READ_ANALYSIS_TRACK)){ fc.setSelectedFile(new File("")); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ readAnalysisFile(fc.getSelectedFile()); } }else if (command.equals(DOWNLOAD_GBROWSE)){ GBrowseDialog gbd = new GBrowseDialog(this, "Connect to HapMap Info Server"); gbd.pack(); gbd.setVisible(true); }else if (command.equals(GBROWSE_OPTS)){ GBrowseOptionDialog gbod = new GBrowseOptionDialog(this, "HapMap Info Track Options"); gbod.pack(); gbod.setVisible(true); }else if (command.equals(READ_BLOCKS_FILE)){ fc.setSelectedFile(new File("")); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ readBlocksFile(fc.getSelectedFile()); } }else if (command.equals(CUST_BLOCKS)){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command.equals(CLEAR_BLOCKS)){ changeBlocks(BLOX_NONE); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ Options.setLDColorScheme(Integer.valueOf(command.substring(5)).intValue()); dPrimeDisplay.colorDPrime(); changeKey(); //exporting clauses }else if (command.equals(EXPORT_PNG)){ export(tabs.getSelectedIndex(), PNG_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_TEXT)){ export((HaploviewTab)tabs.getSelectedComponent(), TXT_MODE, 0, Chromosome.getUnfilteredSize()); }else if (command.equals(EXPORT_OPTIONS)){ ExportDialog exDialog = new ExportDialog(this); exDialog.pack(); exDialog.setVisible(true); }else if (command.equals("Select All")){ checkPanel.selectAll(); }else if (command.equals("Rescore Markers")){ String cut = cdc.hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = cdc.genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = cdc.mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); cut = cdc.mafcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.mafCut = Double.parseDouble(cut); checkPanel.redoRatings(); JTable jt = checkPanel.getTable(); jt.repaint(); }else if (command.equals("LD Display Spacing")){ ProportionalSpacingDialog spaceDialog = new ProportionalSpacingDialog(this, "Adjust LD Spacing"); spaceDialog.pack(); spaceDialog.setVisible(true); }else if (command.equals("About Haploview")){ JOptionPane.showMessageDialog(this, ABOUT_STRING, "About Haploview", JOptionPane.INFORMATION_MESSAGE); } else if(command.equals("Check for update")) { final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; String unableToConnect; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { unableToConnect = ioe.getMessage(); } return null; } public void finished() { window.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if(uc != null) { if(unableToConnect != null) { JOptionPane.showMessageDialog(window, "An error occured while checking for update.\n " + unableToConnect , "Update Check", JOptionPane.ERROR_MESSAGE); } else if(uc.isNewVersionAvailable()) { UpdateDisplayDialog udp = new UpdateDisplayDialog(window,"Update Check",uc); udp.pack(); udp.setVisible(true); } else { JOptionPane.showMessageDialog(window, "Your version of Haploview is up to date.", "Update Check", JOptionPane.INFORMATION_MESSAGE); } } } }; setCursor(new Cursor(Cursor.WAIT_CURSOR)); worker.start(); }else if (command.equals("Quit")){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command.equals(viewItems[i])) tabs.setSelectedIndex(i); } } }
| 1,109,912
|
public void changeBlocks(int method){ if (method == BLOX_NONE || method == BLOX_CUSTOM){ blockMenuItems[BLOX_CUSTOM].setSelected(true); } if (method != BLOX_CUSTOM){ theData.guessBlocks(method); } dPrimeDisplay.repaint(); currentBlockDef = method; try{ if (tabs.getSelectedIndex() == VIEW_HAP_NUM){ hapDisplay.getHaps(); } }catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); }
|
public void changeBlocks(int method){ if (method == BLOX_NONE || method == BLOX_CUSTOM){ blockMenuItems[BLOX_CUSTOM].setSelected(true); } if (method != BLOX_CUSTOM){ theData.guessBlocks(method); } dPrimeDisplay.repaint(); currentBlockDef = method; try{ if (tabs.getSelectedComponent().equals(hapsTab)){ hapDisplay.getHaps(); } }catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); }
| 1,109,913
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(HaploviewTab tab, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,914
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tab.equals(ldTab)){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tab.equals(ldTab)){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,915
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tab.equals(hapsTab)){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tab.equals(hapsTab)){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,916
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tab.equals(checkTab)){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,917
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,918
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tabNum == VIEW_TAGGER_NUM){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
|
void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE || format == COMPRESSED_PNG_MODE){ BufferedImage image = null; if (tabNum == VIEW_D_NUM){ try { if (format == PNG_MODE){ image = dPrimeDisplay.export(start, stop, false); }else{ image = dPrimeDisplay.export(start, stop, true); } } catch(HaploViewException hve) { JOptionPane.showMessageDialog(this, hve.getMessage(), "Export Error", JOptionPane.ERROR_MESSAGE); } }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } if (image != null){ try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ checkPanel.printTable(outfile); }else if (tabNum == VIEW_ASSOC_NUM){ Component selectedTab = ((JTabbedPane)tabs.getComponent(tabNum)).getSelectedComponent(); if(selectedTab == tdtPanel){ tdtPanel.getTestSet().saveSNPsToText(outfile); }else if (selectedTab == hapAssocPanel){ hapAssocPanel.getTestSet().saveHapsToText(outfile); }else if (selectedTab == permutationPanel){ permutationPanel.export(outfile); }else if (selectedTab == custAssocPanel){ custAssocPanel.getTestSet().saveResultsToText(outfile); } }else if (tab.equals(taggerTab)){ taggerConfigPanel.export(outfile); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch(HaploViewException he){ JOptionPane.showMessageDialog(this, he.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,109,919
|
void readAnalysisFile(File inFile){ try{ theData.readAnalysisTrack(inFile); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } dPrimeDisplay.computePreferredSize(); if (dPrimeDisplay != null && tabs.getSelectedIndex() == VIEW_D_NUM){ dPrimeDisplay.repaint(); } }
|
void readAnalysisFile(File inFile){ try{ theData.readAnalysisTrack(inFile); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } dPrimeDisplay.computePreferredSize(); if (dPrimeDisplay != null && tabs.getSelectedComponent().equals(ldTab)){ dPrimeDisplay.repaint(); } }
| 1,109,920
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); HaploviewTab currentTab = ldTab; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,921
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,922
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,923
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,924
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,925
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,926
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,927
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,928
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); associationTab = new HaploviewTab(metaAssoc); tabs.addTab(VIEW_ASSOC, associationTab); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,929
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 2 element array with //inputOptions[0] = ped file //inputOptions[1] = info file (null if none) //inputOptions[2] = custom association test list file (null if none) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); final AssociationTestSet customAssocSet; try { if (inputOptions[2] != null && inputOptions[1] == null){ throw new HaploViewException("A marker information file is required if a tests file is specified."); } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS_FILE){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(false); Options.setAssocTest(ASSOC_NONE); } theData = new HaploData(); if (type == HAPS_FILE){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } if(type != HAPS_FILE && theData.getPedFile().isBogusParents()) { JOptionPane.showMessageDialog(this, "One or more individuals in the file reference non-existent parents.\nThese references have been ignored.", "File Error", JOptionPane.ERROR_MESSAGE); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1] == null){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } //turn on/off gbrowse menu if (Options.isGBrowseShown()){ gbEditItem.setEnabled(true); }else{ gbEditItem.setEnabled(false); } checkPanel = null; if (type == HAPS_FILE){ readMarkers(markerFile, null); //initialize realIndex Chromosome.doFilter(Chromosome.getUnfilteredSize()); customAssocSet = null; }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); //we read the file in first, so we can whitelist all the markers in the custom test set HashSet whiteListedCustomMarkers = new HashSet(); if (inputOptions[2] != null){ customAssocSet = new AssociationTestSet(inputOptions[2]); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } theData.setWhiteList(whiteListedCustomMarkers); checkPanel = new CheckDataPanel(this); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); //set up the indexing to take into account skipped markers. Chromosome.doFilter(checkPanel.getMarkerResults()); } //let's start the math final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedComponent(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); blocksItem.setEnabled(true); exportMenuItems[2].setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
| 1,109,930
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); HaploviewTab currentTab = ldTab; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,931
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,932
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,933
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,934
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,935
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
|
public Object construct(){ dPrimeDisplay=null; changeKey(); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); displayMenu.setEnabled(true); analysisMenu.setEnabled(true); //check data panel if (checkPanel != null){ JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //tagger display taggerConfigPanel = new TaggerConfigPanel(theData); JPanel metaTagPanel = new JPanel(); metaTagPanel.setLayout(new BoxLayout(metaTagPanel,BoxLayout.Y_AXIS)); metaTagPanel.add(taggerConfigPanel); JTabbedPane tagTabs = new JTabbedPane(); tagTabs.add("Configuration",metaTagPanel); JPanel resMetaPanel = new JPanel(); resMetaPanel.setLayout(new BoxLayout(resMetaPanel,BoxLayout.Y_AXIS)); TaggerResultsPanel tagResultsPanel = new TaggerResultsPanel(); taggerConfigPanel.addActionListener(tagResultsPanel); resMetaPanel.add(tagResultsPanel); tagTabs.addTab("Results",resMetaPanel); tabs.addTab(VIEW_TAGGER,tagTabs); viewMenuItems[VIEW_TAGGER_NUM].setEnabled(true); //Association panel if(Options.getAssocTest() != ASSOC_NONE) { JTabbedPane metaAssoc = new JTabbedPane(); try{ tdtPanel = new TDTPanel(new AssociationTestSet(theData.getPedFile(), null, Chromosome.getAllMarkers())); } catch(PedFileException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } metaAssoc.add("Single Marker", tdtPanel); hapAssocPanel = new HaploAssocPanel(new AssociationTestSet(theData.getHaplotypes(), null)); metaAssoc.add("Haplotypes", hapAssocPanel); //custom association tests custAssocPanel = null; if(customAssocSet != null) { try { customAssocSet.runFileTests(theData, tdtPanel.getTestSet().getMarkerAssociationResults()); custAssocPanel = new CustomAssocPanel(customAssocSet); metaAssoc.addTab("Custom",custAssocPanel); metaAssoc.setSelectedComponent(custAssocPanel); } catch (HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } AssociationTestSet permSet; boolean cust = false; if (custAssocPanel != null){ permSet = custAssocPanel.getTestSet(); cust = true; }else{ permSet = new AssociationTestSet(); permSet.cat(tdtPanel.getTestSet()); permSet.cat(hapAssocPanel.getTestSet()); } permutationPanel = new PermutationTestPanel(new PermutationTestSet(0,theData.getSavedEMs(), theData.getPedFile(),permSet), cust); metaAssoc.add(permutationPanel,"Permutation Tests"); tabs.addTab(VIEW_ASSOC, metaAssoc); viewMenuItems[VIEW_ASSOC_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,936
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.