bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
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); checkTab.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,937
|
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(VIEW_CHECK_PANEL, checkTab); 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,938
|
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=checkTab; } //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,939
|
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 if (theData.infoKnown){ 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,940
|
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,941
|
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"); 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; }
| 1,109,942
|
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.setSelectedComponent(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; }
| 1,109,943
|
void readMarkers(File inputFile, String[][] hminfo){ try { theData.prepareMarkerInput(inputFile, hminfo); if (theData.infoKnown){ analysisItem.setEnabled(true); gbrowseItem.setEnabled(true); spacingItem.setEnabled(true); }else{ analysisItem.setEnabled(false); gbrowseItem.setEnabled(false); spacingItem.setEnabled(false); } if (checkPanel != null){ //this is triggered when loading markers after already loading genotypes //it is dumb and sucks, but at least it works. bah. checkPanel = new CheckDataPanel(this); Container checkTab = (Container)tabs.getComponentAt(VIEW_CHECK_NUM); checkTab.removeAll(); JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); checkTab.add(metaCheckPanel); repaint(); } if (tdtPanel != null){ tdtPanel.refreshNames(); } if (dPrimeDisplay != null){ dPrimeDisplay.computePreferredSize(); } }catch (HaploViewException e){ JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
|
void readMarkers(File inputFile, String[][] hminfo){ try { theData.prepareMarkerInput(inputFile, hminfo); if (theData.infoKnown){ analysisItem.setEnabled(true); gbrowseItem.setEnabled(true); spacingItem.setEnabled(true); }else{ analysisItem.setEnabled(false); gbrowseItem.setEnabled(false); spacingItem.setEnabled(false); } if (checkPanel != null){ //this is triggered when loading markers after already loading genotypes //it is dumb and sucks, but at least it works. bah. checkPanel = new CheckDataPanel(this); checkTab.removeAll(); JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); checkTab.add(metaCheckPanel); repaint(); } if (tdtPanel != null){ tdtPanel.refreshNames(); } if (dPrimeDisplay != null){ dPrimeDisplay.computePreferredSize(); } }catch (HaploViewException e){ JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
| 1,109,944
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
| 1,109,945
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
| 1,109,946
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
| 1,109,947
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
| 1,109,948
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances getBody().run(context, output); }
|
public void doTag(XMLOutput output) throws Exception { TaskSource tag = (TaskSource) findAncestorWithClass( TaskSource.class ); if ( tag == null ) { throw new JellyException( "You should only use Ant DataType tags within an Ant Task" ); } Object task = tag.getTaskObject(); Object dataType = getDataType(); // now we need to configure the task with the data type // first try setting a property on the DynaBean wrapper of the task DynaBean dynaBean = tag.getDynaBean(); DynaClass dynaClass = dynaBean.getDynaClass(); DynaProperty dynaProperty = dynaClass.getDynaProperty(name); if ( dynaProperty != null ) { // lets set the bean property dynaBean.set( name, dataType ); } else { // lets invoke the addFoo() method instead String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1); Class taskClass = task.getClass(); Class[] parameterTypes = new Class[] { dataType.getClass() }; Method method = MethodUtils.getAccessibleMethod( taskClass, methodName, parameterTypes ); if ( method == null ) { throw new JellyException( "Cannot add dataType: " + dataType + " to Ant task: " + task + " as no method called: " + methodName + " could be found" ); } Object[] parameters = new Object[] { dataType }; method.invoke( task, parameters ); } // run the body first to configure any nested DataType instances try { ih.storeElement( getAntProject(), targetObj, dataType, getName() ); } catch (Exception e) { String dataTypeName = dataType.getClass().getName(); String baseName = dataTypeName.substring( dataTypeName.lastIndexOf( "." ) + 1 ); String methName = "add" + baseName; Method m = MethodUtils.getAccessibleMethod( targetObj.getClass(), methName, dataType.getClass() ); if ( m == null ) { String lname = baseName.toLowerCase(); methName = "add" + lname.substring( 0, 1 ).toUpperCase() + lname.substring( 1 ); m = MethodUtils.getAccessibleMethod( targetObj.getClass(), methName, dataType.getClass() ); } if ( m != null ) { try { m.invoke( targetObj, new Object[] { dataType } ); return; } catch (Exception i) { i.printStackTrace(); } } } }
| 1,109,949
|
public Object getDataType() { return dataType; }
|
public DataType getDataType() { return dataType; }
| 1,109,950
|
public void setDataType(Object dataType) { this.dataType = dataType; setDynaBean( new ConvertingWrapDynaBean(dataType) ); }
|
public void setDataType(DataType dataType) { this.dataType = dataType; setDynaBean( new ConvertingWrapDynaBean(dataType) ); }
| 1,109,951
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(TestSQLDatabase.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(SQLObjectTest.class); suite.addTest(TestSQLDatabase.suite()); suite.addTest(TestSQLTable.suite()); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
| 1,109,952
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(TestSQLDatabase.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(TestSQLDatabase.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
| 1,109,953
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(TestSQLDatabase.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
|
public static Test suite() { TestSuite suite = new TestSuite("Test for regress"); //$JUnit-BEGIN$ suite.addTestSuite(TestSQLDatabase.class); suite.addTestSuite(ArchitectExceptionTest.class); suite.addTestSuite(SaveLoadTest.class); suite.addTestSuite(PLDotIniTest.class); suite.addTest(TestSQLColumn.suite()); suite.addTestSuite(JDBCClassLoaderTest.class); suite.addTestSuite(LogWriterTest.class); suite.addTestSuite(TestDDLUtils.class); suite.addTestSuite(SQLObjectTest.class); suite.addTestSuite(TestSQLTable.class); suite.addTestSuite(TestSQLRelationship.class); suite.addTestSuite(TestArchitectDataSource.class); //$JUnit-END$ return suite; }
| 1,109,954
|
private File getNewFname( java.util.Date date, String strExtension ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { yearDir.mkdir(); } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { monthDir.mkdir(); } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
|
private File getNewFname( java.util.Date date, String strExtension ) { System.err.println( "getNewFname " + date + " " + strExtension ); SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { yearDir.mkdir(); } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { monthDir.mkdir(); } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
| 1,109,955
|
private File getNewFname( java.util.Date date, String strExtension ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { yearDir.mkdir(); } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { monthDir.mkdir(); } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
|
private File getNewFname( java.util.Date date, String strExtension ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { System.err.println( "making yeardir" ); if ( !yearDir.mkdir() ) { log.error( "Failed to create directory " + yearDir.getAbsoluteFile() ); } } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { monthDir.mkdir(); } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
| 1,109,956
|
private File getNewFname( java.util.Date date, String strExtension ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { yearDir.mkdir(); } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { monthDir.mkdir(); } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
|
private File getNewFname( java.util.Date date, String strExtension ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy" ); String strYear = fmt.format( date ); fmt.applyPattern( "yyyyMM" ); String strMonth = fmt.format( date ); fmt.applyPattern( "yyyyMMdd" ); String strDate = fmt.format( date ); File yearDir = new File( volumeBaseDir, strYear ); if ( !yearDir.exists() ) { yearDir.mkdir(); } // Create the month directeory if it does not exist yet File monthDir = new File ( yearDir, strMonth ); if ( !monthDir.exists() ) { System.err.println( "making yeardir" ); if ( !monthDir.mkdir() ) { log.error( "Failed to create " + monthDir.getAbsolutePath() ); } } // Find a free order num for this file String monthFiles[] = monthDir.list(); int orderNum = 1; for ( int n = 0; n < monthFiles.length; n++ ) { if ( monthFiles[n].startsWith( strDate ) ) { int delimiterLoc = monthFiles[n].indexOf( "." ); String strFileNum = monthFiles[n].substring( strDate.length()+1, delimiterLoc ); int i = 0; try { i = Integer.parseInt( strFileNum ); } catch ( NumberFormatException e ) {} if ( i >= orderNum ) { orderNum = i+1; } } } String strOrderNum = String.valueOf( orderNum ); // Find the file extension String fname = strDate + "_"+ "00000".substring( 0, 5-strOrderNum.length())+ strOrderNum + "." + strExtension; File archiveFile = new File( monthDir, fname ); return archiveFile; }
| 1,109,957
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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); }
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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; } //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[Chromosome.getSize() + 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.getLDStats(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,958
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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); }
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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,959
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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); }
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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,960
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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); }
|
static Vector do4Gamete(DPrimeTable 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 < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(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[Chromosome.getSize() + 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.getLDStats(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; break OUTER; } } } 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,961
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test Vector addMe = new Vector(); //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
| 1,109,962
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test Vector addMe = new Vector(); //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test Vector addMe = new Vector(); //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
| 1,109,963
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test Vector addMe = new Vector(); //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
|
static Vector doGabriel(DPrimeTable dPrime){ int numStrong = 0; int numRec = 0; int numInGroup = 0; Vector blocks = new Vector(); Vector strongPairs = new Vector(); //first set up a filter of markers which fail the MAF threshhold boolean[] skipMarker = new boolean[Chromosome.getSize()]; for (int x = 0; x < Chromosome.getSize(); x++){ if (Chromosome.getMarker(x).getMAF() < mafThresh){ skipMarker[x]=true; }else{ skipMarker[x]=false; } } //next make a list of marker pairs in "strong LD", sorted by distance apart for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (skipMarker[x] || skipMarker[y]) continue; if (lod < -90) continue; //missing data if (highCI < cutHighCI || lowCI < cutLowCI) continue; //must pass "strong LD" test Vector addMe = new Vector(); //a vector of x, y, separation long sep; //compute actual separation sep = Math.abs(Chromosome.getMarker(y).getPosition() - Chromosome.getMarker(x).getPosition()); 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 "strong LD" and construct blocks boolean[] usedInBlock = new boolean[Chromosome.getSize() + 1]; Vector thisBlock; int[] blockArray; for (int v = 0; v < strongPairs.size(); v++){ numStrong = 0; numRec = 0; numInGroup = 0; thisBlock = new Vector(); int first = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(0)); int last = Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(1)); int sep = Math.abs(Integer.parseInt((String)((Vector)strongPairs.elementAt(v)).elementAt(2))); //first see if this block overlaps with another: if (usedInBlock[first] || usedInBlock[last]) continue; //next, count the number of markers in the block. for (int x = first; x <=last ; x++){ if(!skipMarker[x]) numInGroup++; } //skip it if it is too long in bases for it's size in markers if (numInGroup < 4 && sep > maxDist[numInGroup]) continue; thisBlock.add(new Integer(first)); //test this block. requires 95% of informative markers to be "strong" for (int y = first+1; y <= last; y++){ if (skipMarker[y]) continue; thisBlock.add(new Integer(y)); //loop over columns in row y for (int x = first; x < y; x++){ if (skipMarker[x]) continue; PairwiseLinkage thisPair = dPrime.getLDStats(x,y); if (thisPair == null){ continue; } //get the right bits double lod = thisPair.getLOD(); double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); if (lod < -90) continue; //monomorphic marker error if (lod == 0 && lowCI == 0 && highCI == 0) continue; //skip bad markers //for small blocks use different CI cutoffs if (numInGroup < 5){ if (lowCI > cutLowCIVar[numInGroup] && highCI >= cutHighCI) numStrong++; }else{ if (lowCI > cutLowCI && highCI >= cutHighCI) numStrong++; //strong LD } if (highCI < recHighCI) numRec++; //recombination } } //change the definition somewhat for small blocks if (numInGroup > 3){ if (numStrong + numRec < 6) continue; }else if (numInGroup > 2){ if (numStrong + numRec < 3) continue; }else{ if (numStrong + numRec < 1) continue; } blockArray = new int[thisBlock.size()]; for (int z = 0; z < thisBlock.size(); z++){ blockArray[z] = ((Integer)thisBlock.elementAt(z)).intValue(); } //System.out.println(first + " " + last + " " + numStrong + " " + numRec); if ((double)numStrong/(double)(numStrong + numRec) > informFrac){ //this qualifies as a block //add to the block list, but in order by first marker number: if (blocks.size() == 0){ //put first block first blocks.add(blockArray); }else{ //sort by ascending separation of markers in each pair boolean placed = false; for (int b = 0; b < blocks.size(); b ++){ if (first < ((int[])blocks.elementAt(b))[0]){ blocks.insertElementAt(blockArray, b); placed = true; break; } } //make sure to put in blocks which fall on the tail end if (!placed) blocks.add(blockArray); } for (int used = first; used <= last; used++){ usedInBlock[used] = true; } } } return blocks; }
| 1,109,964
|
public static PhotoFolder create( String name, PhotoFolder parent ) { ODMGXAWrapper txw = new ODMGXAWrapper(); PhotoFolder folder = new PhotoFolder(); folder.setName( name ); folder.setParentFolder( parent ); txw.lock( folder, Transaction.WRITE ); txw.commit(); return folder; }
|
public static PhotoFolder create( String name, PhotoFolder parent ) { ODMGXAWrapper txw = new ODMGXAWrapper(); PhotoFolder folder = new PhotoFolder(); folder.setName( name ); folder.setParentFolder( parent ); txw.lock( folder, Transaction.WRITE ); txw.commit(); return folder; }
| 1,109,965
|
public void setName(String v) { ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.WRITE ); this.name = v; modified(); txw.commit(); }
|
public void setName(String v) { checkStringProperty( "Name", v, NAME_LENGTH ); ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.WRITE ); this.name = v; modified(); txw.commit(); }
| 1,109,966
|
private double hwCalculate(int obsAA, int obsAB, int obsBB) throws PedFileException{ //Calculates exact two-sided hardy-weinberg p-value. Parameters //are number of genotypes, number of rare alleles observed and //number of heterozygotes observed. // // (c) 2003 Jan Wigginton, Goncalo Abecasis int diplotypes = obsAA + obsAB + obsBB; if (diplotypes <= 0){ throw new PedFileException("No valid genotypes or no complete trios!"); } int rare = (obsAA*2) + obsAB; int hets = obsAB; //make sure "rare" allele is really the rare allele if (rare > diplotypes){ rare = 2*diplotypes-rare; } //make sure numbers aren't screwy if (hets > rare){ throw new PedFileException("HW test: " + hets + "heterozygotes but only " + rare + "rare alleles."); } double[] tailProbs = new double[rare+1]; for (int z = 0; z < tailProbs.length; z++){ tailProbs[z] = 0; } //start at midpoint int mid = rare * (2 * diplotypes - rare) / (2 * diplotypes); //check to ensure that midpoint and rare alleles have same parity if (((rare & 1) ^ (mid & 1)) != 0){ mid++; } int het = mid; int hom_r = (rare - mid) / 2; int hom_c = diplotypes - het - hom_r; //Calculate probability for each possible observed heterozygote //count up to a scaling constant, to avoid underflow and overflow tailProbs[mid] = 1.0; double sum = tailProbs[mid]; for (het = mid; het > 1; het -=2){ tailProbs[het-2] = (tailProbs[het] * het * (het-1.0))/(4.0*(hom_r + 1.0) * (hom_c + 1.0)); sum += tailProbs[het-2]; //2 fewer hets for next iteration -> add one rare and one common homozygote hom_r++; hom_c++; } het = mid; hom_r = (rare - mid) / 2; hom_c = diplotypes - het - hom_r; for (het = mid; het <= rare - 2; het += 2){ tailProbs[het+2] = (tailProbs[het] * 4.0 * hom_r * hom_c) / ((het+2.0)*(het+1.0)); sum += tailProbs[het+2]; //2 more hets for next iteration -> subtract one rare and one common homozygote hom_r--; hom_c--; } for (int z = 0; z < tailProbs.length; z++){ tailProbs[z] /= sum; } double top = tailProbs[hets]; for (int i = hets+1; i <= rare; i++){ top += tailProbs[i]; } double otherSide = tailProbs[hets]; for (int i = hets-1; i >= 0; i--){ otherSide += tailProbs[i]; } if (top > 0.5 && otherSide > 0.5){ return 1.0; }else{ if (top < otherSide){ return top * 2; }else{ return otherSide * 2; } } }
|
private double hwCalculate(int obsAA, int obsAB, int obsBB) throws PedFileException{ //Calculates exact two-sided hardy-weinberg p-value. Parameters //are number of genotypes, number of rare alleles observed and //number of heterozygotes observed. // // (c) 2003 Jan Wigginton, Goncalo Abecasis int diplotypes = obsAA + obsAB + obsBB; if (diplotypes <= 0){ throw new PedFileException("No valid genotypes or no complete trios!"); } int rare = (obsAA*2) + obsAB; int hets = obsAB; //make sure "rare" allele is really the rare allele if (rare > diplotypes){ rare = 2*diplotypes-rare; } //make sure numbers aren't screwy if (hets > rare){ throw new PedFileException("HW test: " + hets + "heterozygotes but only " + rare + "rare alleles."); } double[] tailProbs = new double[rare+1]; for (int z = 0; z < tailProbs.length; z++){ tailProbs[z] = 0; } //start at midpoint int mid = rare * (2 * diplotypes - rare) / (2 * diplotypes); //check to ensure that midpoint and rare alleles have same parity if (((rare & 1) ^ (mid & 1)) != 0){ mid++; } int het = mid; int hom_r = (rare - mid) / 2; int hom_c = diplotypes - het - hom_r; //Calculate probability for each possible observed heterozygote //count up to a scaling constant, to avoid underflow and overflow tailProbs[mid] = 1.0; double sum = tailProbs[mid]; for (het = mid; het > 1; het -=2){ tailProbs[het-2] = (tailProbs[het] * het * (het-1.0))/(4.0*(hom_r + 1.0) * (hom_c + 1.0)); sum += tailProbs[het-2]; //2 fewer hets for next iteration -> add one rare and one common homozygote hom_r++; hom_c++; } het = mid; hom_r = (rare - mid) / 2; hom_c = diplotypes - het - hom_r; for (het = mid; het <= rare - 2; het += 2){ tailProbs[het+2] = (tailProbs[het] * 4.0 * hom_r * hom_c) / ((het+2.0)*(het+1.0)); sum += tailProbs[het+2]; //2 more hets for next iteration -> subtract one rare and one common homozygote hom_r--; hom_c--; } for (int z = 0; z < tailProbs.length; z++){ tailProbs[z] /= sum; } double top = tailProbs[hets]; for (int i = hets+1; i <= rare; i++){ top += tailProbs[i]; } double otherSide = tailProbs[hets]; for (int i = hets-1; i >= 0; i--){ otherSide += tailProbs[i]; } if (top > 0.5 && otherSide > 0.5){ return 1.0; }else{ if (top < otherSide){ return top * 2; }else{ return otherSide * 2; } } }
| 1,109,968
|
public void addChild(Component component) { Object parent = getBean(); if ( parent instanceof JFrame && component instanceof JMenuBar ) { JFrame frame = (JFrame) parent; frame.setJMenuBar( (JMenuBar) component ); } else if ( parent instanceof RootPaneContainer ) { RootPaneContainer rpc = (RootPaneContainer) parent; rpc.getContentPane().add( component ); } else if ( parent instanceof JScrollPane ) { JScrollPane scrollPane = (JScrollPane) parent; scrollPane.setViewportView( component ); } else if ( parent instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) parent; if ( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ) { if ( splitPane.getTopComponent() == null ) { splitPane.setTopComponent( component ); } else { splitPane.setBottomComponent( component ); } } else { if ( splitPane.getLeftComponent() == null ) { splitPane.setLeftComponent( component ); } else { splitPane.setRightComponent( component ); } } } else if ( parent instanceof JMenuBar && component instanceof JMenu ) { JMenuBar menuBar = (JMenuBar) parent; menuBar.add( (JMenu) component ); } else if ( parent instanceof Container ) { Container container = (Container) parent; container.add( component ); } }
|
public void addChild(Component component, Object constraints) { Object parent = getBean(); if ( parent instanceof JFrame && component instanceof JMenuBar ) { JFrame frame = (JFrame) parent; frame.setJMenuBar( (JMenuBar) component ); } else if ( parent instanceof RootPaneContainer ) { RootPaneContainer rpc = (RootPaneContainer) parent; rpc.getContentPane().add( component ); } else if ( parent instanceof JScrollPane ) { JScrollPane scrollPane = (JScrollPane) parent; scrollPane.setViewportView( component ); } else if ( parent instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) parent; if ( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ) { if ( splitPane.getTopComponent() == null ) { splitPane.setTopComponent( component ); } else { splitPane.setBottomComponent( component ); } } else { if ( splitPane.getLeftComponent() == null ) { splitPane.setLeftComponent( component ); } else { splitPane.setRightComponent( component ); } } } else if ( parent instanceof JMenuBar && component instanceof JMenu ) { JMenuBar menuBar = (JMenuBar) parent; menuBar.add( (JMenu) component ); } else if ( parent instanceof Container ) { Container container = (Container) parent; container.add( component ); } }
| 1,109,969
|
public void addChild(Component component) { Object parent = getBean(); if ( parent instanceof JFrame && component instanceof JMenuBar ) { JFrame frame = (JFrame) parent; frame.setJMenuBar( (JMenuBar) component ); } else if ( parent instanceof RootPaneContainer ) { RootPaneContainer rpc = (RootPaneContainer) parent; rpc.getContentPane().add( component ); } else if ( parent instanceof JScrollPane ) { JScrollPane scrollPane = (JScrollPane) parent; scrollPane.setViewportView( component ); } else if ( parent instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) parent; if ( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ) { if ( splitPane.getTopComponent() == null ) { splitPane.setTopComponent( component ); } else { splitPane.setBottomComponent( component ); } } else { if ( splitPane.getLeftComponent() == null ) { splitPane.setLeftComponent( component ); } else { splitPane.setRightComponent( component ); } } } else if ( parent instanceof JMenuBar && component instanceof JMenu ) { JMenuBar menuBar = (JMenuBar) parent; menuBar.add( (JMenu) component ); } else if ( parent instanceof Container ) { Container container = (Container) parent; container.add( component ); } }
|
public void addChild(Component component) { Object parent = getBean(); if ( parent instanceof JFrame && component instanceof JMenuBar ) { JFrame frame = (JFrame) parent; frame.setJMenuBar( (JMenuBar) component ); } else if ( parent instanceof RootPaneContainer ) { RootPaneContainer rpc = (RootPaneContainer) parent; rpc.getContentPane().add( component ); } else if ( parent instanceof JScrollPane ) { JScrollPane scrollPane = (JScrollPane) parent; scrollPane.setViewportView( component ); } else if ( parent instanceof JSplitPane) { JSplitPane splitPane = (JSplitPane) parent; if ( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ) { if ( splitPane.getTopComponent() == null ) { splitPane.setTopComponent( component ); } else { splitPane.setBottomComponent( component ); } } else { if ( splitPane.getLeftComponent() == null ) { splitPane.setLeftComponent( component ); } else { splitPane.setRightComponent( component ); } } } else if ( parent instanceof JMenuBar && component instanceof JMenu ) { JMenuBar menuBar = (JMenuBar) parent; menuBar.add( (JMenu) component ); } else if ( parent instanceof Container ) { Container container = (Container) parent; if (constraints != null) { container.add( component, constraints ); } else { container.add( component ); } } }
| 1,109,970
|
protected void processBean(String var, Object bean) throws Exception { if (var != null) { context.setVariable(var, bean); } else { Component component = getComponent(); if ( component != null ) { ComponentTag parentTag = (ComponentTag) findAncestorWithClass( ComponentTag.class ); if ( parentTag != null ) { parentTag.addChild(component); } else { throw new JellyException( "This tag must be used within a JellySwing widget tag or the 'var' attribute must be specified" ); } } } }
|
protected void processBean(String var, Object bean) throws Exception { if (var != null) { context.setVariable(var, bean); } else { Component component = getComponent(); if ( component != null ) { ComponentTag parentTag = (ComponentTag) findAncestorWithClass( ComponentTag.class ); if ( parentTag != null ) { parentTag.addChild(component); } else { throw new JellyException( "This tag must be used within a JellySwing widget tag or the 'var' attribute must be specified" ); } } } }
| 1,109,971
|
protected void setBeanProperties(Object bean, Map attributes) throws Exception { for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); // ### special hacks for properties that don't introspect properly Component component = getComponent(); if ( component != null ) { if ( name.equals( "location" ) ) { Point p = null; if ( value instanceof Point ) { p = (Point) value; } else if ( value != null) { p = (Point) ConvertUtils.convert( value.toString(), Point.class ); } component.setLocation(p); } else if ( name.equals( "size" ) ) { Dimension d = null; if ( value instanceof Dimension ) { d = (Dimension) value; } else if ( value != null) { d = (Dimension) ConvertUtils.convert( value.toString(), Dimension.class ); } component.setSize(d); } else { BeanUtils.setProperty(component, name, value); } } else { BeanUtils.setProperty(bean, name, value); } } }
|
protected void setBeanProperties(Object bean, Map attributes) throws Exception { for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); // ### special hacks for properties that don't introspect properly Component component = getComponent(); if ( component != null ) { if ( name.equals( "location" ) ) { Point p = null; if ( value instanceof Point ) { p = (Point) value; } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } else if ( value != null) { p = (Point) ConvertUtils.convert( value.toString(), Point.class ); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } component.setLocation(p); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } else if ( name.equals( "size" ) ) { Dimension d = null; if ( value instanceof Dimension ) { d = (Dimension) value; } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } else if ( value != null) { d = (Dimension) ConvertUtils.convert( value.toString(), Dimension.class ); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } component.setSize(d); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } else { BeanUtils.setProperty(component, name, value); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } else { BeanUtils.setProperty(bean, name, value); } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); } } else if ( name.equalsIgnoreCase("background") || name.equalsIgnoreCase("foreground")) { Color c = null; if (value instanceof Color) { c = (Color) value; } else if (value != null) { c = (Color) ConvertUtils.convert( value.toString(), Color.class); } if (name.equalsIgnoreCase("background")) { component.setBackground(c); } else { component.setForeground(c); } } else if ( name.equalsIgnoreCase("debugGraphicsOption") || name.equalsIgnoreCase("debugGraphics") || name.equalsIgnoreCase("debug")) { Integer v = null; if (!(value instanceof Integer)) v = (Integer) ConvertUtils.convert( value.toString(), Integer.class); else v = (Integer) value; if (!(component instanceof JComponent)) throw new IllegalArgumentException("DebugGraphics can only be set on a JComponent subclass."); ((JComponent) component).setDebugGraphicsOptions( v.intValue()); }
| 1,109,972
|
protected abstract void init(Map<String, String> properties);
|
public void init(Element qualifyingCriteria) { properties = new Properties(qualifyingCriteria); init(properties); }
| 1,109,974
|
public boolean canAccess(String acl){ String authorizedList = ACLStore.getInstance().getProperty(acl); if(authorizedList == null) return false; StringTokenizer tokenizer = new StringTokenizer(authorizedList, ","); while(tokenizer.hasMoreTokens()){ if(getUsername().equalsIgnoreCase(tokenizer.nextToken())){ return true; } } for(Iterator it=getRoles().iterator(); it.hasNext();){ Role role = (Role)it.next(); if(role.canAccess(acl)) return true; } return false; }
|
public boolean canAccess(String acl){ String authorizedList = ACLStore.getInstance().getProperty(acl); if(authorizedList == null) return true; StringTokenizer tokenizer = new StringTokenizer(authorizedList, ","); while(tokenizer.hasMoreTokens()){ if(getUsername().equalsIgnoreCase(tokenizer.nextToken())){ return true; } } for(Iterator it=getRoles().iterator(); it.hasNext();){ Role role = (Role)it.next(); if(role.canAccess(acl)) return true; } return true; }
| 1,109,975
|
public String computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
|
public PairwiseLinkage computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
| 1,109,977
|
public String computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
|
public String computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
| 1,109,978
|
public String computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
|
public String computeDPrime(int a, int b, int c, int d, int e, double f){ int i,j,k,count,itmp; int low_i = 0; int high_i = 0; double[] nAA = new double[1]; double[] nBB = new double[1]; double[] nAB = new double[1]; double[] nBA = new double[1]; double[] pAA = new double[1]; double[] pBB = new double[1]; double[] pAB = new double[1]; double[] pBA = new double[1]; double loglike, oldloglike, meand, mean2d, sd; double g,h,m,tmp,r; double num, denom1, denom2, denom, dprime, real_dprime; double pA1, pB1, pA2, pB2, loglike1, loglike0, r2; double tmpAA, tmpAB, tmpBA, tmpBB, dpr, tmp2AA, tmp2AB, tmp2BA, tmp2BB; double total_prob, sum_prob; double lsurface[] = new double[105]; /* store arguments in externals and compute allele frequencies */ known[AA]=(double)a; known[AB]=(double)b; known[BA]=(double)c; known[BB]=(double)d; unknownDH=e; total_chroms= a+b+c+d+(2*unknownDH); pA1 = (double) (a+b+unknownDH) / (double) total_chroms; pB1 = 1.0-pA1; pA2 = (double) (a+c+unknownDH) / (double) total_chroms; pB2 = 1.0-pA2; const_prob = f; /* set initial conditions */ if (const_prob < 0.00) { pAA[0]=pA1*pA2; pAB[0]=pA1*pB2; pBA[0]=pB1*pA2; pBB[0]=pB1*pB2; } else { pAA[0]=const_prob; pAB[0]=const_prob; pBA[0]=const_prob; pBB[0]=const_prob;; /* so that the first count step will produce an initial estimate without inferences (this should be closer and therefore speedier than assuming they are all at equal frequency) */ count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,0); estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); } /* now we have an initial reasonable guess at p we can start the EM - let the fun begin */ const_prob=0.0; count=1; loglike=-999999999.0; do { oldloglike=loglike; count_haps(pAA[0],pAB[0],pBA[0],pBB[0],nAA,nAB,nBA,nBB,count); loglike = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); if (Math.abs(loglike-oldloglike) < TOLERANCE) break; estimate_p(nAA[0],nAB[0],nBA[0],nBB[0],pAA,pAB,pBA,pBB); count++; } while(count < 1000); /* in reality I've never seen it need more than 10 or so iterations to converge so this is really here just to keep it from running off into eternity */ loglike1 = known[AA]*log10(pAA[0]) + known[AB]*log10(pAB[0]) + known[BA]*log10(pBA[0]) + known[BB]*log10(pBB[0]) + (double)unknownDH*log10(pAA[0]*pBB[0] + pAB[0]*pBA[0]); loglike0 = known[AA]*log10(pA1*pA2) + known[AB]*log10(pA1*pB2) + known[BA]*log10(pB1*pA2) + known[BB]*log10(pB1*pB2) + (double)unknownDH*log10(2*pA1*pA2*pB1*pB2); num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; if (num < 0) { /* flip matrix so we get the positive D' */ /* flip AA with AB and BA with BB */ tmp=pAA[0]; pAA[0]=pAB[0]; pAB[0]=tmp; tmp=pBB[0]; pBB[0]=pBA[0]; pBA[0]=tmp; /* flip frequency of second allele */ tmp=pA2; pA2=pB2; pB2=tmp; /* flip counts in the same fashion as p's */ tmp=nAA[0]; nAA[0]=nAB[0]; nAB[0]=tmp; tmp=nBB[0]; nBB[0]=nBA[0]; nBA[0]=tmp; /* num has now undergone a sign change */ num = pAA[0]*pBB[0] - pAB[0]*pBA[0]; /* flip known array for likelihood computation */ tmp=known[AA]; known[AA]=known[AB]; known[AB]=tmp; tmp=known[BB]; known[BB]=known[BA]; known[BA]=tmp; } denom1 = (pAA[0]+pBA[0])*(pBA[0]+pBB[0]); denom2 = (pAA[0]+pAB[0])*(pAB[0]+pBB[0]); if (denom1 < denom2) { denom = denom1; } else { denom = denom2; } dprime = num/denom; /* add computation of r^2 = (D^2)/p(1-p)q(1-q) */ r2 = num*num/(pA1*pB1*pA2*pB2); /* we've computed D', its' LOD, and r^2 - let's store them and then compute confidence intervals */ String returnStr = new String(""); NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); returnStr += nf.format(dprime); returnStr += "\t"; returnStr += nf.format(loglike1-loglike0); returnStr += "\t"; returnStr += nf.format(r2); returnStr += "\t"; real_dprime=dprime; for (i=0; i<=100; i++) { dpr = (double)i*0.01; tmpAA = dpr*denom + pA1*pA2; tmpAB = pA1-tmpAA; tmpBA = pA2-tmpAA; tmpBB = pB1-tmpBA; if (i==100) { /* one value will be 0 */ if (tmpAA < 1e-10) tmpAA=1e-10; if (tmpAB < 1e-10) tmpAB=1e-10; if (tmpBA < 1e-10) tmpBA=1e-10; if (tmpBB < 1e-10) tmpBB=1e-10; } lsurface[i] = known[AA]*log10(tmpAA) + known[AB]*log10(tmpAB) + known[BA]*log10(tmpBA) + known[BB]*log10(tmpBB) + (double)unknownDH*log10(tmpAA*tmpBB + tmpAB*tmpBA); } /* Confidence bounds #2 - used in Gabriel et al (2002) - translate into posterior dist of D' - assumes a flat prior dist. of D' - someday we may be able to make this even more clever by adjusting given the distribution of observed D' values for any given distance after some large scale studies are complete */ total_prob=sum_prob=0.0; for (i=0; i<=100; i++) { lsurface[i] -= loglike1; lsurface[i] = Math.pow(10.0,lsurface[i]); total_prob += lsurface[i]; } for (i=0; i<=100; i++) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { low_i = i-1; break; } } sum_prob=0.0; for (i=100; i>=0; i--) { sum_prob += lsurface[i]; if (sum_prob > 0.05*total_prob && sum_prob-lsurface[i] < 0.05*total_prob) { high_i = i+1; break; } } returnStr += (double) low_i/100.0; returnStr += "\t"; returnStr += (double) high_i/100.0; return returnStr; }
| 1,109,979
|
String[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset String [][] dPrimeTable = new String[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
|
PairwiseLinkage[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset String [][] dPrimeTable = new String[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
| 1,109,980
|
String[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset String [][] dPrimeTable = new String[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
|
String[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset PairwiseLinkage[][] dPrimeTable = new PairwiseLinkage[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
| 1,109,981
|
String[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset String [][] dPrimeTable = new String[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = "0\t0\t0\t0\t0"; continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
|
String[][] generateDPrimeTable(final Vector chromosomes){ numCompleted = 0; //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset String [][] dPrimeTable = new String[((Chromosome) chromosomes.firstElement()).size()][((Chromosome) chromosomes.firstElement()).size()]; int doublehet; int[][] twoMarkerHaplos = new int[3][3]; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ numCompleted ++; for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (m1a1 > 0){ if (m1a2 == 0 && !(a1.equals("h")) && !(a1.equals("0")) && Integer.parseInt(a1) != m1a1) m1a2 = Integer.parseInt(a1); } else if (!(a1.equals("h")) && !(a1.equals("0"))) m1a1=Integer.parseInt(a1); if (m2a1 > 0){ if (m2a2 == 0 && !(a2.equals("h")) && !(a2.equals("0")) && Integer.parseInt(a2) != m2a1) m2a2 = Integer.parseInt(a2); } else if (!(a2.equals("h")) && !(a2.equals("0"))) m2a1=Integer.parseInt(a2); if (a1.equals("h")) m1H++; if (a2.equals("h")) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //assign alleles for each of a pair of chromosomes at a marker to four variables String a1 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos1).toString(); String a2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); String b1 = ((Chromosome) chromosomes.elementAt(++i)).elementAt(pos1).toString(); String b2 = ((Chromosome) chromosomes.elementAt(i)).elementAt(pos2).toString(); if (a1.equals("0") || a2.equals("0") || b1.equals("0") || b2.equals("0")){ //skip missing data } else if ((a1.equals("h") && a2.equals("h")) || (a1.equals("h") && !(a2.equals(b2))) || (a2.equals("h") && !(a1.equals(b1)))) doublehet++; //find doublehets and resolved haplotypes else if (a1.equals("h")){ twoMarkerHaplos[1][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[2][marker2num[Integer.parseInt(a2)]]++; } else if (a2.equals("h")){ twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][1]++; twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][2]++; } else { twoMarkerHaplos[marker1num[Integer.parseInt(a1)]][marker2num[Integer.parseInt(a2)]]++; twoMarkerHaplos[marker1num[Integer.parseInt(b1)]][marker2num[Integer.parseInt(b2)]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); } } return dPrimeTable; }
| 1,109,982
|
Vector guessBlocks(String[][] dPrime, int method){ Vector returnVec = new Vector(); switch(method){ case 0: returnVec = new FindBlocks(dPrime).doSFS(); break; case 1: returnVec = new FindBlocks(dPrime).doMJD(); break; } return returnVec; }
|
Vector guessBlocks(PairwiseLinkage[][] dPrime, int method){ Vector returnVec = new Vector(); switch(method){ case 0: returnVec = new FindBlocks(dPrime).doSFS(); break; case 1: returnVec = new FindBlocks(dPrime).doMJD(); break; } return returnVec; }
| 1,109,983
|
Vector guessBlocks(String[][] dPrime, int method){ Vector returnVec = new Vector(); switch(method){ case 0: returnVec = new FindBlocks(dPrime).doSFS(); break; case 1: returnVec = new FindBlocks(dPrime).doMJD(); break; } return returnVec; }
|
Vector guessBlocks(String[][] dPrime, int method){ Vector returnVec = new Vector(); switch(method){ case 0: returnVec = new FindBlocks(dPrime).doSFS(); break; case 1: returnVec = new FindBlocks(dPrime).do4Gamete(); break; case 2: returnVec = new FindBlocks(dPrime).doMJD(); break; } return returnVec; }
| 1,109,984
|
int prepareMarkerInput(File infile) throws IOException{ //this method is called to gather data about the markers used. //It is assumed that the input file is two columns, the first being //the name and the second the absolute position String currentLine; Vector markers = new Vector(); //read the file: BufferedReader in = new BufferedReader(new FileReader(infile)); // a vector of SNP's is created and returned. int snpcount = 0; while ((currentLine = in.readLine()) != null){ //to compute maf, browse chrom list and count instances of each allele String a1 = ""; double numa1 = 0; double numa2 = 0; for (int i = 0; i < chromosomes.size(); i++){ //if there is a data point for this marker on this chromosome String thisAllele = (String)((Chromosome)chromosomes.elementAt(i)).elementAt(snpcount); if (!(thisAllele.equals("0"))){ if (thisAllele.equals("h")){ numa1+=0.5; numa2+=0.5; }else if (a1.equals("")){ a1 = thisAllele; numa1++; }else if (thisAllele.equals(a1)){ numa1++; }else{ numa2++; } } } System.out.println(numa1 + " " + numa2); double maf = numa1/(numa2+numa1); if (maf > 0.5) maf = 1.0-maf; StringTokenizer st = new StringTokenizer(currentLine); markers.add(new SNP(st.nextToken(), Long.parseLong(st.nextToken()), infile.getName(), maf)); snpcount ++; } if (markerInfo.size() == markers.size()){ markerInfo = markers; return 1; }else{ return -1; } }
|
int prepareMarkerInput(File infile) throws IOException{ //this method is called to gather data about the markers used. //It is assumed that the input file is two columns, the first being //the name and the second the absolute position String currentLine; Vector markers = new Vector(); //read the file: BufferedReader in = new BufferedReader(new FileReader(infile)); // a vector of SNP's is created and returned. int snpcount = 0; while ((currentLine = in.readLine()) != null){ //to compute maf, browse chrom list and count instances of each allele String a1 = ""; double numa1 = 0; double numa2 = 0; for (int i = 0; i < chromosomes.size(); i++){ //if there is a data point for this marker on this chromosome String thisAllele = (String)((Chromosome)chromosomes.elementAt(i)).elementAt(snpcount); if (!(thisAllele.equals("0"))){ if (thisAllele.equals("h")){ numa1+=0.5; numa2+=0.5; }else if (a1.equals("")){ a1 = thisAllele; numa1++; }else if (thisAllele.equals(a1)){ numa1++; }else{ numa2++; } } } double maf = numa1/(numa2+numa1); if (maf > 0.5) maf = 1.0-maf; StringTokenizer st = new StringTokenizer(currentLine); markers.add(new SNP(st.nextToken(), Long.parseLong(st.nextToken()), infile.getName(), maf)); snpcount ++; } if (markerInfo.size() == markers.size()){ markerInfo = markers; return 1; }else{ return -1; } }
| 1,109,985
|
public TaggerController(HaploData hd, Vector included, Vector excluded, Vector sitesToCapture, int aggressionLevel) { theData = hd; taggerSNPs = new Vector(); snpHash = new Hashtable(); for(int i=0;i<sitesToCapture.size();i++) { SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP s = new edu.mit.wi.tagger.SNP(tempSNP.getName(),tempSNP.getPosition(),tempSNP.getMAF()); taggerSNPs.add(s); snpHash.put(tempSNP.getName(),s); } Vector includedSNPs = new Vector(); for(int i=0;i<included.size();i++) { includedSNPs.add(snpHash.get(included.get(i))); } Vector excludedSNPs = new Vector(); for(int i=0;i<excluded.size();i++) { excludedSNPs.add(snpHash.get(excluded.get(i))); } Hashtable indicesByVarSeq = new Hashtable(); for(int i=0;i<Chromosome.getSize();i++) { if(sitesToCapture.contains(Chromosome.getMarker(i))) { indicesByVarSeq.put(snpHash.get(Chromosome.getMarker(i).getName()),new Integer(i)); } } for (int i = 0; i < sitesToCapture.size(); i++){ SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP taggerSNP = (edu.mit.wi.tagger.SNP) snpHash.get(tempSNP.getName()); int p = ((Integer)indicesByVarSeq.get(taggerSNP)).intValue(); for (int j = 1; j < theData.dpTable.getLength(p); j++){ if (theData.dpTable.getLDStats(p,j+p).getLOD() >= Options.getTaggerLODCutoff()){ if (indicesByVarSeq.containsValue(new Integer(j+p))){ edu.mit.wi.tagger.SNP ldsnp = (edu.mit.wi.tagger.SNP) snpHash.get(Chromosome.getMarker(j+p).getName()); taggerSNP.addToLDList(ldsnp); ldsnp.addToLDList(taggerSNP); } } } } HaploviewAlleleCorrelator hac = new HaploviewAlleleCorrelator(indicesByVarSeq,theData); tagger = new Tagger(taggerSNPs,includedSNPs,excludedSNPs, hac, Options.getTaggerRsqCutoff(), aggressionLevel); }
|
public TaggerController(HaploData hd, Vector included, Vector excluded, Vector sitesToCapture, int aggressionLevel) { theData = hd; taggerSNPs = new Vector(); snpHash = new Hashtable(); for(int i=0;i<sitesToCapture.size();i++) { SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP s = new edu.mit.wi.tagger.SNP(tempSNP.getName(),tempSNP.getPosition(),tempSNP.getMAF()); taggerSNPs.add(s); snpHash.put(tempSNP.getName(),s); } Vector includedSNPs = new Vector(); for(int i=0;i<included.size();i++) { includedSNPs.add(snpHash.get(included.get(i))); } Vector excludedSNPs = new Vector(); for(int i=0;i<excluded.size();i++) { excludedSNPs.add(snpHash.get(excluded.get(i))); } Hashtable indicesByVarSeq = new Hashtable(); for(int i=0;i<Chromosome.getSize();i++) { if(sitesToCapture.contains(Chromosome.getMarker(i))) { indicesByVarSeq.put(snpHash.get(Chromosome.getMarker(i).getName()),new Integer(i)); } } for (int i = 0; i < sitesToCapture.size(); i++){ SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP taggerSNP = (edu.mit.wi.tagger.SNP) snpHash.get(tempSNP.getName()); int p = ((Integer)indicesByVarSeq.get(taggerSNP)).intValue(); for (int j = 1; j < theData.dpTable.getLength(p); j++){ PairwiseLinkage pl = theData.dpTable.getLDStats(p,j+p); if (pl != null && pl.getLOD() >= Options.getTaggerLODCutoff()){ if (indicesByVarSeq.containsValue(new Integer(j+p))){ edu.mit.wi.tagger.SNP ldsnp = (edu.mit.wi.tagger.SNP) snpHash.get(Chromosome.getMarker(j+p).getName()); taggerSNP.addToLDList(ldsnp); ldsnp.addToLDList(taggerSNP); } } } } HaploviewAlleleCorrelator hac = new HaploviewAlleleCorrelator(indicesByVarSeq,theData); tagger = new Tagger(taggerSNPs,includedSNPs,excludedSNPs, hac, Options.getTaggerRsqCutoff(), aggressionLevel); }
| 1,109,986
|
public TaggerController(HaploData hd, Vector included, Vector excluded, Vector sitesToCapture, int aggressionLevel) { theData = hd; taggerSNPs = new Vector(); snpHash = new Hashtable(); for(int i=0;i<sitesToCapture.size();i++) { SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP s = new edu.mit.wi.tagger.SNP(tempSNP.getName(),tempSNP.getPosition(),tempSNP.getMAF()); taggerSNPs.add(s); snpHash.put(tempSNP.getName(),s); } Vector includedSNPs = new Vector(); for(int i=0;i<included.size();i++) { includedSNPs.add(snpHash.get(included.get(i))); } Vector excludedSNPs = new Vector(); for(int i=0;i<excluded.size();i++) { excludedSNPs.add(snpHash.get(excluded.get(i))); } Hashtable indicesByVarSeq = new Hashtable(); for(int i=0;i<Chromosome.getSize();i++) { if(sitesToCapture.contains(Chromosome.getMarker(i))) { indicesByVarSeq.put(snpHash.get(Chromosome.getMarker(i).getName()),new Integer(i)); } } for (int i = 0; i < sitesToCapture.size(); i++){ SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP taggerSNP = (edu.mit.wi.tagger.SNP) snpHash.get(tempSNP.getName()); int p = ((Integer)indicesByVarSeq.get(taggerSNP)).intValue(); for (int j = 1; j < theData.dpTable.getLength(p); j++){ if (theData.dpTable.getLDStats(p,j+p).getLOD() >= Options.getTaggerLODCutoff()){ if (indicesByVarSeq.containsValue(new Integer(j+p))){ edu.mit.wi.tagger.SNP ldsnp = (edu.mit.wi.tagger.SNP) snpHash.get(Chromosome.getMarker(j+p).getName()); taggerSNP.addToLDList(ldsnp); ldsnp.addToLDList(taggerSNP); } } } } HaploviewAlleleCorrelator hac = new HaploviewAlleleCorrelator(indicesByVarSeq,theData); tagger = new Tagger(taggerSNPs,includedSNPs,excludedSNPs, hac, Options.getTaggerRsqCutoff(), aggressionLevel); }
|
public TaggerController(HaploData hd, Vector included, Vector excluded, Vector sitesToCapture, int aggressionLevel) { theData = hd; taggerSNPs = new Vector(); snpHash = new Hashtable(); for(int i=0;i<sitesToCapture.size();i++) { SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP s = new edu.mit.wi.tagger.SNP(tempSNP.getName(),tempSNP.getPosition(),tempSNP.getMAF()); taggerSNPs.add(s); snpHash.put(tempSNP.getName(),s); } Vector includedSNPs = new Vector(); for(int i=0;i<included.size();i++) { includedSNPs.add(snpHash.get(included.get(i))); } Vector excludedSNPs = new Vector(); for(int i=0;i<excluded.size();i++) { excludedSNPs.add(snpHash.get(excluded.get(i))); } Hashtable indicesByVarSeq = new Hashtable(); for(int i=0;i<Chromosome.getSize();i++) { if(sitesToCapture.contains(Chromosome.getMarker(i))) { indicesByVarSeq.put(snpHash.get(Chromosome.getMarker(i).getName()),new Integer(i)); } } for (int i = 0; i < sitesToCapture.size(); i++){ SNP tempSNP = (SNP) sitesToCapture.get(i); edu.mit.wi.tagger.SNP taggerSNP = (edu.mit.wi.tagger.SNP) snpHash.get(tempSNP.getName()); int p = ((Integer)indicesByVarSeq.get(taggerSNP)).intValue(); for (int j = 1; j < theData.dpTable.getLength(p); j++){ if (theData.dpTable.getLDStats(p,j+p).getLOD() >= Options.getTaggerLODCutoff()){ if (indicesByVarSeq.containsValue(new Integer(j+p))){ edu.mit.wi.tagger.SNP ldsnp = (edu.mit.wi.tagger.SNP) snpHash.get(Chromosome.getMarker(j+p).getName()); taggerSNP.addToLDList(ldsnp); ldsnp.addToLDList(taggerSNP); } } } } HaploviewAlleleCorrelator hac = new HaploviewAlleleCorrelator(indicesByVarSeq,theData); tagger = new Tagger(taggerSNPs,includedSNPs,excludedSNPs, hac, Options.getTaggerRsqCutoff(), aggressionLevel, Options.getMaxDistance()); }
| 1,109,987
|
public Vector findTags() { tags = new Vector(); untagged = new Vector(); taggedSoFar = 0; //potentialTagsHash stores the PotentialTag objects keyed on the corresponding sequences Hashtable potentialTagByVarSeq = new Hashtable(); PotentialTagComparator ptcomp = new PotentialTagComparator(); VariantSequence currentVarSeq; //create SequenceComparison objects for each potential Tag, and //add any comparisons which have an r-squared greater than the minimum. for(int i=0;i<snps.size();i++) { currentVarSeq = (VariantSequence)snps.get(i); if(!(forceExclude.contains(currentVarSeq) ) ){ PotentialTag tempPT = new PotentialTag(currentVarSeq); for(int j=0;j<snps.size();j++) { if( maxComparisonDistance == 0 || Math.abs(((SNP)currentVarSeq).getLocation() - ((SNP)snps.get(j)).getLocation()) <= maxComparisonDistance) { if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(j)); } } } potentialTagByVarSeq.put(currentVarSeq,tempPT); } } Vector sitesToCapture = (Vector) snps.clone(); debugPrint("snps to tag: " + sitesToCapture.size()); Vector potentialTags = new Vector(potentialTagByVarSeq.values()); int countTagged = 0; //add Tags for the ones which are forced in. Vector includedPotentialTags = new Vector(); //construct a list of PotentialTag objects for forced in sequences for (int i = 0; i < forceInclude.size(); i++) { VariantSequence variantSequence = (VariantSequence) forceInclude.elementAt(i); if(variantSequence != null && potentialTagByVarSeq.containsKey(variantSequence)) { includedPotentialTags.add((PotentialTag) potentialTagByVarSeq.get(variantSequence)); } } //add each forced in sequence to the list of tags for(int i=0;i<includedPotentialTags.size();i++) { PotentialTag curPT = (PotentialTag) includedPotentialTags.get(i); HashSet newlyTagged = addTag(curPT,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(curPT.sequence); } //loop until all snps are tagged while(sitesToCapture.size() > 0) { potentialTags = new Vector(potentialTagByVarSeq.values()); if(potentialTags.size() == 0) { //we still have sites left to capture, but we have no more available tags. //this should only happen if the sites remaining in sitesToCapture were specifically //excluded from being tags. Since we can't add any more tags, break out of the loop. break; } //sorts the array of potential tags according to the number of untagged sites they can tag. //the last element is the one which tags the most untagged sites, so we choose that as our next tag. Collections.sort(potentialTags,ptcomp); PotentialTag currentBestTag = (PotentialTag) potentialTags.lastElement(); HashSet newlyTagged = addTag(currentBestTag,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(currentBestTag.sequence); } taggedSoFar = countTagged; if(sitesToCapture.size() > 0) { //any sites left in sitesToCapture could not be tagged, so we add them all to the untagged Vector untagged.addAll(sitesToCapture); } debugPrint("tagged " + countTagged + " SNPS using " + tags.size() +" tags" ); debugPrint("# of SNPs that could not be tagged: " + untagged.size()); if (aggression != PAIRWISE_ONLY){ //peelback starting with the worst tag (i.e. the one that tags the fewest other snps. Vector tags2BPeeled = (Vector)tags.clone(); Collections.reverse(tags2BPeeled); peelBack(tags2BPeeled); } //we've done the best we can. now we check to see if there's a limit to the //num of tags we're allowed to choose. if (maxNumTags > 0){ //if so we need to chuck out the extras. figure out the utility of each tagSNP //i.e. how many SNPs for which they and their combos are the only tags while (getTagSNPs().size() > maxNumTags){ Vector tagSNPs = getTagSNPs(); potentialTagByVarSeq = new Hashtable(); Hashtable tagSeqByPotentialTag = new Hashtable(); //account for stuff tagged by snps themselves for (int i = 0; i < tagSNPs.size(); i++){ TagSequence ts = (TagSequence) tagSNPs.get(i); PotentialTag pt = new PotentialTag(ts.getSequence()); pt.addTagged(ts.getTagged()); potentialTagByVarSeq.put(ts.getSequence(),pt); tagSeqByPotentialTag.put(pt,ts); } //go through all pt's and add their utilities as members of combos Vector tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); for (int j = 0; j < b.getSnps().size(); j++){ ((PotentialTag)potentialTagByVarSeq.get(b.getSNP(j))).addTagged(ts.getTagged()); } } //now perform the steps of sorting and peeling Vector potTagVec = new Vector(potentialTagByVarSeq.values()); Collections.sort(potTagVec,ptcomp); PotentialTag dumpedPT = (PotentialTag)potTagVec.firstElement(); TagSequence dumpedTS = (TagSequence) tagSeqByPotentialTag.get(dumpedPT); Vector taggedByCurTag = dumpedTS.getTagged(); for (int j = 0; j < taggedByCurTag.size(); j++){ //note for everything tagged by this guy that they're no longer tagged by him VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); if (b.getSnps().contains(dumpedTS.getSequence())){ //this hap tag is now defunct because it was comprised in part by dumpedTS Vector taggedByHap = ts.getTagged(); for (int j = 0; j < taggedByHap.size(); j++){ VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tags.remove(ts); } } tags.remove(dumpedTS); } } int count = 0; double numOver8 = 0; meanRSq = 0; Iterator itr = snps.iterator(); while (itr.hasNext()){ SNP s = (SNP) itr.next(); TagSequence ts = s.getBestTag(); if (ts != null){ double d = getPairwiseComp(s, ts.getSequence()).getRsq(); meanRSq += d; count++; if (d >= 0.8){ numOver8++; } } } meanRSq /= count; percentOver8 = (int) Math.rint((100*numOver8) / count); return new Vector(tags); }
|
public Vector findTags() { tags = new Vector(); untagged = new Vector(); taggedSoFar = 0; //potentialTagsHash stores the PotentialTag objects keyed on the corresponding sequences Hashtable potentialTagByVarSeq = new Hashtable(); PotentialTagComparator ptcomp = new PotentialTagComparator(); VariantSequence currentVarSeq; //create SequenceComparison objects for each potential Tag, and //add any comparisons which have an r-squared greater than the minimum. for(int i=0;i<snps.size();i++) { currentVarSeq = (VariantSequence)snps.get(i); if(!(forceExclude.contains(currentVarSeq) ) ){ PotentialTag tempPT = new PotentialTag(currentVarSeq); for(int j=0;j<snps.size();j++) { if( maxComparisonDistance == 0 || Math.abs(((SNP)currentVarSeq).getLocation() - ((SNP)snps.get(j)).getLocation()) <= maxComparisonDistance) { if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(j)); } } } potentialTagByVarSeq.put(currentVarSeq,tempPT); } } Vector sitesToCapture = (Vector) snps.clone(); debugPrint("snps to tag: " + sitesToCapture.size()); Vector potentialTags = new Vector(potentialTagByVarSeq.values()); int countTagged = 0; //add Tags for the ones which are forced in. Vector includedPotentialTags = new Vector(); //construct a list of PotentialTag objects for forced in sequences for (int i = 0; i < forceInclude.size(); i++) { VariantSequence variantSequence = (VariantSequence) forceInclude.elementAt(i); if(variantSequence != null && potentialTagByVarSeq.containsKey(variantSequence)) { includedPotentialTags.add((PotentialTag) potentialTagByVarSeq.get(variantSequence)); } } //add each forced in sequence to the list of tags for(int i=0;i<includedPotentialTags.size();i++) { PotentialTag curPT = (PotentialTag) includedPotentialTags.get(i); HashSet newlyTagged = addTag(curPT,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(curPT.sequence); } //loop until all snps are tagged while(sitesToCapture.size() > 0) { potentialTags = new Vector(potentialTagByVarSeq.values()); if(potentialTags.size() == 0) { //we still have sites left to capture, but we have no more available tags. //this should only happen if the sites remaining in sitesToCapture were specifically //excluded from being tags. Since we can't add any more tags, break out of the loop. break; } //sorts the array of potential tags according to the number of untagged sites they can tag. //the last element is the one which tags the most untagged sites, so we choose that as our next tag. Collections.sort(potentialTags,ptcomp); PotentialTag currentBestTag = (PotentialTag) potentialTags.lastElement(); HashSet newlyTagged = addTag(currentBestTag,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(currentBestTag.sequence); } taggedSoFar = countTagged; if(sitesToCapture.size() > 0) { //any sites left in sitesToCapture could not be tagged, so we add them all to the untagged Vector untagged.addAll(sitesToCapture); } debugPrint("tagged " + countTagged + " SNPS using " + tags.size() +" tags" ); debugPrint("# of SNPs that could not be tagged: " + untagged.size()); if (aggression != PAIRWISE_ONLY){ //peelback starting with the worst tag (i.e. the one that tags the fewest other snps. Vector tags2BPeeled = (Vector)tags.clone(); Collections.reverse(tags2BPeeled); peelBack(tags2BPeeled); } //we've done the best we can. now we check to see if there's a limit to the //num of tags we're allowed to choose. if (maxNumTags > 0){ //if so we need to chuck out the extras. figure out the utility of each tagSNP //i.e. how many SNPs for which they and their combos are the only tags while (getTagSNPs().size() > maxNumTags){ Vector tagSNPs = getTagSNPs(); potentialTagByVarSeq = new Hashtable(); Hashtable tagSeqByPotentialTag = new Hashtable(); //account for stuff tagged by snps themselves for (int i = 0; i < tagSNPs.size(); i++){ TagSequence ts = (TagSequence) tagSNPs.get(i); PotentialTag pt = new PotentialTag(ts.getSequence()); pt.addTagged(ts.getTagged()); potentialTagByVarSeq.put(ts.getSequence(),pt); tagSeqByPotentialTag.put(pt,ts); } //go through all pt's and add their utilities as members of combos Vector tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); for (int j = 0; j < b.getSnps().size(); j++){ ((PotentialTag)potentialTagByVarSeq.get(b.getSNP(j))).addTagged(ts.getTagged()); } } //now perform the steps of sorting and peeling Vector potTagVec = new Vector(potentialTagByVarSeq.values()); Collections.sort(potTagVec,ptcomp); PotentialTag dumpedPT = (PotentialTag)potTagVec.firstElement(); TagSequence dumpedTS = (TagSequence) tagSeqByPotentialTag.get(dumpedPT); Vector taggedByCurTag = dumpedTS.getTagged(); for (int j = 0; j < taggedByCurTag.size(); j++){ //note for everything tagged by this guy that they're no longer tagged by him VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); if (b.getSnps().contains(dumpedTS.getSequence())){ //this hap tag is now defunct because it was comprised in part by dumpedTS Vector taggedByHap = ts.getTagged(); for (int j = 0; j < taggedByHap.size(); j++){ VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tags.remove(ts); } } tags.remove(dumpedTS); } } int count = 0; double numOver8 = 0; meanRSq = 0; Iterator itr = snps.iterator(); while (itr.hasNext()){ SNP s = (SNP) itr.next(); TagSequence ts = s.getBestTag(); if (ts != null){ double d = getPairwiseComp(s, ts.getSequence()).getRsq(); meanRSq += d; count++; if (d >= 0.8){ numOver8++; } } } meanRSq /= count; percentOver8 = (int) Math.rint((100*numOver8) / count); return new Vector(tags); }
| 1,109,988
|
public Vector findTags() { tags = new Vector(); untagged = new Vector(); taggedSoFar = 0; //potentialTagsHash stores the PotentialTag objects keyed on the corresponding sequences Hashtable potentialTagByVarSeq = new Hashtable(); PotentialTagComparator ptcomp = new PotentialTagComparator(); VariantSequence currentVarSeq; //create SequenceComparison objects for each potential Tag, and //add any comparisons which have an r-squared greater than the minimum. for(int i=0;i<snps.size();i++) { currentVarSeq = (VariantSequence)snps.get(i); if(!(forceExclude.contains(currentVarSeq) ) ){ PotentialTag tempPT = new PotentialTag(currentVarSeq); for(int j=0;j<snps.size();j++) { if( maxComparisonDistance == 0 || Math.abs(((SNP)currentVarSeq).getLocation() - ((SNP)snps.get(j)).getLocation()) <= maxComparisonDistance) { if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(j)); } } } potentialTagByVarSeq.put(currentVarSeq,tempPT); } } Vector sitesToCapture = (Vector) snps.clone(); debugPrint("snps to tag: " + sitesToCapture.size()); Vector potentialTags = new Vector(potentialTagByVarSeq.values()); int countTagged = 0; //add Tags for the ones which are forced in. Vector includedPotentialTags = new Vector(); //construct a list of PotentialTag objects for forced in sequences for (int i = 0; i < forceInclude.size(); i++) { VariantSequence variantSequence = (VariantSequence) forceInclude.elementAt(i); if(variantSequence != null && potentialTagByVarSeq.containsKey(variantSequence)) { includedPotentialTags.add((PotentialTag) potentialTagByVarSeq.get(variantSequence)); } } //add each forced in sequence to the list of tags for(int i=0;i<includedPotentialTags.size();i++) { PotentialTag curPT = (PotentialTag) includedPotentialTags.get(i); HashSet newlyTagged = addTag(curPT,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(curPT.sequence); } //loop until all snps are tagged while(sitesToCapture.size() > 0) { potentialTags = new Vector(potentialTagByVarSeq.values()); if(potentialTags.size() == 0) { //we still have sites left to capture, but we have no more available tags. //this should only happen if the sites remaining in sitesToCapture were specifically //excluded from being tags. Since we can't add any more tags, break out of the loop. break; } //sorts the array of potential tags according to the number of untagged sites they can tag. //the last element is the one which tags the most untagged sites, so we choose that as our next tag. Collections.sort(potentialTags,ptcomp); PotentialTag currentBestTag = (PotentialTag) potentialTags.lastElement(); HashSet newlyTagged = addTag(currentBestTag,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(currentBestTag.sequence); } taggedSoFar = countTagged; if(sitesToCapture.size() > 0) { //any sites left in sitesToCapture could not be tagged, so we add them all to the untagged Vector untagged.addAll(sitesToCapture); } debugPrint("tagged " + countTagged + " SNPS using " + tags.size() +" tags" ); debugPrint("# of SNPs that could not be tagged: " + untagged.size()); if (aggression != PAIRWISE_ONLY){ //peelback starting with the worst tag (i.e. the one that tags the fewest other snps. Vector tags2BPeeled = (Vector)tags.clone(); Collections.reverse(tags2BPeeled); peelBack(tags2BPeeled); } //we've done the best we can. now we check to see if there's a limit to the //num of tags we're allowed to choose. if (maxNumTags > 0){ //if so we need to chuck out the extras. figure out the utility of each tagSNP //i.e. how many SNPs for which they and their combos are the only tags while (getTagSNPs().size() > maxNumTags){ Vector tagSNPs = getTagSNPs(); potentialTagByVarSeq = new Hashtable(); Hashtable tagSeqByPotentialTag = new Hashtable(); //account for stuff tagged by snps themselves for (int i = 0; i < tagSNPs.size(); i++){ TagSequence ts = (TagSequence) tagSNPs.get(i); PotentialTag pt = new PotentialTag(ts.getSequence()); pt.addTagged(ts.getTagged()); potentialTagByVarSeq.put(ts.getSequence(),pt); tagSeqByPotentialTag.put(pt,ts); } //go through all pt's and add their utilities as members of combos Vector tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); for (int j = 0; j < b.getSnps().size(); j++){ ((PotentialTag)potentialTagByVarSeq.get(b.getSNP(j))).addTagged(ts.getTagged()); } } //now perform the steps of sorting and peeling Vector potTagVec = new Vector(potentialTagByVarSeq.values()); Collections.sort(potTagVec,ptcomp); PotentialTag dumpedPT = (PotentialTag)potTagVec.firstElement(); TagSequence dumpedTS = (TagSequence) tagSeqByPotentialTag.get(dumpedPT); Vector taggedByCurTag = dumpedTS.getTagged(); for (int j = 0; j < taggedByCurTag.size(); j++){ //note for everything tagged by this guy that they're no longer tagged by him VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); if (b.getSnps().contains(dumpedTS.getSequence())){ //this hap tag is now defunct because it was comprised in part by dumpedTS Vector taggedByHap = ts.getTagged(); for (int j = 0; j < taggedByHap.size(); j++){ VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tags.remove(ts); } } tags.remove(dumpedTS); } } int count = 0; double numOver8 = 0; meanRSq = 0; Iterator itr = snps.iterator(); while (itr.hasNext()){ SNP s = (SNP) itr.next(); TagSequence ts = s.getBestTag(); if (ts != null){ double d = getPairwiseComp(s, ts.getSequence()).getRsq(); meanRSq += d; count++; if (d >= 0.8){ numOver8++; } } } meanRSq /= count; percentOver8 = (int) Math.rint((100*numOver8) / count); return new Vector(tags); }
|
public Vector findTags() { tags = new Vector(); untagged = new Vector(); taggedSoFar = 0; //potentialTagsHash stores the PotentialTag objects keyed on the corresponding sequences Hashtable potentialTagByVarSeq = new Hashtable(); PotentialTagComparator ptcomp = new PotentialTagComparator(); VariantSequence currentVarSeq; //create SequenceComparison objects for each potential Tag, and //add any comparisons which have an r-squared greater than the minimum. for(int i=0;i<snps.size();i++) { currentVarSeq = (VariantSequence)snps.get(i); if(!(forceExclude.contains(currentVarSeq) ) ){ PotentialTag tempPT = new PotentialTag(currentVarSeq); for(int j=0;j<snps.size();j++) { if( maxComparisonDistance == 0 || Math.abs(((SNP)currentVarSeq).getLocation() - ((SNP)snps.get(j)).getLocation()) <= maxComparisonDistance) { if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(j)); } } } potentialTagByVarSeq.put(currentVarSeq,tempPT); } } Vector sitesToCapture = (Vector) snps.clone(); debugPrint("snps to tag: " + sitesToCapture.size()); Vector potentialTags = new Vector(potentialTagByVarSeq.values()); int countTagged = 0; //add Tags for the ones which are forced in. Vector includedPotentialTags = new Vector(); //construct a list of PotentialTag objects for forced in sequences for (int i = 0; i < forceInclude.size(); i++) { VariantSequence variantSequence = (VariantSequence) forceInclude.elementAt(i); if(variantSequence != null && potentialTagByVarSeq.containsKey(variantSequence)) { includedPotentialTags.add((PotentialTag) potentialTagByVarSeq.get(variantSequence)); } } //add each forced in sequence to the list of tags for(int i=0;i<includedPotentialTags.size();i++) { PotentialTag curPT = (PotentialTag) includedPotentialTags.get(i); HashSet newlyTagged = addTag(curPT,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(curPT.sequence); } //loop until all snps are tagged while(sitesToCapture.size() > 0) { potentialTags = new Vector(potentialTagByVarSeq.values()); if(potentialTags.size() == 0) { //we still have sites left to capture, but we have no more available tags. //this should only happen if the sites remaining in sitesToCapture were specifically //excluded from being tags. Since we can't add any more tags, break out of the loop. break; } //sorts the array of potential tags according to the number of untagged sites they can tag. //the last element is the one which tags the most untagged sites, so we choose that as our next tag. Collections.sort(potentialTags,ptcomp); PotentialTag currentBestTag = (PotentialTag) potentialTags.lastElement(); HashSet newlyTagged = addTag(currentBestTag,potentialTagByVarSeq,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(currentBestTag.sequence); } taggedSoFar = countTagged; if(sitesToCapture.size() > 0) { //any sites left in sitesToCapture could not be tagged, so we add them all to the untagged Vector untagged.addAll(sitesToCapture); } debugPrint("tagged " + countTagged + " SNPS using " + tags.size() +" tags" ); debugPrint("# of SNPs that could not be tagged: " + untagged.size()); if (aggression != PAIRWISE_ONLY){ //peelback starting with the worst tag (i.e. the one that tags the fewest other snps. Vector tags2BPeeled = (Vector)tags.clone(); Collections.reverse(tags2BPeeled); peelBack(tags2BPeeled); } //we've done the best we can. now we check to see if there's a limit to the //num of tags we're allowed to choose. if (maxNumTags > 0){ //if so we need to chuck out the extras. figure out the utility of each tagSNP //i.e. how many SNPs for which they and their combos are the only tags while (getTagSNPs().size() > maxNumTags){ Vector tagSNPs = getTagSNPs(); potentialTagByVarSeq = new Hashtable(); Hashtable tagSeqByPotentialTag = new Hashtable(); //account for stuff tagged by snps themselves for (int i = 0; i < tagSNPs.size(); i++){ TagSequence ts = (TagSequence) tagSNPs.get(i); PotentialTag pt = new PotentialTag(ts.getSequence()); pt.addTagged(ts.getTagged()); potentialTagByVarSeq.put(ts.getSequence(),pt); tagSeqByPotentialTag.put(pt,ts); } //go through all pt's and add their utilities as members of combos Vector tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); for (int j = 0; j < b.getSnps().size(); j++){ ((PotentialTag)potentialTagByVarSeq.get(b.getSNP(j))).addTagged(ts.getTagged()); } } //now perform the steps of sorting and peeling Vector potTagVec = new Vector(potentialTagByVarSeq.values()); Collections.sort(potTagVec,ptcomp); PotentialTag dumpedPT = (PotentialTag)potTagVec.firstElement(); TagSequence dumpedTS = (TagSequence) tagSeqByPotentialTag.get(dumpedPT); Vector taggedByCurTag = dumpedTS.getTagged(); for (int j = 0; j < taggedByCurTag.size(); j++){ //note for everything tagged by this guy that they're no longer tagged by him VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tagHaps = getTagHaplotypes(); for (int i = 0; i < tagHaps.size(); i++){ TagSequence ts = (TagSequence) tagHaps.get(i); Block b = (Block) ts.getSequence(); if (b.getSnps().contains(dumpedTS.getSequence())){ //this hap tag is now defunct because it was comprised in part by dumpedTS Vector taggedByHap = ts.getTagged(); for (int j = 0; j < taggedByHap.size(); j++){ VariantSequence vs = (VariantSequence)taggedByCurTag.get(j); vs.removeTag(dumpedTS); if (vs.getTags().size() == 0){ taggedSoFar--; } } tags.remove(ts); } } tags.remove(dumpedTS); } } int count = 0; double numOver8 = 0; meanRSq = 0; Iterator itr = snps.iterator(); while (itr.hasNext()){ SNP s = (SNP) itr.next(); TagSequence ts = s.getBestTag(); if (ts != null){ double d = getPairwiseComp(s, ts.getSequence()).getRsq(); meanRSq += d; count++; if (d >= 0.8){ numOver8++; } } } meanRSq /= count; percentOver8 = (int) Math.rint((100*numOver8) / count); return new Vector(tags); }
| 1,109,989
|
protected void calculateChiSquares() { chiSquares = new Vector(); pValues = new Vector(); if (Options.getAssocTest() == ASSOC_TRIO) { Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { if(Options.getTdtType() == TDT_STD) { Haplotype curHap = (Haplotype) faitr.next(); double chiSq = Math.pow(curHap.getTransCount() - curHap.getUntransCount(),2) / (curHap.getTransCount() + curHap.getUntransCount()); chiSquares.add(new Double(chiSq)); }else if (Options.getTdtType() == TDT_PAREN) { Haplotype curHap = (Haplotype) faitr.next(); double[] counts = curHap.getDiscordantAlleleCounts(); //statistic is [T+d+h+2g - (U+b+f+2c)]^2 / [T+U+d+h+b+f+4(c+g)] distributed as a chi-square double numr, denom; if(counts == null) { numr = Math.pow(curHap.getTransCount() -curHap.getUntransCount() ,2) ; denom = curHap.getTransCount() + curHap.getUntransCount(); }else{ numr = Math.pow(curHap.getTransCount() + counts[3] + counts[7] + 2*counts[6] - (curHap.getUntransCount() + counts[1] + counts[5] + 2*counts[2]),2); denom = (curHap.getTransCount() + curHap.getUntransCount() + counts[3] + counts[7] + counts[1] + counts[5] + 4*(counts[2] + counts[6])); } double chiSq = numr / denom; chiSquares.add(new Double(chiSq)); } } } else if(Options.getAssocTest() == ASSOC_CC) { double caseSum =0; double controlSum = 0; Iterator aitr = alleles.iterator(); while(aitr.hasNext()) { Haplotype curHap = (Haplotype) aitr.next(); caseSum += curHap.getCaseCount(); controlSum += curHap.getControlCount(); } double chiSq; double tempCaseSum, tempControlSum; double totalSum = caseSum + controlSum; Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { chiSq = 0; Haplotype curHap = (Haplotype) faitr.next(); tempCaseSum = caseSum - curHap.getCaseCount(); tempControlSum = controlSum - curHap.getControlCount(); double nij = (caseSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getCaseCount() - nij,2) / nij; nij = (caseSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempCaseSum - nij,2) / nij; nij = (controlSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getControlCount() - nij,2) / nij; nij = (controlSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempControlSum - nij,2) / nij; chiSquares.add(new Double(chiSq)); } } for(int i=0;i<chiSquares.size();i++) { pValues.add(new Double(MathUtil.gammq(.5,.5*(((Double)chiSquares.get(i)).doubleValue())))); } }
|
protected void calculateChiSquares() { chiSquares = new Vector(); pValues = new Vector(); if (Options.getAssocTest() == ASSOC_TRIO) { Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { if(Options.getTdtType() == TDT_STD) { Haplotype curHap = (Haplotype) faitr.next(); double chiSq = Math.pow(curHap.getTransCount() - curHap.getUntransCount(),2) / (curHap.getTransCount() + curHap.getUntransCount()); chiSquares.add(new Double(chiSq)); }else if (Options.getTdtType() == TDT_PAREN) { Haplotype curHap = (Haplotype) faitr.next(); double[] counts = curHap.getDiscordantAlleleCounts(); //statistic is [T+d+h+2g - (U+b+f+2c)]^2 / [T+U+d+h+b+f+4(c+g)] distributed as a chi-square double numr, denom; if(counts == null) { numr = Math.pow(curHap.getTransCount() -curHap.getUntransCount() ,2) ; denom = curHap.getTransCount() + curHap.getUntransCount(); }else{ numr = Math.pow(curHap.getTransCount() + counts[3] + counts[7] + 2*counts[6] - (curHap.getUntransCount() + counts[1] + counts[5] + 2*counts[2]),2); denom = (curHap.getTransCount() + curHap.getUntransCount() + counts[3] + counts[7] + counts[1] + counts[5] + 4*(counts[2] + counts[6])); } double chiSq = numr / denom; chiSquares.add(new Double(chiSq)); } } } else if(Options.getAssocTest() == ASSOC_CC) { double caseSum =0; double controlSum = 0; Iterator aitr = alleles.iterator(); while(aitr.hasNext()) { Haplotype curHap = (Haplotype) aitr.next(); caseSum += curHap.getCaseCount(); controlSum += curHap.getControlCount(); } double chiSq; double tempCaseSum, tempControlSum; double totalSum = caseSum + controlSum; Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { chiSq = 0; Haplotype curHap = (Haplotype) faitr.next(); tempCaseSum = caseSum - curHap.getCaseCount(); tempControlSum = controlSum - curHap.getControlCount(); double nij = (caseSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getCaseCount() - nij,2) / nij; nij = (caseSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempCaseSum - nij,2) / nij; nij = (controlSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getControlCount() - nij,2) / nij; nij = (controlSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempControlSum - nij,2) / nij; chiSquares.add(new Double(chiSq)); } } for(int i=0;i<chiSquares.size();i++) { pValues.add(new Double(MathUtil.gammq(.5,.5*(((Double)chiSquares.get(i)).doubleValue())))); } }
| 1,109,990
|
protected void calculateChiSquares() { chiSquares = new Vector(); pValues = new Vector(); if (Options.getAssocTest() == ASSOC_TRIO) { Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { if(Options.getTdtType() == TDT_STD) { Haplotype curHap = (Haplotype) faitr.next(); double chiSq = Math.pow(curHap.getTransCount() - curHap.getUntransCount(),2) / (curHap.getTransCount() + curHap.getUntransCount()); chiSquares.add(new Double(chiSq)); }else if (Options.getTdtType() == TDT_PAREN) { Haplotype curHap = (Haplotype) faitr.next(); double[] counts = curHap.getDiscordantAlleleCounts(); //statistic is [T+d+h+2g - (U+b+f+2c)]^2 / [T+U+d+h+b+f+4(c+g)] distributed as a chi-square double numr, denom; if(counts == null) { numr = Math.pow(curHap.getTransCount() -curHap.getUntransCount() ,2) ; denom = curHap.getTransCount() + curHap.getUntransCount(); }else{ numr = Math.pow(curHap.getTransCount() + counts[3] + counts[7] + 2*counts[6] - (curHap.getUntransCount() + counts[1] + counts[5] + 2*counts[2]),2); denom = (curHap.getTransCount() + curHap.getUntransCount() + counts[3] + counts[7] + counts[1] + counts[5] + 4*(counts[2] + counts[6])); } double chiSq = numr / denom; chiSquares.add(new Double(chiSq)); } } } else if(Options.getAssocTest() == ASSOC_CC) { double caseSum =0; double controlSum = 0; Iterator aitr = alleles.iterator(); while(aitr.hasNext()) { Haplotype curHap = (Haplotype) aitr.next(); caseSum += curHap.getCaseCount(); controlSum += curHap.getControlCount(); } double chiSq; double tempCaseSum, tempControlSum; double totalSum = caseSum + controlSum; Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { chiSq = 0; Haplotype curHap = (Haplotype) faitr.next(); tempCaseSum = caseSum - curHap.getCaseCount(); tempControlSum = controlSum - curHap.getControlCount(); double nij = (caseSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getCaseCount() - nij,2) / nij; nij = (caseSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempCaseSum - nij,2) / nij; nij = (controlSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getControlCount() - nij,2) / nij; nij = (controlSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempControlSum - nij,2) / nij; chiSquares.add(new Double(chiSq)); } } for(int i=0;i<chiSquares.size();i++) { pValues.add(new Double(MathUtil.gammq(.5,.5*(((Double)chiSquares.get(i)).doubleValue())))); } }
|
protected void calculateChiSquares() { chiSquares = new Vector(); pValues = new Vector(); if (Options.getAssocTest() == ASSOC_TRIO) { Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { if(Options.getTdtType() == TDT_STD) { Haplotype curHap = (Haplotype) faitr.next(); double chiSq = Math.pow(curHap.getTransCount() - curHap.getUntransCount(),2) / (curHap.getTransCount() + curHap.getUntransCount()); chiSquares.add(new Double(chiSq)); }else if (Options.getTdtType() == TDT_PAREN) { Haplotype curHap = (Haplotype) faitr.next(); double[] counts = curHap.getDiscordantAlleleCounts(); //statistic is [T+d+h+2g - (U+b+f+2c)]^2 / [T+U+d+h+b+f+4(c+g)] distributed as a chi-square double numr, denom; if(counts == null) { numr = Math.pow(curHap.getTransCount() -curHap.getUntransCount() ,2) ; denom = curHap.getTransCount() + curHap.getUntransCount(); }else{ numr = Math.pow(curHap.getTransCount() + counts[3] + counts[7] + 2*counts[6] - (curHap.getUntransCount() + counts[1] + counts[5] + 2*counts[2]),2); denom = (curHap.getTransCount() + curHap.getUntransCount() + counts[3] + counts[7] + counts[1] + counts[5] + 4*(counts[2] + counts[6])); } double chiSq = numr / denom; chiSquares.add(new Double(chiSq)); } } } else if(Options.getAssocTest() == ASSOC_CC) { double caseSum =0; double controlSum = 0; Iterator aitr = alleles.iterator(); while(aitr.hasNext()) { Haplotype curHap = (Haplotype) aitr.next(); caseSum += curHap.getCaseCount(); controlSum += curHap.getControlCount(); } double chiSq; double tempCaseSum, tempControlSum; double totalSum = caseSum + controlSum; Iterator faitr = filteredAlleles.iterator(); while(faitr.hasNext()) { chiSq = 0; Haplotype curHap = (Haplotype) faitr.next(); tempCaseSum = caseSum - curHap.getCaseCount(); tempControlSum = controlSum - curHap.getControlCount(); double nij = (caseSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getCaseCount() - nij,2) / nij; nij = (caseSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempCaseSum - nij,2) / nij; nij = (controlSum * (curHap.getCaseCount() + curHap.getControlCount())) / totalSum; chiSq += Math.pow(curHap.getControlCount() - nij,2) / nij; nij = (controlSum * (tempCaseSum + tempControlSum)) / totalSum; chiSq += Math.pow(tempControlSum - nij,2) / nij; chiSquares.add(new Double(chiSq)); } } for(int i=0;i<chiSquares.size();i++) { pValues.add(new Double(MathUtil.gammq(.5,.5*(((Double)chiSquares.get(i)).doubleValue())))); } }
| 1,109,991
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (k+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
| 1,109,992
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (k+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
| 1,109,993
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
| 1,109,994
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (numLines+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numMarkers = 0; boolean genoError = false; int numLines = pedigrees.size(); if (numLines == 0){ throw new PedFileException("Data format error: empty file"); } Individual ind; this.allIndividuals = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); int numTokens = tokenizer.countTokens(); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = numTokens; if(colNum%2==1) { withOptionalColumn = true; numMarkers= (numTokens - 7)/2; }else { numMarkers = (numTokens -6)/2; } } if(colNum != numTokens) { //this line has a different number of columns //should send some sort of error message throw new PedFileException("Column number mismatch in pedfile. line " + (numLines+1)); } ind = new Individual(numMarkers); if(numTokens < 6) { throw new PedFileException("Incorrect number of fields on line " + (numLines+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(new String(tokenizer.nextToken().trim())); ind.setIndividualID(new String(tokenizer.nextToken().trim())); ind.setDadID(new String(tokenizer.nextToken().trim())); ind.setMomID(new String(tokenizer.nextToken().trim())); try { ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (numLines+1)); } byte genotype1; byte genotype2; while(tokenizer.hasMoreTokens()){ try { String alleleA = tokenizer.nextToken(); String alleleB = tokenizer.nextToken(); int[] checker1, checker2; checker1 = checkGenotype(alleleA); checker2 = checkGenotype(alleleB); if (checker1[1] != checker2[1]){ genoError = !genoError; } if (genoError){ throw new PedFileException("File input error on line " + (k+1) + ", marker " + (ind.getNumMarkers()+1) + ".\nFor any marker, an individual's genotype must be only letters or only numbers."); } if(checker1[0] < 0 || checker1[0] > 4 || checker2[0] < 0 || checker2[0] > 4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4 or A/C/G/T."); } genotype1 = (byte)checker1[0]; genotype2 = (byte)checker2[0]; ind.addMarker(genotype1,genotype2); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<allIndividuals.size();i++) { Individual currentInd = (Individual) allIndividuals.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
| 1,109,995
|
public Expression createExpression(String text) throws JellyException {/* org.apache.commons.jexl.Expression expr = org.apache.commons.jexl.ExpressionFactory.createExpression(text); if ( isSupportAntVariables() ) { expr.addPostResolver(new FlatResolver()); } return new JexlExpression( expr );*/ Expression jexlExpression = null; try { // this method really does throw Exception jexlExpression = new JexlExpression( org.apache.commons.jexl.ExpressionFactory.createExpression(text) ); } catch (Exception e) { throw new JellyException(e); } if ( isSupportAntVariables() && isValidAntVariableName(text) ) { return new ExpressionSupportLocal(jexlExpression,text); } return jexlExpression; }
|
public Expression createExpression(String text) throws JellyException {/* org.apache.commons.jexl.Expression expr = org.apache.commons.jexl.ExpressionFactory.createExpression(text); if ( isSupportAntVariables() ) { expr.addPostResolver(new FlatResolver()); } return new JexlExpression( expr );*/ Expression jexlExpression = null; try { // this method really does throw Exception jexlExpression = new JexlExpression( org.apache.commons.jexl.ExpressionFactory.createExpression(text) ); } catch (Exception e) { throw new JellyException("Unable to create expression: " + text, e); } if ( isSupportAntVariables() && isValidAntVariableName(text) ) { return new ExpressionSupportLocal(jexlExpression,text); } return jexlExpression; }
| 1,109,996
|
public void run() { int ch; try { while ( (ch = is.read()) >= 0) { output.append(String.valueOf((char) ch)); } } catch (IOException ex) { ex.printStackTrace(); } }
|
public void run() { int ch; try { while ( (ch = is.read()) >= 0) { msg.append(String.valueOf((char) ch)); if ( ch == '\n' ) { output.append(msg.toString()); output.setCaretPosition(output.getText().length()); msg.delete(0,msg.length()); } } if ( msg.length() > 0 ) { output.append(msg.toString()); output.setCaretPosition(output.getText().length()); } } catch (IOException ex) { ex.printStackTrace(); } }
| 1,109,998
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 80); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 80); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
| 1,109,999
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 80); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 80); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
| 1,110,000
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 80); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
|
public EngineExecPanel(String header, Process pr) { super(new BorderLayout()); proc = pr; abortButton = new JButton("Abort"); abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { proc.destroy(); } }); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER)); p.add(abortButton); add(p, BorderLayout.SOUTH); output = new JTextArea(25, 120); output.append(header); add(new JScrollPane(output), BorderLayout.CENTER); InputStream pis = new BufferedInputStream(proc.getInputStream()); InputStream pes = new BufferedInputStream(proc.getErrorStream()); iss = new Thread(new StreamSink(pis)); ess = new Thread(new StreamSink(pes)); iss.start(); ess.start(); }
| 1,110,001
|
public void actionPerformed(ActionEvent e) { proc.destroy(); }
|
public void actionPerformed(ActionEvent e) { proc.destroy(); if ( output != null && output.isEnabled() ) { output.append("Aborted ..."); output.setEnabled(false); }
| 1,110,003
|
public void waitForProcessCompletion() { try { iss.join(); ess.join(); } catch (InterruptedException ex) { System.out.println("Interrupted while waiting for engine"); } abortButton.setEnabled(false); output.append("Execution halted"); }
|
public void waitForProcessCompletion() { try { iss.join(); ess.join(); } catch (InterruptedException ex) { System.out.println("Interrupted while waiting for engine"); } output.append("Execution halted"); }
| 1,110,005
|
public CreateTableAction() { super("Create Table", ASUtils.createIcon("NewTable", "Create Table", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); }
|
public CreateTableAction() { super("New Table", ASUtils.createIcon("NewTable", "Create Table", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); }
| 1,110,006
|
public CreateTableAction() { super("Create Table", ASUtils.createIcon("NewTable", "Create Table", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); }
|
public CreateTableAction() { super("New Table", ASUtils.createIcon("NewTable", "New Table", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); }
| 1,110,007
|
public static void main(String[] args) { //set defaults Options.setMissingThreshold(0.5); Options.setSpacingThreshold(0.0); Options.setAssocTest(ASSOC_NONE); Options.setHaplotypeDisplayThreshold(1); Options.setMaxDistance(500); Options.setLDColorScheme(STD_SCHEME); Options.setShowGBrowse(false); //this parses the command line arguments. if nogui mode is specified, //then haploText will execute whatever the user specified HaploText argParser = new HaploText(args); //if nogui is specified, then HaploText has already executed everything, and let Main() return //otherwise, we want to actually load and run the gui if(!argParser.isNogui()) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); uc.checkForUpdate(); return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.BOLD, 12); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); } } } }; //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); worker.start(); //parse command line stuff for input files or prompt data dialog String[] inputArray = new String[2]; if (argParser.getHapsFileName() != null){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); window.readGenotypes(inputArray, HAPS); }else if (argParser.getPedFileName() != null){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); window.readGenotypes(inputArray, PED); }else if (argParser.getHapmapFileName() != null){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; window.readGenotypes(inputArray, HMP); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
|
public static void main(String[] args) { //set defaults Options.setMissingThreshold(0.5); Options.setSpacingThreshold(0.0); Options.setAssocTest(ASSOC_NONE); Options.setHaplotypeDisplayThreshold(1); Options.setMaxDistance(500); Options.setLDColorScheme(STD_SCHEME); Options.setShowGBrowse(false); //this parses the command line arguments. if nogui mode is specified, //then haploText will execute whatever the user specified HaploText argParser = new HaploText(args); //if nogui is specified, then HaploText has already executed everything, and let Main() return //otherwise, we want to actually load and run the gui if(!argParser.isNogui()) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } //System.setProperty("swing.disableFileChooserSpeedFix", "true"); window = new HaploView(); //setup view object window.setTitle(TITLE_STRING); window.setSize(800,600); final SwingWorker worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); uc.checkForUpdate(); return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); } } } }; //center the window on the screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screen.width - window.getWidth()) / 2, (screen.height - window.getHeight()) / 2); window.setVisible(true); worker.start(); //parse command line stuff for input files or prompt data dialog String[] inputArray = new String[2]; if (argParser.getHapsFileName() != null){ inputArray[0] = argParser.getHapsFileName(); inputArray[1] = argParser.getInfoFileName(); window.readGenotypes(inputArray, HAPS); }else if (argParser.getPedFileName() != null){ inputArray[0] = argParser.getPedFileName(); inputArray[1] = argParser.getInfoFileName(); window.readGenotypes(inputArray, PED); }else if (argParser.getHapmapFileName() != null){ inputArray[0] = argParser.getHapmapFileName(); inputArray[1] = ""; window.readGenotypes(inputArray, HMP); }else{ ReadDataDialog readDialog = new ReadDataDialog("Welcome to HaploView", window); readDialog.pack(); readDialog.setVisible(true); } } }
| 1,110,010
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.BOLD, 12); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); } } }
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); } } }
| 1,110,011
|
private void connectionClosed(){ try { this.unregisterInternal(); } catch (Exception e) { logger.severe("Error unregistering for monitoring. error=" + e.getMessage()); } /* close the connection */ try { connection.close(); } catch (IOException e) { logger.log(Level.WARNING, "Error while closing connection. error: " + e.getMessage()); } /* need to re-establish the connection when the server comes up */ new EstablishConnection().start(); }
|
private void connectionClosed(){ try { this.unregisterInternal(); } catch (Exception e) { logger.severe("Error unregistering for monitoring. error=" + e.getMessage()); } /* close the connection */ try { connection.close(); } catch (IOException e) { logger.log(Level.WARNING, "Error while closing connection. error: " + e.getMessage()); } /* need to re-establish the connection when the server comes up */ new EstablishConnection().start(); }
| 1,110,012
|
private void connectionOpen(){ try { /* start monitoring */ registerInternal(); logger.info("Registered for alert: " + alertName + ", application: " + sourceConfig.getApplicationConfig().getName()); } catch (Exception e) { logger.severe("Error registering for monitoring. error=" + e.getMessage()); /* need to re-establish the connection when the server comes up */ new EstablishConnection().start(); return; } /* start the connection monitoring thread */ new ConnectionMonitor().start(); }
|
private void connectionOpen(){ try { /* start monitoring */ registerInternal(); logger.info("Registered for alert: " + alertName + ", application: " + sourceConfig.getApplicationConfig().getName()); } catch (Exception e) { logger.severe("Error registering for monitoring. error=" + e.getMessage()); /* need to re-establish the connection when the server comes up */ new EstablishConnection().start(); return; } /* start the connection monitoring thread */ new ConnectionMonitor().start(); }
| 1,110,013
|
public void paintComponent(Graphics graphics) { if (filteredHaplos == null){ super.paintComponent(graphics); return; } Graphics2D g = (Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //System.out.println(getSize()); Dimension size = getSize(); Dimension pref = getPreferredSize(); g.setColor(this.getBackground()); g.fillRect(0,0,pref.width, pref.height); if (!forExport){ g.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } //g.drawRect(0, 0, pref.width, pref.height); final BasicStroke thinStroke = new BasicStroke(0.5f); final BasicStroke thickStroke = new BasicStroke(2.0f); // width of one letter of the haplotype block //int letterWidth = haploMetrics.charWidth('G'); //int percentWidth = pctMetrics.stringWidth(".000"); //final int verticalOffset = 43; // room for tags and diamonds int left = BORDER; int top = BORDER; //verticalOffset; //int totalWidth = 0; // percentages for each haplotype NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); nf.setMinimumIntegerDigits(0); nf.setMaximumIntegerDigits(0); // multi reading, between the columns NumberFormat nfMulti = NumberFormat.getInstance(Locale.US); nfMulti.setMinimumFractionDigits(2); nfMulti.setMaximumFractionDigits(2); nfMulti.setMinimumIntegerDigits(0); nfMulti.setMaximumIntegerDigits(0); int[][] lookupPos = new int[filteredHaplos.length][]; for (int p = 0; p < lookupPos.length; p++) { lookupPos[p] = new int[filteredHaplos[p].length]; for (int q = 0; q < lookupPos[p].length; q++){ lookupPos[p][filteredHaplos[p][q].getListOrder()] = q; } } // set number formatter to pad with appropriate number of zeroes NumberFormat nfMarker = NumberFormat.getInstance(Locale.US); int markerCount = Chromosome.getSize(); // the +0.0000001 is because there is // some suckage where log(1000) / log(10) isn't actually 3 int markerDigits = (int) (0.0000001 + Math.log(markerCount) / Math.log(10)) + 1; nfMarker.setMinimumIntegerDigits(markerDigits); nfMarker.setMaximumIntegerDigits(markerDigits); //int tagShapeX[] = new int[3]; //int tagShapeY[] = new int[3]; //Polygon tagShape; int textRight = 0; // gets updated for scooting over // i = 0 to number of columns - 1 for (int i = 0; i < filteredHaplos.length; i++) { int[] markerNums = filteredHaplos[i][0].getMarkers(); boolean[] tags = filteredHaplos[i][0].getTags(); //int headerX = x; //block labels g.setColor(Color.black); g.drawString("Block " + (i+1), left, top - CHAR_HEIGHT); for (int z = 0; z < markerNums.length; z++) { //int tagMiddle = tagMetrics.getAscent() / 2; //int tagLeft = x + z*letterWidth + tagMiddle; //g.translate(tagLeft, 20); // if tag snp, draw little triangle pooper if (tags[z]) { g.drawImage(tagImage, left + z*CHAR_WIDTH, top + markerDigits*MARKER_CHAR_WIDTH -(CHAR_HEIGHT - TAG_SPAN), null); } //g.rotate(-Math.PI / 2.0); //g.drawLine(0, 0, 0, 0); //g.setColor(Color.black); //g.drawString(nfMarker.format(markerNums[z]), 0, tagMiddle); char markerChars[] = nfMarker.format(Chromosome.realIndex[markerNums[z]]+1).toCharArray(); for (int m = 0; m < markerDigits; m++) { g.drawImage(markerNumImages[markerChars[m] - '0'], left + z*CHAR_WIDTH + (1 + CHAR_WIDTH - MARKER_CHAR_HEIGHT)/2, top + (markerDigits-m-1)*MARKER_CHAR_WIDTH, null); } // undo the transform.. no push/pop.. arrgh //g.rotate(Math.PI / 2.0); //g.translate(-tagLeft, -20); } // y position of the first image for the haplotype letter // top + the size of the marker digits + the size of the tag + // the character height centered in the row's height int above = top + markerDigits*MARKER_CHAR_WIDTH + TAG_SPAN + (ROW_HEIGHT - CHAR_HEIGHT) / 2; //figure out which allele is the major allele double[][] alleleCounts = new double[filteredHaplos[i][0].getGeno().length][9]; //zero this out for (int j = 0; j < alleleCounts.length; j++){ for (int k = 0; k < alleleCounts[j].length; k++){ alleleCounts[j][k] = 0; } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); double theFreq = filteredHaplos[i][curHapNum].getPercentage(); for (int k = 0; k < theGeno.length; k++){ alleleCounts[k][theGeno[k]] += theFreq; } } int[] majorAllele = new int[filteredHaplos[i][0].getGeno().length]; for (int k = 0; k < majorAllele.length; k++){ double maj = 0; for (int z = 0; z < alleleCounts[k].length; z++){ if (alleleCounts[k][z] > maj){ majorAllele[k] = z; maj = alleleCounts[k][z]; } } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; //String theHap = new String(); //String thePercentage = new String(); int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); //getGeno(); // j is the row of haplotype for (int k = 0; k < theGeno.length; k++) { // theGeno[k] will be 1,2,3,4 (acgt) or 8 (for bad) if (alleleDisp == 0){ g.drawImage(charImages[theGeno[k] - 1], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else if (alleleDisp == 1){ g.drawImage(blackNumImages[theGeno[k]], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else{ if (theGeno[k] == majorAllele[k]){ g.setColor(dullBlue); }else{ g.setColor(dullRed); } g.fillRect(left + k*CHAR_WIDTH, above + j*ROW_HEIGHT + (ROW_HEIGHT - CHAR_WIDTH)/2, CHAR_WIDTH, CHAR_WIDTH); } } //draw the percentage value in non mono font double percent = filteredHaplos[i][curHapNum].getPercentage(); //thePercentage = " " + nf.format(percent); char percentChars[] = nf.format(percent).toCharArray(); // perhaps need an exceptional case for 1.0 being the percent for (int m = 0; m < percentChars.length; m++) { g.drawImage(grayNumImages[(m == 0) ? 10 : percentChars[m]-'0'], left + theGeno.length*CHAR_WIDTH + m*CHAR_WIDTH, above + j*ROW_HEIGHT, null); } // 4 is the number of chars in .999 for the percent textRight = left + theGeno.length*CHAR_WIDTH + 4*CHAR_WIDTH; g.setColor(Color.black); if (i < filteredHaplos.length - 1) { //draw crossovers for (int crossCount = 0; crossCount < filteredHaplos[i+1].length; crossCount++) { double crossVal = filteredHaplos[i][curHapNum].getCrossover(crossCount); //draw thin and thick lines int crossValue = (int) (crossVal*100); if (crossValue > thinThresh) { g.setStroke(crossValue > thickThresh ? thickStroke : thinStroke); int connectTo = filteredHaplos[i+1][crossCount].getListOrder(); g.drawLine(textRight + LINE_LEFT, above + j*ROW_HEIGHT + ROW_HEIGHT/2, textRight + LINE_RIGHT, above + connectTo*ROW_HEIGHT + ROW_HEIGHT/2); } } } } left = textRight; // add the multilocus d prime if appropriate if (i < filteredHaplos.length - 1) { //put the numbers in the right place vertically int depth; if (filteredHaplos[i].length > filteredHaplos[i+1].length){ depth = filteredHaplos[i].length; }else{ depth = filteredHaplos[i+1].length; } char multiChars[] = nfMulti.format(multidprimeArray[i]).toCharArray(); if (multidprimeArray[i] > 0.99){ //draw 1.0 vals specially g.drawImage(blackNumImages[1], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[10], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 2*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[0], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 3*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); }else{ for (int m = 0; m < 3; m++) { g.drawImage(blackNumImages[(m == 0) ? 10 : multiChars[m]-'0'], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + m*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); } } } left += LINE_SPAN; } }
|
public void paintComponent(Graphics graphics) { if (filteredHaplos == null){ super.paintComponent(graphics); return; } Graphics2D g = (Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //System.out.println(getSize()); Dimension size = getSize(); Dimension pref = getPreferredSize(); g.setColor(this.getBackground()); g.fillRect(0,0,pref.width, pref.height); if (!forExport){ g.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } //g.drawRect(0, 0, pref.width, pref.height); final BasicStroke thinStroke = new BasicStroke(0.5f); final BasicStroke thickStroke = new BasicStroke(2.0f); // width of one letter of the haplotype block //int letterWidth = haploMetrics.charWidth('G'); //int percentWidth = pctMetrics.stringWidth(".000"); //final int verticalOffset = 43; // room for tags and diamonds int left = BORDER; int top = BORDER; //verticalOffset; //int totalWidth = 0; // percentages for each haplotype NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); nf.setMinimumIntegerDigits(0); nf.setMaximumIntegerDigits(0); // multi reading, between the columns NumberFormat nfMulti = NumberFormat.getInstance(Locale.US); nfMulti.setMinimumFractionDigits(2); nfMulti.setMaximumFractionDigits(2); nfMulti.setMinimumIntegerDigits(0); nfMulti.setMaximumIntegerDigits(0); int[][] lookupPos = new int[filteredHaplos.length][]; for (int p = 0; p < lookupPos.length; p++) { lookupPos[p] = new int[filteredHaplos[p].length]; for (int q = 0; q < lookupPos[p].length; q++){ lookupPos[p][filteredHaplos[p][q].getListOrder()] = q; } } // set number formatter to pad with appropriate number of zeroes NumberFormat nfMarker = NumberFormat.getInstance(Locale.US); int markerCount = Chromosome.getSize(); // the +0.0000001 is because there is // some suckage where log(1000) / log(10) isn't actually 3 int markerDigits = (int) (0.0000001 + Math.log(markerCount) / Math.log(10)) + 1; nfMarker.setMinimumIntegerDigits(markerDigits); nfMarker.setMaximumIntegerDigits(markerDigits); //int tagShapeX[] = new int[3]; //int tagShapeY[] = new int[3]; //Polygon tagShape; int textRight = 0; // gets updated for scooting over // i = 0 to number of columns - 1 for (int i = 0; i < filteredHaplos.length; i++) { int[] markerNums = filteredHaplos[i][0].getMarkers(); boolean[] tags = filteredHaplos[i][0].getTags(); //int headerX = x; //block labels g.setColor(Color.black); g.drawString("Block " + (i+1), left, top - CHAR_HEIGHT); for (int z = 0; z < markerNums.length; z++) { //int tagMiddle = tagMetrics.getAscent() / 2; //int tagLeft = x + z*letterWidth + tagMiddle; //g.translate(tagLeft, 20); // if tag snp, draw little triangle pooper if (tags[z]) { g.drawImage(tagImage, left + z*CHAR_WIDTH, top + markerDigits*MARKER_CHAR_WIDTH -(CHAR_HEIGHT - TAG_SPAN), null); } //g.rotate(-Math.PI / 2.0); //g.drawLine(0, 0, 0, 0); //g.setColor(Color.black); //g.drawString(nfMarker.format(markerNums[z]), 0, tagMiddle); char markerChars[] = nfMarker.format(Chromosome.realIndex[markerNums[z]]+1).toCharArray(); for (int m = 0; m < markerDigits; m++) { g.drawImage(markerNumImages[markerChars[m] - '0'], left + z*CHAR_WIDTH + (1 + CHAR_WIDTH - MARKER_CHAR_HEIGHT)/2, top + (markerDigits-m-1)*MARKER_CHAR_WIDTH, null); } // undo the transform.. no push/pop.. arrgh //g.rotate(Math.PI / 2.0); //g.translate(-tagLeft, -20); } // y position of the first image for the haplotype letter // top + the size of the marker digits + the size of the tag + // the character height centered in the row's height int above = top + markerDigits*MARKER_CHAR_WIDTH + TAG_SPAN + (ROW_HEIGHT - CHAR_HEIGHT) / 2; //figure out which allele is the major allele double[][] alleleCounts = new double[filteredHaplos[i][0].getGeno().length][9]; //zero this out for (int j = 0; j < alleleCounts.length; j++){ for (int k = 0; k < alleleCounts[j].length; k++){ alleleCounts[j][k] = 0; } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); double theFreq = filteredHaplos[i][curHapNum].getPercentage(); for (int k = 0; k < theGeno.length; k++){ alleleCounts[k][theGeno[k]] += theFreq; } } int[] majorAllele = new int[filteredHaplos[i][0].getGeno().length]; for (int k = 0; k < majorAllele.length; k++){ double maj = 0; for (int z = 0; z < alleleCounts[k].length; z++){ if (alleleCounts[k][z] > maj){ majorAllele[k] = z; maj = alleleCounts[k][z]; } } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; //String theHap = new String(); //String thePercentage = new String(); int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); //getGeno(); // j is the row of haplotype for (int k = 0; k < theGeno.length; k++) { // theGeno[k] will be 1,2,3,4 (acgt) or 8 (for bad) if (alleleDisp == 0){ g.drawImage(charImages[theGeno[k] - 1], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else if (alleleDisp == 1){ g.drawImage(blackNumImages[theGeno[k]], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else{ if (theGeno[k] == majorAllele[k]){ g.setColor(dullBlue); }else{ g.setColor(dullRed); } g.fillRect(left + k*CHAR_WIDTH, above + j*ROW_HEIGHT + (ROW_HEIGHT - CHAR_WIDTH)/2, CHAR_WIDTH, CHAR_WIDTH); } } //draw the percentage value in non mono font double percent = filteredHaplos[i][curHapNum].getPercentage(); //thePercentage = " " + nf.format(percent); char percentChars[] = nf.format(percent).toCharArray(); // perhaps need an exceptional case for 1.0 being the percent for (int m = 0; m < percentChars.length; m++) { g.drawImage(grayNumImages[(m == 0) ? 10 : percentChars[m]-'0'], left + theGeno.length*CHAR_WIDTH + m*CHAR_WIDTH, above + j*ROW_HEIGHT, null); } // 4 is the number of chars in .999 for the percent textRight = left + theGeno.length*CHAR_WIDTH + 4*CHAR_WIDTH; g.setColor(Color.black); if (i < filteredHaplos.length - 1) { //draw crossovers for (int crossCount = 0; crossCount < filteredHaplos[i+1].length; crossCount++) { double crossVal = filteredHaplos[i][curHapNum].getCrossover(crossCount); //draw thin and thick lines int crossValue = (int) (crossVal*100); if (crossValue > thinThresh) { g.setStroke(crossValue > thickThresh ? thickStroke : thinStroke); int connectTo = filteredHaplos[i+1][crossCount].getListOrder(); g.drawLine(textRight + LINE_LEFT, above + j*ROW_HEIGHT + ROW_HEIGHT/2, textRight + LINE_RIGHT, above + connectTo*ROW_HEIGHT + ROW_HEIGHT/2); } } } } left = textRight; // add the multilocus d prime if appropriate if (i < filteredHaplos.length - 1) { //put the numbers in the right place vertically int depth; if (filteredHaplos[i].length > filteredHaplos[i+1].length){ depth = filteredHaplos[i].length; }else{ depth = filteredHaplos[i+1].length; } char multiChars[] = nfMulti.format(multidprimeArray[i]).toCharArray(); if (multidprimeArray[i] > 0.99){ //draw 1.0 vals specially g.drawImage(blackNumImages[1], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[10], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 2*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[0], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 3*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); }else{ for (int m = 0; m < 3; m++) { g.drawImage(blackNumImages[(m == 0) ? 10 : multiChars[m]-'0'], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + m*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); } } } left += LINE_SPAN; } }
| 1,110,014
|
public void paintComponent(Graphics graphics) { if (filteredHaplos == null){ super.paintComponent(graphics); return; } Graphics2D g = (Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //System.out.println(getSize()); Dimension size = getSize(); Dimension pref = getPreferredSize(); g.setColor(this.getBackground()); g.fillRect(0,0,pref.width, pref.height); if (!forExport){ g.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } //g.drawRect(0, 0, pref.width, pref.height); final BasicStroke thinStroke = new BasicStroke(0.5f); final BasicStroke thickStroke = new BasicStroke(2.0f); // width of one letter of the haplotype block //int letterWidth = haploMetrics.charWidth('G'); //int percentWidth = pctMetrics.stringWidth(".000"); //final int verticalOffset = 43; // room for tags and diamonds int left = BORDER; int top = BORDER; //verticalOffset; //int totalWidth = 0; // percentages for each haplotype NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); nf.setMinimumIntegerDigits(0); nf.setMaximumIntegerDigits(0); // multi reading, between the columns NumberFormat nfMulti = NumberFormat.getInstance(Locale.US); nfMulti.setMinimumFractionDigits(2); nfMulti.setMaximumFractionDigits(2); nfMulti.setMinimumIntegerDigits(0); nfMulti.setMaximumIntegerDigits(0); int[][] lookupPos = new int[filteredHaplos.length][]; for (int p = 0; p < lookupPos.length; p++) { lookupPos[p] = new int[filteredHaplos[p].length]; for (int q = 0; q < lookupPos[p].length; q++){ lookupPos[p][filteredHaplos[p][q].getListOrder()] = q; } } // set number formatter to pad with appropriate number of zeroes NumberFormat nfMarker = NumberFormat.getInstance(Locale.US); int markerCount = Chromosome.getSize(); // the +0.0000001 is because there is // some suckage where log(1000) / log(10) isn't actually 3 int markerDigits = (int) (0.0000001 + Math.log(markerCount) / Math.log(10)) + 1; nfMarker.setMinimumIntegerDigits(markerDigits); nfMarker.setMaximumIntegerDigits(markerDigits); //int tagShapeX[] = new int[3]; //int tagShapeY[] = new int[3]; //Polygon tagShape; int textRight = 0; // gets updated for scooting over // i = 0 to number of columns - 1 for (int i = 0; i < filteredHaplos.length; i++) { int[] markerNums = filteredHaplos[i][0].getMarkers(); boolean[] tags = filteredHaplos[i][0].getTags(); //int headerX = x; //block labels g.setColor(Color.black); g.drawString("Block " + (i+1), left, top - CHAR_HEIGHT); for (int z = 0; z < markerNums.length; z++) { //int tagMiddle = tagMetrics.getAscent() / 2; //int tagLeft = x + z*letterWidth + tagMiddle; //g.translate(tagLeft, 20); // if tag snp, draw little triangle pooper if (tags[z]) { g.drawImage(tagImage, left + z*CHAR_WIDTH, top + markerDigits*MARKER_CHAR_WIDTH -(CHAR_HEIGHT - TAG_SPAN), null); } //g.rotate(-Math.PI / 2.0); //g.drawLine(0, 0, 0, 0); //g.setColor(Color.black); //g.drawString(nfMarker.format(markerNums[z]), 0, tagMiddle); char markerChars[] = nfMarker.format(Chromosome.realIndex[markerNums[z]]+1).toCharArray(); for (int m = 0; m < markerDigits; m++) { g.drawImage(markerNumImages[markerChars[m] - '0'], left + z*CHAR_WIDTH + (1 + CHAR_WIDTH - MARKER_CHAR_HEIGHT)/2, top + (markerDigits-m-1)*MARKER_CHAR_WIDTH, null); } // undo the transform.. no push/pop.. arrgh //g.rotate(Math.PI / 2.0); //g.translate(-tagLeft, -20); } // y position of the first image for the haplotype letter // top + the size of the marker digits + the size of the tag + // the character height centered in the row's height int above = top + markerDigits*MARKER_CHAR_WIDTH + TAG_SPAN + (ROW_HEIGHT - CHAR_HEIGHT) / 2; //figure out which allele is the major allele double[][] alleleCounts = new double[filteredHaplos[i][0].getGeno().length][9]; //zero this out for (int j = 0; j < alleleCounts.length; j++){ for (int k = 0; k < alleleCounts[j].length; k++){ alleleCounts[j][k] = 0; } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); double theFreq = filteredHaplos[i][curHapNum].getPercentage(); for (int k = 0; k < theGeno.length; k++){ alleleCounts[k][theGeno[k]] += theFreq; } } int[] majorAllele = new int[filteredHaplos[i][0].getGeno().length]; for (int k = 0; k < majorAllele.length; k++){ double maj = 0; for (int z = 0; z < alleleCounts[k].length; z++){ if (alleleCounts[k][z] > maj){ majorAllele[k] = z; maj = alleleCounts[k][z]; } } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; //String theHap = new String(); //String thePercentage = new String(); int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); //getGeno(); // j is the row of haplotype for (int k = 0; k < theGeno.length; k++) { // theGeno[k] will be 1,2,3,4 (acgt) or 8 (for bad) if (alleleDisp == 0){ g.drawImage(charImages[theGeno[k] - 1], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else if (alleleDisp == 1){ g.drawImage(blackNumImages[theGeno[k]], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else{ if (theGeno[k] == majorAllele[k]){ g.setColor(dullBlue); }else{ g.setColor(dullRed); } g.fillRect(left + k*CHAR_WIDTH, above + j*ROW_HEIGHT + (ROW_HEIGHT - CHAR_WIDTH)/2, CHAR_WIDTH, CHAR_WIDTH); } } //draw the percentage value in non mono font double percent = filteredHaplos[i][curHapNum].getPercentage(); //thePercentage = " " + nf.format(percent); char percentChars[] = nf.format(percent).toCharArray(); // perhaps need an exceptional case for 1.0 being the percent for (int m = 0; m < percentChars.length; m++) { g.drawImage(grayNumImages[(m == 0) ? 10 : percentChars[m]-'0'], left + theGeno.length*CHAR_WIDTH + m*CHAR_WIDTH, above + j*ROW_HEIGHT, null); } // 4 is the number of chars in .999 for the percent textRight = left + theGeno.length*CHAR_WIDTH + 4*CHAR_WIDTH; g.setColor(Color.black); if (i < filteredHaplos.length - 1) { //draw crossovers for (int crossCount = 0; crossCount < filteredHaplos[i+1].length; crossCount++) { double crossVal = filteredHaplos[i][curHapNum].getCrossover(crossCount); //draw thin and thick lines int crossValue = (int) (crossVal*100); if (crossValue > thinThresh) { g.setStroke(crossValue > thickThresh ? thickStroke : thinStroke); int connectTo = filteredHaplos[i+1][crossCount].getListOrder(); g.drawLine(textRight + LINE_LEFT, above + j*ROW_HEIGHT + ROW_HEIGHT/2, textRight + LINE_RIGHT, above + connectTo*ROW_HEIGHT + ROW_HEIGHT/2); } } } } left = textRight; // add the multilocus d prime if appropriate if (i < filteredHaplos.length - 1) { //put the numbers in the right place vertically int depth; if (filteredHaplos[i].length > filteredHaplos[i+1].length){ depth = filteredHaplos[i].length; }else{ depth = filteredHaplos[i+1].length; } char multiChars[] = nfMulti.format(multidprimeArray[i]).toCharArray(); if (multidprimeArray[i] > 0.99){ //draw 1.0 vals specially g.drawImage(blackNumImages[1], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[10], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 2*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[0], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 3*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); }else{ for (int m = 0; m < 3; m++) { g.drawImage(blackNumImages[(m == 0) ? 10 : multiChars[m]-'0'], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + m*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); } } } left += LINE_SPAN; } }
|
public void paintComponent(Graphics graphics) { if (filteredHaplos == null){ super.paintComponent(graphics); return; } Graphics2D g = (Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //System.out.println(getSize()); Dimension size = getSize(); Dimension pref = getPreferredSize(); g.setColor(this.getBackground()); g.fillRect(0,0,pref.width, pref.height); if (!forExport){ g.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } //g.drawRect(0, 0, pref.width, pref.height); final BasicStroke thinStroke = new BasicStroke(0.5f); final BasicStroke thickStroke = new BasicStroke(2.0f); // width of one letter of the haplotype block //int letterWidth = haploMetrics.charWidth('G'); //int percentWidth = pctMetrics.stringWidth(".000"); //final int verticalOffset = 43; // room for tags and diamonds int left = BORDER; int top = BORDER; //verticalOffset; //int totalWidth = 0; // percentages for each haplotype NumberFormat nf = NumberFormat.getInstance(Locale.US); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); nf.setMinimumIntegerDigits(0); nf.setMaximumIntegerDigits(0); // multi reading, between the columns NumberFormat nfMulti = NumberFormat.getInstance(Locale.US); nfMulti.setMinimumFractionDigits(2); nfMulti.setMaximumFractionDigits(2); nfMulti.setMinimumIntegerDigits(0); nfMulti.setMaximumIntegerDigits(0); int[][] lookupPos = new int[filteredHaplos.length][]; for (int p = 0; p < lookupPos.length; p++) { lookupPos[p] = new int[filteredHaplos[p].length]; for (int q = 0; q < lookupPos[p].length; q++){ lookupPos[p][filteredHaplos[p][q].getListOrder()] = q; } } // set number formatter to pad with appropriate number of zeroes NumberFormat nfMarker = NumberFormat.getInstance(Locale.US); int markerCount = Chromosome.getSize(); // the +0.0000001 is because there is // some suckage where log(1000) / log(10) isn't actually 3 int markerDigits = (int) (0.0000001 + Math.log(markerCount) / Math.log(10)) + 1; nfMarker.setMinimumIntegerDigits(markerDigits); nfMarker.setMaximumIntegerDigits(markerDigits); //int tagShapeX[] = new int[3]; //int tagShapeY[] = new int[3]; //Polygon tagShape; int textRight = 0; // gets updated for scooting over // i = 0 to number of columns - 1 for (int i = 0; i < filteredHaplos.length; i++) { int[] markerNums = filteredHaplos[i][0].getMarkers(); boolean[] tags = filteredHaplos[i][0].getTags(); //int headerX = x; //block labels g.setColor(Color.black); g.drawString("Block " + (i+1), left, top - CHAR_HEIGHT); for (int z = 0; z < markerNums.length; z++) { //int tagMiddle = tagMetrics.getAscent() / 2; //int tagLeft = x + z*letterWidth + tagMiddle; //g.translate(tagLeft, 20); // if tag snp, draw little triangle pooper if (tags[z]) { g.drawImage(tagImage, left + z*CHAR_WIDTH, top + markerDigits*MARKER_CHAR_WIDTH -(CHAR_HEIGHT - TAG_SPAN), null); } //g.rotate(-Math.PI / 2.0); //g.drawLine(0, 0, 0, 0); //g.setColor(Color.black); //g.drawString(nfMarker.format(markerNums[z]), 0, tagMiddle); char markerChars[] = nfMarker.format(Chromosome.realIndex[markerNums[z]]+1).toCharArray(); for (int m = 0; m < markerDigits; m++) { g.drawImage(markerNumImages[markerChars[m] - '0'], left + z*CHAR_WIDTH + (1 + CHAR_WIDTH - MARKER_CHAR_HEIGHT)/2, top + (markerDigits-m-1)*MARKER_CHAR_WIDTH, null); } // undo the transform.. no push/pop.. arrgh //g.rotate(Math.PI / 2.0); //g.translate(-tagLeft, -20); } // y position of the first image for the haplotype letter // top + the size of the marker digits + the size of the tag + // the character height centered in the row's height int above = top + markerDigits*MARKER_CHAR_WIDTH + TAG_SPAN + (ROW_HEIGHT - CHAR_HEIGHT) / 2; //figure out which allele is the major allele double[][] alleleCounts = new double[filteredHaplos[i][0].getGeno().length][9]; //zero this out for (int j = 0; j < alleleCounts.length; j++){ for (int k = 0; k < alleleCounts[j].length; k++){ alleleCounts[j][k] = 0; } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); double theFreq = filteredHaplos[i][curHapNum].getPercentage(); for (int k = 0; k < theGeno.length; k++){ alleleCounts[k][theGeno[k]] += theFreq; } } int[] majorAllele = new int[filteredHaplos[i][0].getGeno().length]; for (int k = 0; k < majorAllele.length; k++){ double maj = 0; for (int z = 0; z < alleleCounts[k].length; z++){ if (alleleCounts[k][z] > maj){ majorAllele[k] = z; maj = alleleCounts[k][z]; } } } for (int j = 0; j < filteredHaplos[i].length; j++){ int curHapNum = lookupPos[i][j]; //String theHap = new String(); //String thePercentage = new String(); int[] theGeno = filteredHaplos[i][curHapNum].getGeno(); //getGeno(); // j is the row of haplotype for (int k = 0; k < theGeno.length; k++) { // theGeno[k] will be 1,2,3,4 (acgt) or 8 (for bad) if (alleleDisp == 0){ g.drawImage(charImages[theGeno[k] - 1], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else if (alleleDisp == 1){ g.drawImage(blackNumImages[theGeno[k]], left + k*CHAR_WIDTH, above + j*ROW_HEIGHT, null); }else{ if (theGeno[k] == majorAllele[k]){ g.setColor(dullBlue); }else{ g.setColor(dullRed); } g.fillRect(left + k*CHAR_WIDTH, above + j*ROW_HEIGHT + (ROW_HEIGHT - CHAR_WIDTH)/2, CHAR_WIDTH, CHAR_WIDTH); } } //draw the percentage value in non mono font double percent = filteredHaplos[i][curHapNum].getPercentage(); //thePercentage = " " + nf.format(percent); char percentChars[] = nf.format(percent).toCharArray(); // perhaps need an exceptional case for 1.0 being the percent for (int m = 0; m < percentChars.length; m++) { g.drawImage(grayNumImages[(m == 0) ? 10 : percentChars[m]-'0'], left + theGeno.length*CHAR_WIDTH + m*CHAR_WIDTH, above + j*ROW_HEIGHT, null); } // 4 is the number of chars in .999 for the percent textRight = left + theGeno.length*CHAR_WIDTH + 4*CHAR_WIDTH; g.setColor(Color.black); if (i < filteredHaplos.length - 1) { //draw crossovers for (int crossCount = 0; crossCount < filteredHaplos[i+1].length; crossCount++) { double crossVal = filteredHaplos[i][curHapNum].getCrossover(crossCount); //draw thin and thick lines int crossValue = (int) (crossVal*100); if (crossValue > thinThresh) { g.setStroke(crossValue > thickThresh ? thickStroke : thinStroke); int connectTo = filteredHaplos[i+1][crossCount].getListOrder(); g.drawLine(textRight + LINE_LEFT, above + j*ROW_HEIGHT + ROW_HEIGHT/2, textRight + LINE_RIGHT, above + connectTo*ROW_HEIGHT + ROW_HEIGHT/2); } } } } left = textRight; // add the multilocus d prime if appropriate if (i < filteredHaplos.length - 1) { //put the numbers in the right place vertically int depth; if (filteredHaplos[i].length > filteredHaplos[i+1].length){ depth = filteredHaplos[i].length; }else{ depth = filteredHaplos[i+1].length; } char multiChars[] = nfMulti.format(multidprimeArray[i]).toCharArray(); if (multidprimeArray[i] > 0.99){ //draw 1.0 vals specially g.drawImage(blackNumImages[1], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[10], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 2*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); g.drawImage(blackNumImages[0], left + (LINE_SPAN - 9*CHAR_WIDTH/2)/2 + 3*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); }else{ for (int m = 0; m < 3; m++) { g.drawImage(blackNumImages[(m == 0) ? 10 : multiChars[m]-'0'], left + (LINE_SPAN - 7*CHAR_WIDTH/2)/2 + m*CHAR_WIDTH, above + (depth * ROW_HEIGHT), null); } } } left += LINE_SPAN; } }
| 1,110,015
|
public static ImageInstance create ( VolumeBase vol, File imgFile ) { ODMGXAWrapper txw = new ODMGXAWrapper(); ImageInstance i = new ImageInstance(); i.volume = vol; i.volumeId = vol.getName(); i.imageFile = imgFile; i.fileSize = imgFile.length(); i.mtime = imgFile.lastModified(); i.fname = vol.mapFileToVolumeRelativeName( imgFile ); txw.lock( i, Transaction.WRITE ); // Read the rest of fields from the image file try { i.readImageFile(); } catch (IOException e ) { txw.abort(); log.warn( "Error opening image file: " + e.getMessage() ); // The image does not exist, so it cannot be read!!! return null; } i.calcHash(); i.checkTime = new java.util.Date(); txw.commit(); return i; }
|
public static ImageInstance create ( VolumeBase vol, File imgFile ) { log.debug( "Creating instance " + imgFile.getAbsolutePath() ); ODMGXAWrapper txw = new ODMGXAWrapper(); ImageInstance i = new ImageInstance(); i.volume = vol; i.volumeId = vol.getName(); i.imageFile = imgFile; i.fileSize = imgFile.length(); i.mtime = imgFile.lastModified(); i.fname = vol.mapFileToVolumeRelativeName( imgFile ); txw.lock( i, Transaction.WRITE ); // Read the rest of fields from the image file try { i.readImageFile(); } catch (IOException e ) { txw.abort(); log.warn( "Error opening image file: " + e.getMessage() ); // The image does not exist, so it cannot be read!!! return null; } i.calcHash(); i.checkTime = new java.util.Date(); txw.commit(); return i; }
| 1,110,016
|
protected void readImageFile() throws IOException { // Find the JPEG image reader // TODO: THis shoud decode also other readers from fname Iterator readers = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader)readers.next(); ImageInputStream iis = null; try { iis = ImageIO.createImageInputStream( imageFile ); if ( iis != null ) { reader.setInput( iis, true ); width = reader.getWidth( 0 ); height = reader.getHeight( 0 ); reader.dispose(); } } catch (IOException ex) { log.debug( "Exception in readImageFile: " + ex.getMessage() ); throw ex; } finally { if ( iis != null ) { try { iis.close(); } catch (IOException ex) { log.warn( "Cannot close image stream: " + ex.getMessage() ); } } } }
|
protected void readImageFile() throws IOException { // Find the JPEG image reader // TODO: THis shoud decode also other readers from fname Iterator readers = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader)readers.next(); ImageInputStream iis = null; try { iis = ImageIO.createImageInputStream( imageFile ); if ( iis != null ) { reader.setInput( iis, true ); width = reader.getWidth( 0 ); height = reader.getHeight( 0 ); reader.dispose(); } } catch (IOException ex) { log.debug( "Exception in readImageFile: " + ex.getMessage() ); throw ex; } finally { if ( iis != null ) { try { iis.close(); } catch (IOException ex) { log.warn( "Cannot close image stream: " + ex.getMessage() ); } } } }
| 1,110,017
|
private void processFile(String fileName,boolean fileType,String infoFileName){ try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; switch(outputType){ case 1: OutputFile = new File(fileName + ".4GAMblocks"); break; case 2: OutputFile = new File(fileName + ".MJDblocks"); break; default: OutputFile = new File(fileName + ".SFSblocks"); break; } textData = new HaploData(); if(!fileType){ //read in haps file textData.prepareHapsInput(inputFile); } else { //read in ped file PedFile ped; Vector pedFileStrings; BufferedReader reader; String line; Vector result; boolean[] markerResultArray; ped = new PedFile(); pedFileStrings = new Vector(); reader = new BufferedReader(new FileReader(inputFile)); result = new Vector(); while((line = reader.readLine())!=null){ pedFileStrings.add(line); } ped.parse(pedFileStrings); if(!arg_skipCheck) { result = ped.check(); } if(this.arg_showCheck) { System.out.println("Data check results:\n" + "Name\t\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( currentResult.getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } markerResultArray = new boolean[ped.getNumMarkers()]; for (int i = 0; i < markerResultArray.length; i++){ if(this.arg_skipCheck) { markerResultArray[i] = true; } else if(((MarkerResult)result.get(i)).getRating() > 0) { markerResultArray[i] = true; } else { markerResultArray[i] = false; } } if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[i] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (i+1)); } } } } textData.linkageToChrom(markerResultArray,ped); } String name = fileName; String baseName = fileName.substring(0,name.length()-5); if(!infoFileName.equals("")) { File infoFile = new File(infoFileName); if(infoFile.exists()) { textData.prepareMarkerInput(infoFile,maxDistance); System.out.println("Using marker file " + infoFile.getName()); } else if(!this.arg_quiet) { System.out.println("info file " + infoFileName + " does not exist"); } } else { File maybeInfo = new File(baseName + ".info"); if (maybeInfo.exists()){ textData.prepareMarkerInput(maybeInfo,maxDistance); if(!arg_quiet){ System.out.println("Using marker file " + maybeInfo.getName()); } } } textData.generateDPrimeTable(maxDistance); Haplotype[][] haplos; textData.guessBlocks(outputType); haplos = textData.generateHaplotypes(textData.blocks, 1); new TextMethods().saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } catch(IOException e){} catch(HaploViewException e){ System.out.println(e.getMessage()); } }
|
private void processFile(String fileName,boolean fileType,String infoFileName){ try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; switch(outputType){ case 1: OutputFile = new File(fileName + ".4GAMblocks"); break; case 2: OutputFile = new File(fileName + ".MJDblocks"); break; default: OutputFile = new File(fileName + ".SFSblocks"); break; } textData = new HaploData(); if(!fileType){ //read in haps file textData.prepareHapsInput(inputFile); } else { //read in ped file PedFile ped; Vector pedFileStrings; BufferedReader reader; String line; Vector result; boolean[] markerResultArray; ped = new PedFile(); pedFileStrings = new Vector(); reader = new BufferedReader(new FileReader(inputFile)); result = new Vector(); while((line = reader.readLine())!=null){ pedFileStrings.add(line); } ped.parse(pedFileStrings); if(!arg_skipCheck) { result = ped.check(); } if(this.arg_showCheck) { System.out.println("Data check results:\n" + "Name\t\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( currentResult.getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } markerResultArray = new boolean[ped.getNumMarkers()]; for (int i = 0; i < markerResultArray.length; i++){ if(this.arg_skipCheck) { markerResultArray[i] = true; } else if(((MarkerResult)result.get(i)).getRating() > 0) { markerResultArray[i] = true; } else { markerResultArray[i] = false; } } if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[i] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (i+1)); } } } } textData.linkageToChrom(markerResultArray,ped); } String name = fileName; String baseName = fileName.substring(0,name.length()-5); if(!infoFileName.equals("")) { File infoFile = new File(infoFileName); if(infoFile.exists()) { textData.prepareMarkerInput(infoFile,maxDistance); System.out.println("Using marker file " + infoFile.getName()); } else if(!this.arg_quiet) { System.out.println("info file " + infoFileName + " does not exist"); } } else { File maybeInfo = new File(baseName + ".info"); if (maybeInfo.exists()){ textData.prepareMarkerInput(maybeInfo,maxDistance); if(!arg_quiet){ System.out.println("Using marker file " + maybeInfo.getName()); } } } textData.generateDPrimeTable(maxDistance); Haplotype[][] haplos; textData.guessBlocks(outputType); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } catch(IOException e){} catch(HaploViewException e){ System.out.println(e.getMessage()); } }
| 1,110,018
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
| 1,110,019
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
| 1,110,020
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
|
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); boolean tooManyMissingInASegment = false; int totalMissing = 0; int segmentShift = 0; for (int n = 0; n < block_size.length; n++){ int missing = 0; for (int j = 0; j < block_size[n]; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[segmentShift+j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[segmentShift+j]); if(theGeno == 0 || nextGeno == 0) missing++; } segmentShift += block_size[n]; if (missing >= missingLimit){ tooManyMissingInASegment = true; } totalMissing += missing; } //we want to use chromosomes without too many missing genotypes in a given //subsegment (first term) or without too many missing genotypes in the //whole block (second term) if (!tooManyMissingInASegment && totalMissing <= 1+theBlock.length/3){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
| 1,110,021
|
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); } 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_TDT_NUM){ JTable table = tdtPanel.getTable(); JTreeTable jtt = ((HaploAssocPanel)((JTabbedPane)tabs.getComponent(tabNum)). getComponent(1)).jtt; FileWriter assocWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer("Single Marker Association\n"); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); assocWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } sb.append("\n"); assocWriter.write(sb.toString()); } //now we write the haplotype association numCols = jtt.getColumnCount(); header = new StringBuffer("\nHaplotype Association\n\t"); for (int i = 0; i < numCols; i++){ header.append(jtt.getColumnName(i)).append("\t"); } header.append("\n"); assocWriter.write(header.toString()); HaplotypeAssociationModel ham = (HaplotypeAssociationModel) jtt.getTree().getModel(); HaplotypeAssociationNode root = (HaplotypeAssociationNode) ham.getRoot(); for(int i=0;i<ham.getChildCount(root);i++) { HaplotypeAssociationNode curBlock = (HaplotypeAssociationNode) ham.getChild(root,i); assocWriter.write(curBlock.getName() + "\n"); StringBuffer sb = new StringBuffer(); for(int j=0;j<ham.getChildCount(curBlock);j++){ HaplotypeAssociationNode curHap = (HaplotypeAssociationNode) ham.getChild(curBlock,i); sb.append("\t").append(curHap.getName()).append("\t"); sb.append(curHap.getFreq()).append("\t"); sb.append(curHap.getCounts()).append("\t"); sb.append(curHap.getChiSq()).append("\t"); sb.append(curHap.getPVal()).append("\n"); } assocWriter.write(sb.toString()); } assocWriter.close(); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.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); } 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_TDT_NUM){ JTable table = tdtPanel.getTable(); JTreeTable jtt = ((HaploAssocPanel)((JTabbedPane)tabs.getComponent(tabNum)). getComponent(1)).jtt; FileWriter assocWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer("Single Marker Association\n"); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); assocWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } sb.append("\n"); assocWriter.write(sb.toString()); } //now we write the haplotype association numCols = jtt.getColumnCount(); header = new StringBuffer("\nHaplotype Association\n\t"); for (int i = 0; i < numCols; i++){ header.append(jtt.getColumnName(i)).append("\t"); } header.append("\n"); assocWriter.write(header.toString()); HaplotypeAssociationModel ham = (HaplotypeAssociationModel) jtt.getTree().getModel(); HaplotypeAssociationNode root = (HaplotypeAssociationNode) ham.getRoot(); for(int i=0;i<ham.getChildCount(root);i++) { HaplotypeAssociationNode curBlock = (HaplotypeAssociationNode) ham.getChild(root,i); assocWriter.write(curBlock.getName() + "\n"); StringBuffer sb = new StringBuffer(); for(int j=0;j<ham.getChildCount(curBlock);j++){ HaplotypeAssociationNode curHap = (HaplotypeAssociationNode) ham.getChild(curBlock,j); sb.append("\t").append(curHap.getName()).append("\t"); sb.append(curHap.getFreq()).append("\t"); sb.append(curHap.getCounts()).append("\t"); sb.append(curHap.getChiSq()).append("\t"); sb.append(curHap.getPVal()).append("\n"); } assocWriter.write(sb.toString()); } assocWriter.close(); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }
| 1,110,022
|
public void stateChanged(ChangeEvent e) { 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_TDT_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } 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); } window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JTable table = checkPanel.getTable(); boolean[] markerResults = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResults[i] = ((Boolean)table.getValueAt(i,CheckDataPanel.STATUS_COL)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } theData.filteredDPrimeTable = theData.getFilteredTable(); //after editing the filtered marker list, needs to be prodded into //resizing correctly Dimension size = dPrimeDisplay.getSize(); Dimension pref = dPrimeDisplay.getPreferredSize(); Rectangle visRect = dPrimeDisplay.getVisibleRect(); if (size.width != pref.width && pref.width > visRect.width){ ((JViewport)dPrimeDisplay.getParent()).setViewSize(pref); } dPrimeDisplay.colorDPrime(currentScheme); 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(); } theBlocks.add(thisBlock); } theData.guessBlocks(BLOX_CUSTOM, theBlocks); } if (tdtPanel != null){ tdtPanel.refreshTable(); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); theData.blocksChanged = false; } }
|
public void stateChanged(ChangeEvent e) { 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_TDT_NUM || tabNum == VIEW_CHECK_NUM){ exportMenuItems[0].setEnabled(true); exportMenuItems[1].setEnabled(false); }else{ exportMenuItems[0].setEnabled(false); exportMenuItems[1].setEnabled(false); } 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); } window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JTable table = checkPanel.getTable(); boolean[] markerResults = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResults[i] = ((Boolean)table.getValueAt(i,CheckDataPanel.STATUS_COL)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } theData.filteredDPrimeTable = theData.getFilteredTable(); //after editing the filtered marker list, needs to be prodded into //resizing correctly Dimension size = dPrimeDisplay.getSize(); Dimension pref = dPrimeDisplay.getPreferredSize(); Rectangle visRect = dPrimeDisplay.getVisibleRect(); if (size.width != pref.width && pref.width > visRect.width){ ((JViewport)dPrimeDisplay.getParent()).setViewSize(pref); } dPrimeDisplay.colorDPrime(currentScheme); 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(); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } if (hapDisplay != null && theData.blocksChanged){ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } hapScroller.setViewportView(hapDisplay); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); theData.blocksChanged = false; } }
| 1,110,023
|
void prepareHapsInput(File infile) throws IOException, HaploViewException{ //this method is called to suck in data from a file (its only argument) //of genotypes and sets up the Chromosome objects. String currentLine; Vector chroms = new Vector(); byte[] genos = new byte[0]; String ped, indiv; if(infile.length() < 1){ throw new HaploViewException("Genotype file is empty or does not exist: " + infile.getName()); } //read the file: BufferedReader in = new BufferedReader(new FileReader(infile)); int lineCount = 0; int numTokens = 0; boolean even = true; while ((currentLine = in.readLine()) != null){ lineCount++; //each line is expected to be of the format: //ped indiv geno geno geno geno... if (currentLine.length() == 0){ //skip blank lines continue; } even = !even; StringTokenizer st = new StringTokenizer(currentLine); //first two tokens are expected to be ped, indiv if (st.hasMoreTokens()){ ped = st.nextToken(); indiv = st.nextToken(); }else{ throw new HaploViewException("Genotype file error:\nLine " + lineCount + " appears to have fewer than 2 columns."); } //all other tokens are loaded into a vector (they should all be genotypes) genos = new byte[st.countTokens()]; int q = 0; if (numTokens == 0){ numTokens = st.countTokens(); } if (numTokens != st.countTokens()){ throw new HaploViewException("Genotype file error:\nLine " + lineCount + " appears to have an incorrect number of entries"); } while (st.hasMoreTokens()){ String thisGenotype = (String)st.nextElement(); if (thisGenotype.equals("h")) { genos[q] = 9; }else{ try{ genos[q] = Byte.parseByte(thisGenotype); }catch (NumberFormatException nfe){ throw new HaploViewException("Genotype file input error:\ngenotype value \"" + thisGenotype + "\" on line " + lineCount + " not allowed."); } } if (genos[q] < 0 || genos[q] > 9){ throw new HaploViewException("Genotype file input error:\ngenotype value \"" + genos[q] + "\" on line " + lineCount + " not allowed."); } q++; } //a Chromosome is created and added to a vector of chromosomes. //this is what is evetually returned. chroms.add(new Chromosome(ped, indiv, genos, false, infile.getName())); } if (!even){ //we're missing a line here throw new HaploViewException("Genotype file appears to have an odd number of lines.\n"+ "Each individual is required to have two chromosomes"); } chromosomes = chroms; //initialize realIndex Chromosome.doFilter(genos.length); //wipe clean any existing marker info so we know we're starting clean with a new file Chromosome.markers = null; }
|
void prepareHapsInput(File infile) throws IOException, HaploViewException{ //this method is called to suck in data from a file (its only argument) //of genotypes and sets up the Chromosome objects. String currentLine; Vector chroms = new Vector(); byte[] genos = new byte[0]; String ped, indiv; if(infile.length() < 1){ throw new HaploViewException("Genotype file is empty or does not exist: " + infile.getName()); } //read the file: BufferedReader in = new BufferedReader(new FileReader(infile)); int lineCount = 0; int numTokens = 0; boolean even = true; while ((currentLine = in.readLine()) != null){ lineCount++; //each line is expected to be of the format: //ped indiv geno geno geno geno... if (currentLine.length() == 0){ //skip blank lines continue; } even = !even; StringTokenizer st = new StringTokenizer(currentLine); //first two tokens are expected to be ped, indiv if (st.hasMoreTokens()){ ped = st.nextToken(); indiv = st.nextToken(); }else{ throw new HaploViewException("Genotype file error:\nLine " + lineCount + " appears to have fewer than 2 columns."); } //all other tokens are loaded into a vector (they should all be genotypes) genos = new byte[st.countTokens()]; int q = 0; if (numTokens == 0){ numTokens = st.countTokens(); } if (numTokens != st.countTokens()){ throw new HaploViewException("Genotype file error:\nLine " + lineCount + " appears to have an incorrect number of entries"); } while (st.hasMoreTokens()){ String thisGenotype = (String)st.nextElement(); if (thisGenotype.equals("h")) { genos[q] = 9; }else{ try{ genos[q] = Byte.parseByte(thisGenotype); }catch (NumberFormatException nfe){ throw new HaploViewException("Genotype file input error:\ngenotype value \"" + thisGenotype + "\" on line " + lineCount + " not allowed."); } } if (genos[q] < 0 || genos[q] > 9){ throw new HaploViewException("Genotype file input error:\ngenotype value \"" + genos[q] + "\" on line " + lineCount + " not allowed."); } q++; } //a Chromosome is created and added to a vector of chromosomes. //this is what is evetually returned. chroms.add(new Chromosome(ped, indiv, genos, infile.getName())); } if (!even){ //we're missing a line here throw new HaploViewException("Genotype file appears to have an odd number of lines.\n"+ "Each individual is required to have two chromosomes"); } chromosomes = chroms; //initialize realIndex Chromosome.doFilter(genos.length); //wipe clean any existing marker info so we know we're starting clean with a new file Chromosome.markers = null; }
| 1,110,024
|
public Dimension getPreferredSize() { int count = dPrimeTable.length; int high = V_BORDER+2 + count*BOX_SIZE/2; if (markersLoaded){ high += TICK_BOTTOM + widestMarkerName + TEXT_NUMBER_GAP; } return new Dimension(H_BORDER+2 + BOX_SIZE*(count-1), high); }
|
public Dimension getPreferredSize() { int count = dPrimeTable.length; int high = 2*V_BORDER + count*BOX_SIZE/2; if (markersLoaded){ high += TICK_BOTTOM + widestMarkerName + TEXT_NUMBER_GAP; } return new Dimension(H_BORDER+2 + BOX_SIZE*(count-1), high); }
| 1,110,026
|
public Dimension getPreferredSize() { int count = dPrimeTable.length; int high = V_BORDER+2 + count*BOX_SIZE/2; if (markersLoaded){ high += TICK_BOTTOM + widestMarkerName + TEXT_NUMBER_GAP; } return new Dimension(H_BORDER+2 + BOX_SIZE*(count-1), high); }
|
public Dimension getPreferredSize() { int count = dPrimeTable.length; int high = V_BORDER+2 + count*BOX_SIZE/2; if (markersLoaded){ high += TICK_BOTTOM + widestMarkerName + TEXT_NUMBER_GAP; } return new Dimension(2*H_BORDER + BOX_SIZE*(count-1), high); }
| 1,110,027
|
public void paintComponent(Graphics gComponent){ Dimension size = getSize(); Dimension pref = getPreferredSize(); if (!(alreadyPainted)){ buffIm = new BufferedImage(pref.width, pref.height, BufferedImage.TYPE_3BYTE_BGR); Graphics g = buffIm.getGraphics(); FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; int left = H_BORDER; int top = V_BORDER; FontMetrics metrics; int ascent; Graphics2D g2 = (Graphics2D) g; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = dPrimeTable.length * BOX_SIZE; int lineLeft = wide / 4; int lineSpan = wide / 2; long minpos = ((SNP)markers.elementAt(0)).getPosition(); long maxpos = ((SNP)markers.elementAt(markers.size()-1)).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < markers.size(); i++) { double pos = (((SNP)markers.elementAt(i)).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*BOX_SIZE, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(((SNP)markers.elementAt(0)).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(((SNP)markers.elementAt(x)).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); TextLayout markerNameTL; for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(((SNP)markers.elementAt(x)).getName(),TEXT_NUMBER_GAP, x*BOX_SIZE + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(x + 1); g.drawString(mark, left + x*BOX_SIZE - metrics.stringWidth(mark)/2, top + ascent); } top += BOX_RADIUS/2; // give a little space between numbers and boxes // draw table column by column for (int x = 0; x < dPrimeTable.length-1; x++) { for (int y = x + 1; y < dPrimeTable.length; y++) { double d = dPrimeTable[x][y].getDPrime(); double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int rt2 = (int) (Math.sqrt(2) * (double)BOX_SIZE); //int rt2half = (int) (0.5 * Math.sqrt(2) * (double)BOX_SIZE); int rt2half = rt2 / 2; //System.out.println(rt2 + " " + rt2half); //int xx = left + x*BOX_SIZE + (int) (y*Math.sqrt(4)*BOX_SIZE*0.5); int xx = left + (x + y) * BOX_SIZE / 2; //int yy = top + (x - y) * BOX_SIZE; //int xx = left + x*BOX_SIZE; //int yy = top + y*BOX_SIZE - (int) (x*Math.sqrt(4)*BOX_SIZE*0.5); int yy = top + (y - x) * BOX_SIZE / 2; diamondX[0] = xx; diamondY[0] = yy - BOX_RADIUS; diamondX[1] = xx + BOX_RADIUS; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + BOX_RADIUS; diamondX[3] = xx - BOX_RADIUS; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g.drawPolygon(diamond); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } alreadyPainted=true; } Graphics2D gComponent2 = (Graphics2D)gComponent; gComponent2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); gComponent2.drawImage(buffIm,0,0,this); }
|
public void paintComponent(Graphics gComponent){ Dimension size = getSize(); Dimension pref = getPreferredSize(); if (!(alreadyPainted)){ buffIm = new BufferedImage(pref.width, pref.height, BufferedImage.TYPE_3BYTE_BGR); Graphics g = buffIm.getGraphics(); FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; int left = H_BORDER; int top = V_BORDER; FontMetrics metrics; int ascent; Graphics2D g2 = (Graphics2D) g; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = dPrimeTable.length * BOX_SIZE; int lineLeft = wide / 4; int lineSpan = wide / 2; long minpos = ((SNP)markers.elementAt(0)).getPosition(); long maxpos = ((SNP)markers.elementAt(markers.size()-1)).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < markers.size(); i++) { double pos = (((SNP)markers.elementAt(i)).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*BOX_SIZE, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(((SNP)markers.elementAt(0)).getName()); for (int x = 1; x < dPrimeTable.length; x++) { int thiswide = metrics.stringWidth(((SNP)markers.elementAt(x)).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); TextLayout markerNameTL; for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(((SNP)markers.elementAt(x)).getName(),TEXT_NUMBER_GAP, x*BOX_SIZE + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(x + 1); g.drawString(mark, left + x*BOX_SIZE - metrics.stringWidth(mark)/2, top + ascent); } top += BOX_RADIUS/2; // give a little space between numbers and boxes // draw table column by column for (int x = 0; x < dPrimeTable.length-1; x++) { for (int y = x + 1; y < dPrimeTable.length; y++) { double d = dPrimeTable[x][y].getDPrime(); double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int rt2 = (int) (Math.sqrt(2) * (double)BOX_SIZE); //int rt2half = (int) (0.5 * Math.sqrt(2) * (double)BOX_SIZE); int rt2half = rt2 / 2; //System.out.println(rt2 + " " + rt2half); //int xx = left + x*BOX_SIZE + (int) (y*Math.sqrt(4)*BOX_SIZE*0.5); int xx = left + (x + y) * BOX_SIZE / 2; //int yy = top + (x - y) * BOX_SIZE; //int xx = left + x*BOX_SIZE; //int yy = top + y*BOX_SIZE - (int) (x*Math.sqrt(4)*BOX_SIZE*0.5); int yy = top + (y - x) * BOX_SIZE / 2; diamondX[0] = xx; diamondY[0] = yy - BOX_RADIUS; diamondX[1] = xx + BOX_RADIUS; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + BOX_RADIUS; diamondX[3] = xx - BOX_RADIUS; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g.drawPolygon(diamond); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } alreadyPainted=true; } Graphics2D gComponent2 = (Graphics2D)gComponent; gComponent2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); gComponent2.drawImage(buffIm,0,0,this); }
| 1,110,028
|
public void populate() throws ArchitectException { return; }
|
public void populate() throws ArchitectException { logger.debug("SQLRelationship: populate is a no-op"); }
| 1,110,029
|
public void doTag(XMLOutput output) throws Exception { if (test == null && xpath == null) { throw new MissingAttributeException( "test" ); } if (test != null) { if (! test.evaluateAsBoolean(context)) { fail( getBodyText(), "evaluating test: "+ test ); } } else { Object xpathContext = getXPathContext(); if (! xpath.booleanValueOf(xpathContext)) { fail( getBodyText(), "evaluating xpath: "+ xpath ); } } }
|
public void doTag(XMLOutput output) throws Exception { if (test == null && xpath == null) { throw new MissingAttributeException( "test" ); } if (test != null) { if (! test.evaluateAsBoolean(context)) { fail( getBodyText(), "evaluating test: "+ test.getExpressionText() ); } } else { Object xpathContext = getXPathContext(); if (! xpath.booleanValueOf(xpathContext)) { fail( getBodyText(), "evaluating xpath: "+ xpath ); } } }
| 1,110,031
|
public void testNoCrossingLinesEasy() throws ArchitectException { PlayPen pp = layoutAction.getPlayPen(); SQLDatabase ppdb = pp.getDatabase(); SQLTable tables[] = new SQLTable[4]; TablePane tablePanes[] = new TablePane[tables.length]; for (int i = 0; i < tables.length; i++) { tables[i] = new SQLTable(ppdb, "Table "+i, "", "TABLE", true); tablePanes[i] = new TablePane(tables[i], pp); } pp.addTablePane(tablePanes[0], new Point(100, 0)); pp.addTablePane(tablePanes[1], new Point(300, 100)); pp.addTablePane(tablePanes[2], new Point(150, 200)); pp.addTablePane(tablePanes[3], new Point(0, 100)); SQLRelationship sr1 = new SQLRelationship(); sr1.attachRelationship(tables[0],tables[2],false); SQLRelationship sr2 = new SQLRelationship(); sr2.attachRelationship(tables[1],tables[3],false); pp.setVisible(true); Relationship r1 = new Relationship(pp, sr1); Relationship r2 = new Relationship(pp, sr2); pp.addRelationship(r1); pp.addRelationship(r2); // the relationships init their paths only when painted r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships start out crossed assertTrue(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start Rectangle b = new Rectangle(); for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } layoutAction.actionPerformed(new ActionEvent(this, 0, null)); // make the paths update r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships are uncrossed assertFalse(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } }
|
public void testNoCrossingLinesEasy() throws ArchitectException { PlayPen pp = layoutAction.getPlayPen(); SQLDatabase ppdb = pp.getDatabase(); SQLTable tables[] = new SQLTable[4]; TablePane tablePanes[] = new TablePane[tables.length]; for (int i = 0; i < tables.length; i++) { tables[i] = new SQLTable(ppdb, "Table "+i, "", "TABLE", true); tablePanes[i] = new TablePane(tables[i], pp); } pp.addTablePane(tablePanes[0], new Point(100, 0)); pp.addTablePane(tablePanes[1], new Point(300, 100)); pp.addTablePane(tablePanes[2], new Point(150, 200)); pp.addTablePane(tablePanes[3], new Point(0, 100)); SQLRelationship sr1 = new SQLRelationship(); sr1.attachRelationship(tables[0],tables[2],false); SQLRelationship sr2 = new SQLRelationship(); sr2.attachRelationship(tables[1],tables[3],false); pp.setVisible(true); Relationship r1 = new Relationship(pp, sr1); Relationship r2 = new Relationship(pp, sr2); pp.addRelationship(r1); pp.addRelationship(r2); // the relationships init their paths only when painted r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships start out crossed assertTrue(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start Rectangle b = new Rectangle(); for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } layoutAction.actionPerformed(new ActionEvent(this, 0, null)); // make the paths update r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships are uncrossed assertFalse(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } }
| 1,110,032
|
public void testNoCrossingLinesEasy() throws ArchitectException { PlayPen pp = layoutAction.getPlayPen(); SQLDatabase ppdb = pp.getDatabase(); SQLTable tables[] = new SQLTable[4]; TablePane tablePanes[] = new TablePane[tables.length]; for (int i = 0; i < tables.length; i++) { tables[i] = new SQLTable(ppdb, "Table "+i, "", "TABLE", true); tablePanes[i] = new TablePane(tables[i], pp); } pp.addTablePane(tablePanes[0], new Point(100, 0)); pp.addTablePane(tablePanes[1], new Point(300, 100)); pp.addTablePane(tablePanes[2], new Point(150, 200)); pp.addTablePane(tablePanes[3], new Point(0, 100)); SQLRelationship sr1 = new SQLRelationship(); sr1.attachRelationship(tables[0],tables[2],false); SQLRelationship sr2 = new SQLRelationship(); sr2.attachRelationship(tables[1],tables[3],false); pp.setVisible(true); Relationship r1 = new Relationship(pp, sr1); Relationship r2 = new Relationship(pp, sr2); pp.addRelationship(r1); pp.addRelationship(r2); // the relationships init their paths only when painted r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships start out crossed assertTrue(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start Rectangle b = new Rectangle(); for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } layoutAction.actionPerformed(new ActionEvent(this, 0, null)); // make the paths update r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships are uncrossed assertFalse(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } }
|
public void testNoCrossingLinesEasy() throws ArchitectException { PlayPen pp = layoutAction.getPlayPen(); SQLDatabase ppdb = pp.getDatabase(); SQLTable tables[] = new SQLTable[4]; TablePane tablePanes[] = new TablePane[tables.length]; for (int i = 0; i < tables.length; i++) { tables[i] = new SQLTable(ppdb, "Table "+i, "", "TABLE", true); tablePanes[i] = new TablePane(tables[i], pp); } pp.addTablePane(tablePanes[0], new Point(100, 0)); pp.addTablePane(tablePanes[1], new Point(300, 100)); pp.addTablePane(tablePanes[2], new Point(150, 200)); pp.addTablePane(tablePanes[3], new Point(0, 100)); SQLRelationship sr1 = new SQLRelationship(); sr1.attachRelationship(tables[0],tables[2],false); SQLRelationship sr2 = new SQLRelationship(); sr2.attachRelationship(tables[1],tables[3],false); pp.setVisible(true); Relationship r1 = new Relationship(pp, sr1); Relationship r2 = new Relationship(pp, sr2); pp.addRelationship(r1); pp.addRelationship(r2); // the relationships init their paths only when painted r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships start out crossed assertTrue(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start Rectangle b = new Rectangle(); for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } layoutAction.actionPerformed(new ActionEvent(this, 0, null)); // make the paths update r1.paint((Graphics2D) pp.getGraphics()); r2.paint((Graphics2D) pp.getGraphics()); // check that the relationships are uncrossed assertFalse(((RelationshipUI) r1.getUI()).intersectsShape(((RelationshipUI) r2.getUI()).getShape())); // check that neither of the relationships intersects any of the 4 tables to start for (int i = 0; i < tablePanes.length; i++) { tablePanes[i].getBounds(b); if (tablePanes[i] != r1.getPkTable() && tablePanes[i] != r1.getFkTable()) { assertFalse("Table "+i+" crosses r1", ((RelationshipUI) r1.getUI()).intersects(b)); } if (tablePanes[i] != r2.getPkTable() && tablePanes[i] != r2.getFkTable()) { assertFalse("Table "+i+" crosses r2", ((RelationshipUI) r2.getUI()).intersects(b)); } } }
| 1,110,033
|
public void refreshTable(){ this.removeAll(); Vector tableData = new Vector(); int numRes = Chromosome.getSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(new Integer(Chromosome.realIndex[i]+1)); tempVect.add(currentResult.getName()); tempVect.add(currentResult.getOverTransmittedAllele(Options.getAssocTest())); tempVect.add(currentResult.getTURatio(Options.getAssocTest())); tempVect.add(new Double(currentResult.getChiSq(Options.getAssocTest()))); tempVect.add(currentResult.getPValue()); tableData.add(tempVect.clone()); } TDTTableModel tm = new TDTTableModel(tableColumnNames, tableData); table = new JTable(tm); table.getColumnModel().getColumn(0).setPreferredWidth(50); table.getColumnModel().getColumn(1).setPreferredWidth(100); if (Options.getAssocTest() != ASSOC_TRIO){ table.getColumnModel().getColumn(3).setPreferredWidth(160); } table.getColumnModel().getColumn(2).setPreferredWidth(100); JScrollPane tableScroller = new JScrollPane(table); add(tableScroller); }
|
public void refreshTable(){ this.removeAll(); Vector tableData = new Vector(); int numRes = Chromosome.getSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(new Integer(Chromosome.realIndex[i]+1)); tempVect.add(currentResult.getName()); tempVect.add(currentResult.getOverTransmittedAllele(Options.getAssocTest())); if(this.countsOrFreqs == SHOW_SINGLE_FREQS) { tempVect.add(currentResult.getFreqs(Options.getAssocTest())); } else if (this.countsOrFreqs == SHOW_SINGLE_COUNTS) { tempVect.add(currentResult.getTURatio(Options.getAssocTest())); } tempVect.add(new Double(currentResult.getChiSq(Options.getAssocTest()))); tempVect.add(currentResult.getPValue()); tableData.add(tempVect.clone()); } TDTTableModel tm = new TDTTableModel(tableColumnNames, tableData); table = new JTable(tm); table.getColumnModel().getColumn(0).setPreferredWidth(50); table.getColumnModel().getColumn(1).setPreferredWidth(100); if (Options.getAssocTest() != ASSOC_TRIO){ table.getColumnModel().getColumn(3).setPreferredWidth(160); } table.getColumnModel().getColumn(2).setPreferredWidth(100); JScrollPane tableScroller = new JScrollPane(table); add(tableScroller); }
| 1,110,035
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.countTokens() < 6) { throw new PedFileException("Incorrect number of fields on line " + (k+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMember(ind.getIndividualID()) != null){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<order.size();i++) { Individual currentInd = (Individual) order.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
|
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.countTokens() < 6) { throw new PedFileException("Incorrect number of fields on line " + (k+1)); } if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } if (fam.getMembers().containsKey(ind.getIndividualID())){ throw new PedFileException("Individual "+ind.getIndividualID()+" in family "+ ind.getFamilyID()+" appears more than once."); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } //now we check if anyone has a reference to a parent who isnt in the file, and if so, we remove the reference for(int i=0;i<order.size();i++) { Individual currentInd = (Individual) order.get(i); Hashtable curFam = ((Family)(families.get(currentInd.getFamilyID())) ).getMembers(); if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } }
| 1,110,037
|
public void parsePhasedData(String[] info) throws IOException, PedFileException{ if (info[4].equals("")){ Chromosome.setDataChrom("none"); }else{ Chromosome.setDataChrom("chr" + info[4]); } Chromosome.setDataBuild("ncbi_b35"); Vector sampleData = new Vector(); Vector legendData = new Vector(); Vector legendMarkers = new Vector(); Vector legendPositions = new Vector(); Individual ind = null; byte[] byteDataT = new byte[0]; byte[] byteDataU = new byte[0]; this.allIndividuals = new Vector(); File phasedFile = new File(info[0]); File sampleFile = new File(info[1]); File legendFile = new File(info[2]); if (phasedFile.length() < 1){ throw new PedFileException("Genotypes file is empty or non-existent: " + phasedFile.getName()); }else if (sampleFile.length() < 1){ throw new PedFileException("Sample file is empty or non-existent: " + sampleFile.getName()); }else if (legendFile.length() < 1){ throw new PedFileException("Legend file is empty or non-existent: " + legendFile.getName()); } //read in the individual ids data. try{ BufferedReader sampleBuffReader; if (Options.getGzip()){ FileInputStream sampleFis = new FileInputStream(sampleFile); GZIPInputStream sampleInputStream = new GZIPInputStream(sampleFis); sampleBuffReader = new BufferedReader(new InputStreamReader(sampleInputStream)); }else{ FileReader sampleReader = new FileReader(sampleFile); sampleBuffReader = new BufferedReader(sampleReader); } String sampleLine; while((sampleLine = sampleBuffReader.readLine())!=null){ StringTokenizer sampleTokenizer = new StringTokenizer(sampleLine); sampleData.add(sampleTokenizer.nextToken()); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + sampleFile.getName()); } //read in the legend data try{ BufferedReader legendBuffReader; if (Options.getGzip()){ FileInputStream legendFis = new FileInputStream(legendFile); GZIPInputStream legendInputStream = new GZIPInputStream(legendFis); legendBuffReader = new BufferedReader(new InputStreamReader(legendInputStream)); }else{ FileReader legendReader = new FileReader(legendFile); legendBuffReader = new BufferedReader(legendReader); } String legendLine; String zero, one; while((legendLine = legendBuffReader.readLine())!=null){ StringTokenizer legendSt = new StringTokenizer(legendLine); String markerid = legendSt.nextToken(); if (markerid.equalsIgnoreCase("rs") || markerid.equalsIgnoreCase("marker")){ //skip header continue; } legendMarkers.add(markerid); legendPositions.add(legendSt.nextToken()); byte[] legendBytes = new byte[2]; zero = legendSt.nextToken(); one = legendSt.nextToken(); if (zero.equalsIgnoreCase("A")){ legendBytes[0] = 1; }else if (zero.equalsIgnoreCase("C")){ legendBytes[0] = 2; }else if (zero.equalsIgnoreCase("G")){ legendBytes[0] = 3; }else if (zero.equalsIgnoreCase("T")){ legendBytes[0] = 4; }else{ throw new PedFileException("Invalid allele: " + zero); } if (one.equalsIgnoreCase("A")){ legendBytes[1] = 1; }else if (one.equalsIgnoreCase("C")){ legendBytes[1] = 2; }else if (one.equalsIgnoreCase("G")){ legendBytes[1] = 3; }else if (one.equalsIgnoreCase("T")){ legendBytes[1] = 4; }else{ throw new PedFileException("Invalid allele: " + one); } legendData.add(legendBytes); } hminfo = new String[legendPositions.size()][2]; for (int i = 0; i < legendPositions.size(); i++){ //marker name. hminfo[i][0] = (String)legendMarkers.get(i); //marker position. hminfo[i][1] = (String)legendPositions.get(i); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + legendFile.getName()); } //read in the phased data. try{ BufferedReader phasedBuffReader; if (Options.getGzip()){ FileInputStream phasedFis = new FileInputStream(phasedFile); GZIPInputStream phasedInputStream = new GZIPInputStream(phasedFis); phasedBuffReader = new BufferedReader(new InputStreamReader(phasedInputStream)); }else{ FileReader phasedReader = new FileReader(phasedFile); phasedBuffReader = new BufferedReader(phasedReader); } String phasedLine; int columns = 0; String token; boolean even = false; int iterator = 0; while((phasedLine = phasedBuffReader.readLine()) != null){ StringTokenizer phasedSt = new StringTokenizer(phasedLine); columns = phasedSt.countTokens(); if(even){ iterator++; }else{ //Only set up a new individual every 2 lines. ind = new Individual(columns, true); try{ ind.setIndividualID((String)sampleData.get(iterator)); }catch (ArrayIndexOutOfBoundsException e){ throw new PedFileException("File error: Sample file is missing individual IDs"); } if (columns != legendData.size()){ throw new PedFileException("File error: invalid number of markers on Individual " + ind.getIndividualID()); } String details = (String)hapMapTranslate.get(ind.getIndividualID()); //exception in case of wierd compression combos in input files if (details == null){ throw new PedFileException("File format error: " + sampleFile.getName()); } StringTokenizer dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); //skip individualID since we already have it. dt.nextToken(); ind.setDadID(dt.nextToken()); ind.setMomID(dt.nextToken()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + ind.getIndividualID()); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } int index = 0; if (!even){ byteDataT = new byte[columns]; }else{ byteDataU = new byte[columns]; } while(phasedSt.hasMoreTokens()){ token = phasedSt.nextToken(); if (!even){ if (token.equalsIgnoreCase("0")){ byteDataT[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataT[index] = ((byte[])legendData.get(index))[1]; }else { throw new PedFileException("File format error: " + phasedFile.getName()); } }else{ if (token.equalsIgnoreCase("0")){ byteDataU[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataU[index] = ((byte[])legendData.get(index))[1]; }else if (Chromosome.getDataChrom().equalsIgnoreCase("chrx") && ind.getGender() == Individual.MALE && token.equalsIgnoreCase("-")){ //X male }else { throw new PedFileException("File format error: " + phasedFile.getName()); } } index++; } if (even){ if (ind.getGender() == Individual.MALE && Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataT[i]); } }else{ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataU[i]); } } } even = !even; } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + phasedFile.getName()); } }
|
public void parsePhasedData(String[] info) throws IOException, PedFileException{ if (info[3].equals("")){ Chromosome.setDataChrom("none"); }else{ Chromosome.setDataChrom("chr" + info[4]); } Chromosome.setDataBuild("ncbi_b35"); Vector sampleData = new Vector(); Vector legendData = new Vector(); Vector legendMarkers = new Vector(); Vector legendPositions = new Vector(); Individual ind = null; byte[] byteDataT = new byte[0]; byte[] byteDataU = new byte[0]; this.allIndividuals = new Vector(); File phasedFile = new File(info[0]); File sampleFile = new File(info[1]); File legendFile = new File(info[2]); if (phasedFile.length() < 1){ throw new PedFileException("Genotypes file is empty or non-existent: " + phasedFile.getName()); }else if (sampleFile.length() < 1){ throw new PedFileException("Sample file is empty or non-existent: " + sampleFile.getName()); }else if (legendFile.length() < 1){ throw new PedFileException("Legend file is empty or non-existent: " + legendFile.getName()); } //read in the individual ids data. try{ BufferedReader sampleBuffReader; if (Options.getGzip()){ FileInputStream sampleFis = new FileInputStream(sampleFile); GZIPInputStream sampleInputStream = new GZIPInputStream(sampleFis); sampleBuffReader = new BufferedReader(new InputStreamReader(sampleInputStream)); }else{ FileReader sampleReader = new FileReader(sampleFile); sampleBuffReader = new BufferedReader(sampleReader); } String sampleLine; while((sampleLine = sampleBuffReader.readLine())!=null){ StringTokenizer sampleTokenizer = new StringTokenizer(sampleLine); sampleData.add(sampleTokenizer.nextToken()); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + sampleFile.getName()); } //read in the legend data try{ BufferedReader legendBuffReader; if (Options.getGzip()){ FileInputStream legendFis = new FileInputStream(legendFile); GZIPInputStream legendInputStream = new GZIPInputStream(legendFis); legendBuffReader = new BufferedReader(new InputStreamReader(legendInputStream)); }else{ FileReader legendReader = new FileReader(legendFile); legendBuffReader = new BufferedReader(legendReader); } String legendLine; String zero, one; while((legendLine = legendBuffReader.readLine())!=null){ StringTokenizer legendSt = new StringTokenizer(legendLine); String markerid = legendSt.nextToken(); if (markerid.equalsIgnoreCase("rs") || markerid.equalsIgnoreCase("marker")){ //skip header continue; } legendMarkers.add(markerid); legendPositions.add(legendSt.nextToken()); byte[] legendBytes = new byte[2]; zero = legendSt.nextToken(); one = legendSt.nextToken(); if (zero.equalsIgnoreCase("A")){ legendBytes[0] = 1; }else if (zero.equalsIgnoreCase("C")){ legendBytes[0] = 2; }else if (zero.equalsIgnoreCase("G")){ legendBytes[0] = 3; }else if (zero.equalsIgnoreCase("T")){ legendBytes[0] = 4; }else{ throw new PedFileException("Invalid allele: " + zero); } if (one.equalsIgnoreCase("A")){ legendBytes[1] = 1; }else if (one.equalsIgnoreCase("C")){ legendBytes[1] = 2; }else if (one.equalsIgnoreCase("G")){ legendBytes[1] = 3; }else if (one.equalsIgnoreCase("T")){ legendBytes[1] = 4; }else{ throw new PedFileException("Invalid allele: " + one); } legendData.add(legendBytes); } hminfo = new String[legendPositions.size()][2]; for (int i = 0; i < legendPositions.size(); i++){ //marker name. hminfo[i][0] = (String)legendMarkers.get(i); //marker position. hminfo[i][1] = (String)legendPositions.get(i); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + legendFile.getName()); } //read in the phased data. try{ BufferedReader phasedBuffReader; if (Options.getGzip()){ FileInputStream phasedFis = new FileInputStream(phasedFile); GZIPInputStream phasedInputStream = new GZIPInputStream(phasedFis); phasedBuffReader = new BufferedReader(new InputStreamReader(phasedInputStream)); }else{ FileReader phasedReader = new FileReader(phasedFile); phasedBuffReader = new BufferedReader(phasedReader); } String phasedLine; int columns = 0; String token; boolean even = false; int iterator = 0; while((phasedLine = phasedBuffReader.readLine()) != null){ StringTokenizer phasedSt = new StringTokenizer(phasedLine); columns = phasedSt.countTokens(); if(even){ iterator++; }else{ //Only set up a new individual every 2 lines. ind = new Individual(columns, true); try{ ind.setIndividualID((String)sampleData.get(iterator)); }catch (ArrayIndexOutOfBoundsException e){ throw new PedFileException("File error: Sample file is missing individual IDs"); } if (columns != legendData.size()){ throw new PedFileException("File error: invalid number of markers on Individual " + ind.getIndividualID()); } String details = (String)hapMapTranslate.get(ind.getIndividualID()); //exception in case of wierd compression combos in input files if (details == null){ throw new PedFileException("File format error: " + sampleFile.getName()); } StringTokenizer dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); //skip individualID since we already have it. dt.nextToken(); ind.setDadID(dt.nextToken()); ind.setMomID(dt.nextToken()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + ind.getIndividualID()); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } int index = 0; if (!even){ byteDataT = new byte[columns]; }else{ byteDataU = new byte[columns]; } while(phasedSt.hasMoreTokens()){ token = phasedSt.nextToken(); if (!even){ if (token.equalsIgnoreCase("0")){ byteDataT[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataT[index] = ((byte[])legendData.get(index))[1]; }else { throw new PedFileException("File format error: " + phasedFile.getName()); } }else{ if (token.equalsIgnoreCase("0")){ byteDataU[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataU[index] = ((byte[])legendData.get(index))[1]; }else if (Chromosome.getDataChrom().equalsIgnoreCase("chrx") && ind.getGender() == Individual.MALE && token.equalsIgnoreCase("-")){ //X male }else { throw new PedFileException("File format error: " + phasedFile.getName()); } } index++; } if (even){ if (ind.getGender() == Individual.MALE && Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataT[i]); } }else{ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataU[i]); } } } even = !even; } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + phasedFile.getName()); } }
| 1,110,039
|
public void parsePhasedData(String[] info) throws IOException, PedFileException{ if (info[4].equals("")){ Chromosome.setDataChrom("none"); }else{ Chromosome.setDataChrom("chr" + info[4]); } Chromosome.setDataBuild("ncbi_b35"); Vector sampleData = new Vector(); Vector legendData = new Vector(); Vector legendMarkers = new Vector(); Vector legendPositions = new Vector(); Individual ind = null; byte[] byteDataT = new byte[0]; byte[] byteDataU = new byte[0]; this.allIndividuals = new Vector(); File phasedFile = new File(info[0]); File sampleFile = new File(info[1]); File legendFile = new File(info[2]); if (phasedFile.length() < 1){ throw new PedFileException("Genotypes file is empty or non-existent: " + phasedFile.getName()); }else if (sampleFile.length() < 1){ throw new PedFileException("Sample file is empty or non-existent: " + sampleFile.getName()); }else if (legendFile.length() < 1){ throw new PedFileException("Legend file is empty or non-existent: " + legendFile.getName()); } //read in the individual ids data. try{ BufferedReader sampleBuffReader; if (Options.getGzip()){ FileInputStream sampleFis = new FileInputStream(sampleFile); GZIPInputStream sampleInputStream = new GZIPInputStream(sampleFis); sampleBuffReader = new BufferedReader(new InputStreamReader(sampleInputStream)); }else{ FileReader sampleReader = new FileReader(sampleFile); sampleBuffReader = new BufferedReader(sampleReader); } String sampleLine; while((sampleLine = sampleBuffReader.readLine())!=null){ StringTokenizer sampleTokenizer = new StringTokenizer(sampleLine); sampleData.add(sampleTokenizer.nextToken()); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + sampleFile.getName()); } //read in the legend data try{ BufferedReader legendBuffReader; if (Options.getGzip()){ FileInputStream legendFis = new FileInputStream(legendFile); GZIPInputStream legendInputStream = new GZIPInputStream(legendFis); legendBuffReader = new BufferedReader(new InputStreamReader(legendInputStream)); }else{ FileReader legendReader = new FileReader(legendFile); legendBuffReader = new BufferedReader(legendReader); } String legendLine; String zero, one; while((legendLine = legendBuffReader.readLine())!=null){ StringTokenizer legendSt = new StringTokenizer(legendLine); String markerid = legendSt.nextToken(); if (markerid.equalsIgnoreCase("rs") || markerid.equalsIgnoreCase("marker")){ //skip header continue; } legendMarkers.add(markerid); legendPositions.add(legendSt.nextToken()); byte[] legendBytes = new byte[2]; zero = legendSt.nextToken(); one = legendSt.nextToken(); if (zero.equalsIgnoreCase("A")){ legendBytes[0] = 1; }else if (zero.equalsIgnoreCase("C")){ legendBytes[0] = 2; }else if (zero.equalsIgnoreCase("G")){ legendBytes[0] = 3; }else if (zero.equalsIgnoreCase("T")){ legendBytes[0] = 4; }else{ throw new PedFileException("Invalid allele: " + zero); } if (one.equalsIgnoreCase("A")){ legendBytes[1] = 1; }else if (one.equalsIgnoreCase("C")){ legendBytes[1] = 2; }else if (one.equalsIgnoreCase("G")){ legendBytes[1] = 3; }else if (one.equalsIgnoreCase("T")){ legendBytes[1] = 4; }else{ throw new PedFileException("Invalid allele: " + one); } legendData.add(legendBytes); } hminfo = new String[legendPositions.size()][2]; for (int i = 0; i < legendPositions.size(); i++){ //marker name. hminfo[i][0] = (String)legendMarkers.get(i); //marker position. hminfo[i][1] = (String)legendPositions.get(i); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + legendFile.getName()); } //read in the phased data. try{ BufferedReader phasedBuffReader; if (Options.getGzip()){ FileInputStream phasedFis = new FileInputStream(phasedFile); GZIPInputStream phasedInputStream = new GZIPInputStream(phasedFis); phasedBuffReader = new BufferedReader(new InputStreamReader(phasedInputStream)); }else{ FileReader phasedReader = new FileReader(phasedFile); phasedBuffReader = new BufferedReader(phasedReader); } String phasedLine; int columns = 0; String token; boolean even = false; int iterator = 0; while((phasedLine = phasedBuffReader.readLine()) != null){ StringTokenizer phasedSt = new StringTokenizer(phasedLine); columns = phasedSt.countTokens(); if(even){ iterator++; }else{ //Only set up a new individual every 2 lines. ind = new Individual(columns, true); try{ ind.setIndividualID((String)sampleData.get(iterator)); }catch (ArrayIndexOutOfBoundsException e){ throw new PedFileException("File error: Sample file is missing individual IDs"); } if (columns != legendData.size()){ throw new PedFileException("File error: invalid number of markers on Individual " + ind.getIndividualID()); } String details = (String)hapMapTranslate.get(ind.getIndividualID()); //exception in case of wierd compression combos in input files if (details == null){ throw new PedFileException("File format error: " + sampleFile.getName()); } StringTokenizer dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); //skip individualID since we already have it. dt.nextToken(); ind.setDadID(dt.nextToken()); ind.setMomID(dt.nextToken()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + ind.getIndividualID()); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } int index = 0; if (!even){ byteDataT = new byte[columns]; }else{ byteDataU = new byte[columns]; } while(phasedSt.hasMoreTokens()){ token = phasedSt.nextToken(); if (!even){ if (token.equalsIgnoreCase("0")){ byteDataT[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataT[index] = ((byte[])legendData.get(index))[1]; }else { throw new PedFileException("File format error: " + phasedFile.getName()); } }else{ if (token.equalsIgnoreCase("0")){ byteDataU[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataU[index] = ((byte[])legendData.get(index))[1]; }else if (Chromosome.getDataChrom().equalsIgnoreCase("chrx") && ind.getGender() == Individual.MALE && token.equalsIgnoreCase("-")){ //X male }else { throw new PedFileException("File format error: " + phasedFile.getName()); } } index++; } if (even){ if (ind.getGender() == Individual.MALE && Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataT[i]); } }else{ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataU[i]); } } } even = !even; } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + phasedFile.getName()); } }
|
public void parsePhasedData(String[] info) throws IOException, PedFileException{ if (info[4].equals("")){ Chromosome.setDataChrom("none"); }else{ Chromosome.setDataChrom("chr" + info[3]); } Chromosome.setDataBuild("ncbi_b35"); Vector sampleData = new Vector(); Vector legendData = new Vector(); Vector legendMarkers = new Vector(); Vector legendPositions = new Vector(); Individual ind = null; byte[] byteDataT = new byte[0]; byte[] byteDataU = new byte[0]; this.allIndividuals = new Vector(); File phasedFile = new File(info[0]); File sampleFile = new File(info[1]); File legendFile = new File(info[2]); if (phasedFile.length() < 1){ throw new PedFileException("Genotypes file is empty or non-existent: " + phasedFile.getName()); }else if (sampleFile.length() < 1){ throw new PedFileException("Sample file is empty or non-existent: " + sampleFile.getName()); }else if (legendFile.length() < 1){ throw new PedFileException("Legend file is empty or non-existent: " + legendFile.getName()); } //read in the individual ids data. try{ BufferedReader sampleBuffReader; if (Options.getGzip()){ FileInputStream sampleFis = new FileInputStream(sampleFile); GZIPInputStream sampleInputStream = new GZIPInputStream(sampleFis); sampleBuffReader = new BufferedReader(new InputStreamReader(sampleInputStream)); }else{ FileReader sampleReader = new FileReader(sampleFile); sampleBuffReader = new BufferedReader(sampleReader); } String sampleLine; while((sampleLine = sampleBuffReader.readLine())!=null){ StringTokenizer sampleTokenizer = new StringTokenizer(sampleLine); sampleData.add(sampleTokenizer.nextToken()); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + sampleFile.getName()); } //read in the legend data try{ BufferedReader legendBuffReader; if (Options.getGzip()){ FileInputStream legendFis = new FileInputStream(legendFile); GZIPInputStream legendInputStream = new GZIPInputStream(legendFis); legendBuffReader = new BufferedReader(new InputStreamReader(legendInputStream)); }else{ FileReader legendReader = new FileReader(legendFile); legendBuffReader = new BufferedReader(legendReader); } String legendLine; String zero, one; while((legendLine = legendBuffReader.readLine())!=null){ StringTokenizer legendSt = new StringTokenizer(legendLine); String markerid = legendSt.nextToken(); if (markerid.equalsIgnoreCase("rs") || markerid.equalsIgnoreCase("marker")){ //skip header continue; } legendMarkers.add(markerid); legendPositions.add(legendSt.nextToken()); byte[] legendBytes = new byte[2]; zero = legendSt.nextToken(); one = legendSt.nextToken(); if (zero.equalsIgnoreCase("A")){ legendBytes[0] = 1; }else if (zero.equalsIgnoreCase("C")){ legendBytes[0] = 2; }else if (zero.equalsIgnoreCase("G")){ legendBytes[0] = 3; }else if (zero.equalsIgnoreCase("T")){ legendBytes[0] = 4; }else{ throw new PedFileException("Invalid allele: " + zero); } if (one.equalsIgnoreCase("A")){ legendBytes[1] = 1; }else if (one.equalsIgnoreCase("C")){ legendBytes[1] = 2; }else if (one.equalsIgnoreCase("G")){ legendBytes[1] = 3; }else if (one.equalsIgnoreCase("T")){ legendBytes[1] = 4; }else{ throw new PedFileException("Invalid allele: " + one); } legendData.add(legendBytes); } hminfo = new String[legendPositions.size()][2]; for (int i = 0; i < legendPositions.size(); i++){ //marker name. hminfo[i][0] = (String)legendMarkers.get(i); //marker position. hminfo[i][1] = (String)legendPositions.get(i); } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + legendFile.getName()); } //read in the phased data. try{ BufferedReader phasedBuffReader; if (Options.getGzip()){ FileInputStream phasedFis = new FileInputStream(phasedFile); GZIPInputStream phasedInputStream = new GZIPInputStream(phasedFis); phasedBuffReader = new BufferedReader(new InputStreamReader(phasedInputStream)); }else{ FileReader phasedReader = new FileReader(phasedFile); phasedBuffReader = new BufferedReader(phasedReader); } String phasedLine; int columns = 0; String token; boolean even = false; int iterator = 0; while((phasedLine = phasedBuffReader.readLine()) != null){ StringTokenizer phasedSt = new StringTokenizer(phasedLine); columns = phasedSt.countTokens(); if(even){ iterator++; }else{ //Only set up a new individual every 2 lines. ind = new Individual(columns, true); try{ ind.setIndividualID((String)sampleData.get(iterator)); }catch (ArrayIndexOutOfBoundsException e){ throw new PedFileException("File error: Sample file is missing individual IDs"); } if (columns != legendData.size()){ throw new PedFileException("File error: invalid number of markers on Individual " + ind.getIndividualID()); } String details = (String)hapMapTranslate.get(ind.getIndividualID()); //exception in case of wierd compression combos in input files if (details == null){ throw new PedFileException("File format error: " + sampleFile.getName()); } StringTokenizer dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); //skip individualID since we already have it. dt.nextToken(); ind.setDadID(dt.nextToken()); ind.setMomID(dt.nextToken()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + ind.getIndividualID()); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); this.allIndividuals.add(ind); } int index = 0; if (!even){ byteDataT = new byte[columns]; }else{ byteDataU = new byte[columns]; } while(phasedSt.hasMoreTokens()){ token = phasedSt.nextToken(); if (!even){ if (token.equalsIgnoreCase("0")){ byteDataT[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataT[index] = ((byte[])legendData.get(index))[1]; }else { throw new PedFileException("File format error: " + phasedFile.getName()); } }else{ if (token.equalsIgnoreCase("0")){ byteDataU[index] = ((byte[])legendData.get(index))[0]; }else if (token.equalsIgnoreCase("1")){ byteDataU[index] = ((byte[])legendData.get(index))[1]; }else if (Chromosome.getDataChrom().equalsIgnoreCase("chrx") && ind.getGender() == Individual.MALE && token.equalsIgnoreCase("-")){ //X male }else { throw new PedFileException("File format error: " + phasedFile.getName()); } } index++; } if (even){ if (ind.getGender() == Individual.MALE && Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataT[i]); } }else{ for(int i=0; i < columns; i++){ ind.addMarker(byteDataT[i], byteDataU[i]); } } } even = !even; } }catch(NoSuchElementException nse){ throw new PedFileException("File format error: " + phasedFile.getName()); } }
| 1,110,040
|
public static void main( String [] args ) { URL log4jPropertyURL = Photovault.class.getClassLoader().getResource( "log4j.properties"); PropertyConfigurator.configure( log4jPropertyURL ); Photovault app = new Photovault(); app.run(); }
|
public static void main( String [] args ) { URL log4jPropertyURL = Photovault.class.getClassLoader().getResource( "photovault_log4j.properties"); PropertyConfigurator.configure( log4jPropertyURL ); Photovault app = new Photovault(); app.run(); }
| 1,110,046
|
public Destination getDestination() { return destination; }
|
public Destination getDestination() throws JellyException, JMSException { if (destination == null) { if (subject != null) { destination = findDestination(subject); } } return destination; }
| 1,110,047
|
protected void appendIdentifier(StringBuffer sb, String text) { sb.append(text.replace(' ', '_')); }
|
protected void appendIdentifier(StringBuffer sb, String text) { sb.append(toIdentifier(text)); }
| 1,110,048
|
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"); System.out.println(ver); 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 -Xmx650m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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"); System.out.println(ver); 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 -Xmx10m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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,110,050
|
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"); System.out.println(ver); 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 -Xmx650m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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"); System.out.println(ver); 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 -Xmx650m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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,110,051
|
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"); System.out.println(ver); 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 -Xmx650m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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"); System.out.println(ver); 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 -Xmx650m -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; if ((line = besr.readLine()) != null) { errorMsg.append(line); //if the child generated an error message, kill it child.destroy(); dead = true; } //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; } } catch (Exception e) { if (headless){ System.out.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,110,052
|
public void testMovement() { component.addPlayPenComponentListener( eventCounter); assertEquals("" + "We started out with the wrong number of events", 0,eventCounter.getEvents() ); //component.setMoving(true); //assertEquals("We did not generate a move start event",1,eventCounter.getStarts()); pp.startCompoundEdit("Starting move"); component.setLocation(1,1); component.setLocation(2,2); pp.endCompoundEdit("Ending move"); assertEquals("We did not generate move events",1,eventCounter.getMoved()); //component.setMoving(false); //assertEquals("We did not generate a move end event",1,eventCounter.getEnds()); component.setLocation(3,3); //assertEquals("We did not generate a move start event",2,eventCounter.getStarts()); assertEquals("We did not generate move events",2,eventCounter.getMoved()); //assertEquals("We did not generate a move end event",2,eventCounter.getEnds()); }
|
public void testMovement() { component.addPlayPenComponentListener( eventCounter); assertEquals("" + "We started out with the wrong number of events", 0,eventCounter.getEvents() ); //component.setMoving(true); //assertEquals("We did not generate a move start event",1,eventCounter.getStarts()); pp.startCompoundEdit("Starting move"); component.setLocation(1,1); component.setLocation(2,2); pp.endCompoundEdit("Ending move"); assertEquals("Even in Compound edits should still generate a move event for each setLocation",2,eventCounter.getMoved()); //component.setMoving(false); //assertEquals("We did not generate a move end event",1,eventCounter.getEnds()); component.setLocation(3,3); //assertEquals("We did not generate a move start event",2,eventCounter.getStarts()); assertEquals("We did not generate move events",2,eventCounter.getMoved()); //assertEquals("We did not generate a move end event",2,eventCounter.getEnds()); }
| 1,110,053
|
public void testMovement() { component.addPlayPenComponentListener( eventCounter); assertEquals("" + "We started out with the wrong number of events", 0,eventCounter.getEvents() ); //component.setMoving(true); //assertEquals("We did not generate a move start event",1,eventCounter.getStarts()); pp.startCompoundEdit("Starting move"); component.setLocation(1,1); component.setLocation(2,2); pp.endCompoundEdit("Ending move"); assertEquals("We did not generate move events",1,eventCounter.getMoved()); //component.setMoving(false); //assertEquals("We did not generate a move end event",1,eventCounter.getEnds()); component.setLocation(3,3); //assertEquals("We did not generate a move start event",2,eventCounter.getStarts()); assertEquals("We did not generate move events",2,eventCounter.getMoved()); //assertEquals("We did not generate a move end event",2,eventCounter.getEnds()); }
|
public void testMovement() { component.addPlayPenComponentListener( eventCounter); assertEquals("" + "We started out with the wrong number of events", 0,eventCounter.getEvents() ); //component.setMoving(true); //assertEquals("We did not generate a move start event",1,eventCounter.getStarts()); pp.startCompoundEdit("Starting move"); component.setLocation(1,1); component.setLocation(2,2); pp.endCompoundEdit("Ending move"); assertEquals("We did not generate move events",1,eventCounter.getMoved()); //component.setMoving(false); //assertEquals("We did not generate a move end event",1,eventCounter.getEnds()); component.setLocation(3,3); //assertEquals("We did not generate a move start event",2,eventCounter.getStarts()); assertEquals("We did not generate move events",3,eventCounter.getMoved()); //assertEquals("We did not generate a move end event",2,eventCounter.getEnds()); }
| 1,110,054
|
protected Object newInstance( Class theClass, Map attributes, XMLOutput output) throws JellyTagException { int style = getStyle(attributes); // now lets call the constructor with the parent Widget parent = getParentWidget(); Widget widget = (Widget) createWidget(theClass, parent, style); if (parent != null) { attachWidgets(parent, widget); } return widget; }
|
protected Object newInstance( Class theClass, Map attributes, XMLOutput output) throws JellyTagException { int style = getStyle(attributes); // now lets call the constructor with the parent Widget parent = getParentWidget(); Widget widget = (Widget) createWidget(theClass, parent, style); if (parent != null) { attachWidgets(parent, widget); } return widget; }
| 1,110,055
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.