rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
InvocationTargetException, NoSuchMethodException { | InvocationTargetException, NoSuchMethodException, ArchitectException { | public void testAllSettersGenerateEvents() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { SQLObject so = getSQLObjectUnderTest(); Set<String>propertiesToIgnore = new HashSet<String>(); propertiesToIgnore.add("populated"); propertiesToIgnore.add("SQLObjectListeners"); propertiesToIgnore.add("children"); propertiesToIgnore.add("parent"); propertiesToIgnore.add("parentDatabase"); propertiesToIgnore.add("class"); propertiesToIgnore.add("childCount"); propertiesToIgnore.add("undoEventListeners"); propertiesToIgnore.add("connection"); propertiesToIgnore.add("typeMap"); propertiesToIgnore.add("secondaryChangeMode"); propertiesToIgnore.add("zoomInAction"); propertiesToIgnore.add("zoomOutAction"); propertiesToIgnore.add("magicEnabled"); if(so instanceof SQLDatabase) { // should be handled in the Datasource propertiesToIgnore.add("name"); } CountingSQLObjectListener listener = new CountingSQLObjectListener(); so.addSQLObjectListener(listener); List<PropertyDescriptor> settableProperties; settableProperties = Arrays.asList(PropertyUtils.getPropertyDescriptors(so.getClass())); for (PropertyDescriptor property : settableProperties) { Object oldVal; if (propertiesToIgnore.contains(property.getName())) continue; try { oldVal = PropertyUtils.getSimpleProperty(so, property.getName()); // check for a setter if (property.getWriteMethod() == null) { continue; } } catch (NoSuchMethodException e) { System.out.println("Skipping non-settable property "+property.getName()+" on "+so.getClass().getName()); continue; } Object newVal; // don't init here so compiler can warn if the following code doesn't always give it a value if (property.getPropertyType() == Integer.TYPE ) { newVal = ((Integer)oldVal)+1; } else if (property.getPropertyType() == String.class) { // make sure it's unique newVal ="new " + oldVal; } else if (property.getPropertyType() == Boolean.TYPE){ newVal = new Boolean(! ((Boolean) oldVal).booleanValue()); } else if (property.getPropertyType() == SQLCatalog.class) { newVal = new SQLCatalog(new SQLDatabase(),"This is a new catalog"); } else if (property.getPropertyType() == ArchitectDataSource.class) { newVal = new ArchitectDataSource(); ((ArchitectDataSource)newVal).setName("test"); ((ArchitectDataSource)newVal).setDisplayName("test"); ((ArchitectDataSource)newVal).setUser("a"); ((ArchitectDataSource)newVal).setPass("b"); ((ArchitectDataSource)newVal).setDriverClass(MockJDBCDriver.class.getName()); ((ArchitectDataSource)newVal).setUrl("jdbc:mock:x=y"); } else if (property.getPropertyType() == SQLTable.class) { newVal = new SQLTable(); } else { throw new RuntimeException("This test case lacks a value for "+ property.getName()+ " (type "+property.getPropertyType().getName()+") from "+so.getClass()); } int oldChangeCount = listener.getChangedCount(); try { BeanUtils.copyProperty(so, property.getName(), newVal); // some setters fire multiple events (they change more than one property) assertTrue("Event for set "+property.getName()+" on "+so.getClass().getName()+" didn't fire!", listener.getChangedCount() > oldChangeCount); if (listener.getChangedCount() == oldChangeCount + 1) { assertEquals("Property name mismatch for "+property.getName()+ " in "+so.getClass(), property.getName(), listener.getLastEvent().getPropertyName()); assertEquals("New value for "+property.getName()+" was wrong", newVal, listener.getLastEvent().getNewValue()); } } catch (InvocationTargetException e) { System.out.println("(non-fatal) Failed to write property '"+property.getName()+" to type "+so.getClass().getName()); } } } |
context.runScript(uri, output, getExport(), getInherit() ); | context.runScript(uri, output, isExport(), isInherit() ); | public void doTag(XMLOutput output) throws Exception { if (uri == null) { throw new MissingAttributeException( "uri" ); } // we need to create a new JellyContext of the URI // take off the script name from the URL context.runScript(uri, output, getExport(), getInherit() ); } |
bestPermPanel.setMaximumSize(bestPermPanel.getPreferredSize()); | public void run() { try { while(testSet.getPermutationCount() - testSet.getPermutationsPerformed() != 0) { permProgressBar.setValue(testSet.getPermutationsPerformed()); scoreBoardNumTotalLabel.setText(String.valueOf(testSet.getPermutationsPerformed())); scoreBoardNumPassLabel.setText(String.valueOf(testSet.getBestExceededCount())); bestPermutationValueLabel.setText(String.valueOf(testSet.getBestPermChiSquare())); bestPermPanel.setMaximumSize(bestPermPanel.getPreferredSize()); sleep(200); } } catch(InterruptedException ie) {} } |
|
bestObsPanel.setMaximumSize(bestObsPanel.getPreferredSize()); | public void finishedPerms() { scoreBoardNumTotalLabel.setText(String.valueOf(testSet.getPermutationsPerformed())); scoreBoardNumPassLabel.setText(String.valueOf(testSet.getBestExceededCount())); doPermutationsButton.setEnabled(true); stopPermutationsButton.setEnabled(false); this.remove(permProgressBar); bestObsValueLabel.setText(testSet.getBestObsChiSq() + " (" + testSet.getBestObsName() + ")"); bestObsPanel.setMaximumSize(bestObsPanel.getPreferredSize()); bestPermutationValueLabel.setText(String.valueOf(testSet.getBestPermChiSquare())); bestPermPanel.setMaximumSize(bestPermPanel.getPreferredSize()); makeTable(); resultsPanel.revalidate(); finishedPerms = true; } |
|
bestPermPanel.setMaximumSize(bestPermPanel.getPreferredSize()); | public void finishedPerms() { scoreBoardNumTotalLabel.setText(String.valueOf(testSet.getPermutationsPerformed())); scoreBoardNumPassLabel.setText(String.valueOf(testSet.getBestExceededCount())); doPermutationsButton.setEnabled(true); stopPermutationsButton.setEnabled(false); this.remove(permProgressBar); bestObsValueLabel.setText(testSet.getBestObsChiSq() + " (" + testSet.getBestObsName() + ")"); bestObsPanel.setMaximumSize(bestObsPanel.getPreferredSize()); bestPermutationValueLabel.setText(String.valueOf(testSet.getBestPermChiSquare())); bestPermPanel.setMaximumSize(bestPermPanel.getPreferredSize()); makeTable(); resultsPanel.revalidate(); finishedPerms = true; } |
|
if ( taglib instanceof DynamicTagLibrary ) { DynamicTagLibrary dynaLib = (DynamicTagLibrary) taglib; Tag newTag = dynaLib.createTag( tag.getLocalName(), getSaxAttributes() ); | if ( taglib != null ) { Tag newTag = taglib.createTag( tag.getLocalName(), getSaxAttributes() ); | protected Tag findDynamicTag(JellyContext context, StaticTag tag) throws JellyException { // lets see if there's a tag library for this URI... TagLibrary taglib = context.getTagLibrary( tag.getUri() ); if ( taglib instanceof DynamicTagLibrary ) { DynamicTagLibrary dynaLib = (DynamicTagLibrary) taglib; Tag newTag = dynaLib.createTag( tag.getLocalName(), getSaxAttributes() ); if ( newTag != null ) { newTag.setParent( tag.getParent() ); newTag.setBody( tag.getBody() ); return newTag; } } return tag; } |
null, getMBeanServer()); | env, getMBeanServer()); | private static void startJMXConnectorServer(int port){ try { /* attempt to start the rmi registry */ startRMIRegistry(port); /* start the connector server */ JMXServiceURL url = new JMXServiceURL( "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/testApp"); JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, getMBeanServer()); cs.start(); logger.info("JMXConnectorServer started. URL: " + url.toString()); } catch (IOException e) { logger.log(Level.SEVERE, "Failure while starting RMI connector", e); } } |
null, getMBeanServer()); | env, getMBeanServer()); | private static void startJMXMPConnectorServer(int port){ try { /* start the connector server */ JMXServiceURL url = new JMXServiceURL( "service:jmx:jmxmp://localhost:" + port); JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, getMBeanServer()); cs.start(); logger.info("JMXConnectorServer started. URL: " + url.toString()); } catch (IOException e) { logger.log(Level.SEVERE, "Failure while starting RMI connector", e); } } |
if (!(args[a].startsWith("-"))){ | if (args[a].indexOf(" ") > 0){ | public static void main(String[] args) { int exitValue = 0; //String dir = System.getProperty("user.dir"); //String ver = System.getProperty("java.version"); String sep = System.getProperty("file.separator"); String javaHome = System.getProperty("java.home"); //TODO:do some version checking and bitch at people with old JVMs /*StringTokenizer st = new StringTokenizer(ver, "."); while (st.hasMoreTokens()){ System.out.println(st.nextToken()); } */ //ugh windows sucks and we need to put quotes around path in case it contains spaces //on the other hand, linux seems displeased with the quoted classpath. sigh. String jarfile; if (System.getProperty("java.class.path").indexOf(" ") > 0 ){ jarfile = ("\""); jarfile += System.getProperty("java.class.path"); jarfile += "\""; }else{ jarfile = System.getProperty("java.class.path"); } String xmxArg = "512"; String argsToBePassed = ""; boolean headless = false; for (int a = 0; a < args.length; a++){ if (args[a].equalsIgnoreCase("-memory")){ a++; xmxArg = args[a]; }else{ if (!(args[a].startsWith("-"))){ args[a] = "\"" + args[a] + "\""; } argsToBePassed = argsToBePassed.concat(" " + args[a]); } if (args[a].equalsIgnoreCase("-n") || args[a].equalsIgnoreCase("-nogui")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = javaHome + sep + "bin" + sep + "java -Dsun.java2d.noddraw=true -Xmx" + xmxArg + "m -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; while ( !dead && (line = besr.readLine()) != null) { if(line.lastIndexOf("Memory") != -1) { errorMsg.append(line); //if the child generated an "Out of Memory" error message, kill it child.destroy(); dead = true; }else { //for any other errors we show them to the user if(headless) { //if were in headless (command line) mode, then print the error text to command line System.err.println(line); } else { //otherwise print it to the error textarea if(errorTextArea == null) { //if this is the first error line then we need to create the JFrame with the //text area javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createAndShowGUI(); } }); } //if the user closed the contentFrame, then we want to reopen it when theres error text if(!contentFrame.isVisible()) { contentFrame.setVisible(true); } errorTextArea.append(line + "\n"); errorTextArea.setCaretPosition(errorTextArea.getDocument().getLength()); } } } final String realErrorMsg = errorMsg.toString(); //if the child died painfully throw up R.I.P. dialog if (dead){ if (headless){ System.err.println(errorMsg); }else{ Runnable showRip = new Runnable() { public void run() { JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, realErrorMsg, null, JOptionPane.ERROR_MESSAGE);} }; SwingUtilities.invokeAndWait(showRip); } exitValue = -1; } } catch (Exception e) { if (headless){ System.err.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } } System.exit(exitValue); } |
public Tag createTag(String name) | public Tag createTag(String name, Attributes attributes) | public Tag createTag(String name) throws Exception { Object value = templates.get(name); if ( value instanceof Script ) { Script template = (Script) value; return new DynamicTag(template); } else if ( value instanceof TagFactory ) { TagFactory factory = (TagFactory) value; return factory.createTag(); } return null; } |
return factory.createTag(); | return factory.createTag(name, attributes); | public Tag createTag(String name) throws Exception { Object value = templates.get(name); if ( value instanceof Script ) { Script template = (Script) value; return new DynamicTag(template); } else if ( value instanceof TagFactory ) { TagFactory factory = (TagFactory) value; return factory.createTag(); } return null; } |
public Tag createTag() throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name); | public Tag createTag(String name, Attributes attributes) throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name, attributes); | public TagScript createTagScript(final String name, final Attributes attributes) throws Exception { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name); // delegate to my parent instead if ( answer == null && parent != null ) { return parent.createTag(name, attributes); } return answer; } } ); } |
public Tag createTag() throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name); | public Tag createTag(String name, Attributes attributes) throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name, attributes); | public Tag createTag() throws Exception { Tag answer = DynamicTagLibrary.this.createTag(name); // delegate to my parent instead if ( answer == null && parent != null ) { return parent.createTag(name, attributes); } return answer; } |
chart.setBorderPaint(new Color(230, 238, 249)); | private static JFreeChart createChart(final PieDataset dataset) { final JFreeChart chart = ChartFactory.createPieChart( null, // chart title dataset, // data false, // include legend false, false); // E6EEF9 chart.setBackgroundPaint(new Color(230, 238, 249)); chart.setBorderVisible(false); chart.setBorderPaint(new Color(230, 238, 249)); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelLinkPaint(Color.red); plot.setLabelGap(0.02); // set paint for unavailable/available sections plot.setSectionPaint(0, Color.RED); plot.setSectionPaint(1, Color.GREEN); plot.setBackgroundPaint(new Color(230, 238, 249)); //plot.set return chart; } |
|
plot.setOutlinePaint(new Color(230, 238, 249)); | private static JFreeChart createChart(final PieDataset dataset) { final JFreeChart chart = ChartFactory.createPieChart( null, // chart title dataset, // data false, // include legend false, false); // E6EEF9 chart.setBackgroundPaint(new Color(230, 238, 249)); chart.setBorderVisible(false); chart.setBorderPaint(new Color(230, 238, 249)); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelLinkPaint(Color.red); plot.setLabelGap(0.02); // set paint for unavailable/available sections plot.setSectionPaint(0, Color.RED); plot.setSectionPaint(1, Color.GREEN); plot.setBackgroundPaint(new Color(230, 238, 249)); //plot.set return chart; } |
|
DashboardContext dashboardContext = new DashboardContextImpl(context, request); | public static String drawComponent(WebContext context, HttpServletRequest request, String dashboardId, String componentId){ DashboardContext dashboardContext = new DashboardContextImpl(context, request); DashboardConfig dashboardConfig = DashboardRepository.getInstance().get(dashboardId); assert dashboardConfig != null : "Error retrieving dashboard details. id=" + dashboardId; DashboardComponent component = dashboardConfig.getComponents().get(componentId); assert component != null : "Error retrieving component. id=" + componentId; try{ return component.draw(dashboardContext); }catch(Throwable e){ logger.log(Level.SEVERE, "Error displaying component", e); return "Error:" + e.getMessage(); } } |
|
DashboardContext dashboardContext = new DashboardContextImpl(context, dashboardConfig, request); | public static String drawComponent(WebContext context, HttpServletRequest request, String dashboardId, String componentId){ DashboardContext dashboardContext = new DashboardContextImpl(context, request); DashboardConfig dashboardConfig = DashboardRepository.getInstance().get(dashboardId); assert dashboardConfig != null : "Error retrieving dashboard details. id=" + dashboardId; DashboardComponent component = dashboardConfig.getComponents().get(componentId); assert component != null : "Error retrieving component. id=" + componentId; try{ return component.draw(dashboardContext); }catch(Throwable e){ logger.log(Level.SEVERE, "Error displaying component", e); return "Error:" + e.getMessage(); } } |
|
public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { | public String makeDropForeignKeySQL(String fkTable, String fkName) { | public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { return "ALTER TABLE " +DDLUtils.toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP CONSTRAINT " +fkName; } |
+DDLUtils.toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP CONSTRAINT " +fkName; | + toQualifiedName(fkTable) + " DROP CONSTRAINT " + fkName; | public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { return "ALTER TABLE " +DDLUtils.toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP CONSTRAINT " +fkName; } |
public void modifyColumn(SQLColumn c) throws ArchitectDiffException { | public void modifyColumn(SQLColumn c) { | public void modifyColumn(SQLColumn c) throws ArchitectDiffException { Map colNameMap = new HashMap(); SQLTable t = c.getParentTable(); print("\n ALTER TABLE "); print( DDLUtils.toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getPhysicalName()) ); print(" MODIFY "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.MODIFY, c); } |
print( DDLUtils.toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getPhysicalName()) ); | print(toQualifiedName(t.getPhysicalName())); | public void modifyColumn(SQLColumn c) throws ArchitectDiffException { Map colNameMap = new HashMap(); SQLTable t = c.getParentTable(); print("\n ALTER TABLE "); print( DDLUtils.toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getPhysicalName()) ); print(" MODIFY "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.MODIFY, c); } |
public String toIdentifier(String logicalName, String physicalName) { | private String toIdentifier(String logicalName, String physicalName) { | public String toIdentifier(String logicalName, String physicalName) { // replace spaces with underscores if (logicalName == null) return null; if (logger.isDebugEnabled()) logger.debug("getting physical name for: " + logicalName); String ident = logicalName.replace(' ','_').toUpperCase(); if (logger.isDebugEnabled()) logger.debug("after replace of spaces: " + ident); // make sure first character is alpha Pattern p = Pattern.compile("^[^a-zA-Z]+"); Matcher m = p.matcher(ident); if (m.find()) { // just add something alpha to the front for now ident = "X" + ident; if (logger.isDebugEnabled()) logger.debug("identifiers must start with letter, appending X: " + ident); } // see if it's a reserved word, and add something alpha to front if it is... if (isReservedWord(ident)) { ident = "X" + ident; if (logger.isDebugEnabled()) logger.debug("identifier was reserved word, appending X: " + ident); } // replace anything that is not a letter, character, or underscore with an underscore... ident = ident.replaceAll("[^a-zA-Z0-9_]", "_"); // first time through if (physicalName == null) { // length is ok if (ident.length() < 31) { return ident; } else { // length is too big if (logger.isDebugEnabled()) logger.debug("truncating identifier: " + ident); String base = ident.substring(0,27); int tiebreaker = ((ident.hashCode() % 1000) + 1000) % 1000; if (logger.isDebugEnabled()) logger.debug("new identifier: " + base + tiebreaker); return (base + tiebreaker); } } else { // back for more, which means that we had a // namespace conflict. Hack the ident down // to size if it's too big, and then generate // a hash tiebreaker using the ident and the // current value of physicalName if (logger.isDebugEnabled()) logger.debug("physical idenfier is not unique, regenerating: " + physicalName); String base = ident; if (ident.length() > 27) { base = ident.substring(0, 27); } int tiebreaker = (((ident + physicalName).hashCode() % 1000) + 1000) % 1000; if (logger.isDebugEnabled()) logger.debug("regenerated identifier is: " + (base + tiebreaker)); return (base + tiebreaker); } } |
if (Options.getAssocTest() != 0){ | if (Options.getAssocTest() != ASSOC_NONE){ | public ExportDialog(HaploView h){ super(h, "Export Data"); hv = h; JPanel contents = new JPanel(); contents.setLayout(new BoxLayout(contents, BoxLayout.Y_AXIS)); JPanel tabPanel = new JPanel(); int currTab = hv.tabs.getSelectedIndex(); tabPanel.setBorder(new TitledBorder("Tab to Export")); tabPanel.setLayout(new BoxLayout(tabPanel,BoxLayout.Y_AXIS)); tabPanel.setAlignmentX(CENTER_ALIGNMENT); ButtonGroup g1 = new ButtonGroup(); dpButton = new JRadioButton("LD"); dpButton.setActionCommand("ldtab"); dpButton.addActionListener(this); g1.add(dpButton); tabPanel.add(dpButton); if (currTab == VIEW_D_NUM){ dpButton.setSelected(true); } hapButton = new JRadioButton("Haplotypes"); hapButton.setActionCommand("haptab"); hapButton.addActionListener(this); g1.add(hapButton); tabPanel.add(hapButton); if (currTab == VIEW_HAP_NUM){ hapButton.setSelected(true); } if (hv.checkPanel != null){ checkButton = new JRadioButton("Data Checks"); checkButton.setActionCommand("checktab"); checkButton.addActionListener(this); g1.add(checkButton); tabPanel.add(checkButton); if (currTab == VIEW_CHECK_NUM){ checkButton.setSelected(true); } } if (Options.getAssocTest() != 0){ assocButton = new JRadioButton("Association Tests"); assocButton.setActionCommand("assoctab"); assocButton.addActionListener(this); g1.add(assocButton); tabPanel.add(assocButton); if (currTab == VIEW_TDT_NUM){ assocButton.setSelected(true); } } contents.add(tabPanel); JPanel formatPanel = new JPanel(); formatPanel.setBorder(new TitledBorder("Output Format")); ButtonGroup g2 = new ButtonGroup(); txtButton = new JRadioButton("Text"); txtButton.addActionListener(this); formatPanel.add(txtButton); g2.add(txtButton); txtButton.setSelected(true); pngButton = new JRadioButton("PNG Image"); pngButton.addActionListener(this); formatPanel.add(pngButton); g2.add(pngButton); compressCheckBox = new JCheckBox("Compress image (smaller file)"); formatPanel.add(compressCheckBox); compressCheckBox.setEnabled(false); if (currTab == VIEW_CHECK_NUM || currTab == VIEW_TDT_NUM){ pngButton.setEnabled(false); } contents.add(formatPanel); JPanel rangePanel = new JPanel(); rangePanel.setBorder(new TitledBorder("Range")); ButtonGroup g3 = new ButtonGroup(); allButton = new JRadioButton("All"); allButton.addActionListener(this); rangePanel.add(allButton); g3.add(allButton); allButton.setSelected(true); someButton = new JRadioButton("Marker "); someButton.addActionListener(this); rangePanel.add(someButton); g3.add(someButton); lowRange = new NumberTextField("",5,false); rangePanel.add(lowRange); rangePanel.add(new JLabel(" to ")); upperRange = new NumberTextField("",5,false); rangePanel.add(upperRange); upperRange.setEnabled(false); lowRange.setEnabled(false); adjButton = new JRadioButton("Adjacent markers only"); adjButton.addActionListener(this); rangePanel.add(adjButton); g3.add(adjButton); if (currTab != VIEW_D_NUM){ someButton.setEnabled(false); adjButton.setEnabled(false); } contents.add(rangePanel); JPanel choicePanel = new JPanel(); JButton okButton = new JButton("OK"); okButton.addActionListener(this); choicePanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); choicePanel.add(cancelButton); contents.add(choicePanel); this.setContentPane(contents); this.setLocation(this.getParent().getX() + 100, this.getParent().getY() + 100); this.setModal(true); } |
public void doTag(XMLOutput output) throws Exception { context.setVariable( "org.apache.commons.jelly.werkz.Project", project ); | public void doTag(XMLOutput output) throws Exception { | public void doTag(XMLOutput output) throws Exception { // project.clear(); context.setVariable( "org.apache.commons.jelly.werkz.Project", project ); getBody().run(context, output); } |
if ( project == null ) { project = (Project) context.getVariable( "org.apache.commons.jelly.werkz.Project" ); if ( project == null ) { project = new Project(); context.setVariable( "org.apache.commons.jelly.werkz.Project", project ); } } | public Project getProject() { return project; } |
|
super("ApplicationHeartBeatThread:" + appConfig.getName()); | protected ApplicationHeartBeatThread(ApplicationConfig appConfig) { this.appConfig = appConfig; } |
|
String text = getBodyText(); | String text = getBodyText(false); | public void doTag(XMLOutput output) throws JellyTagException { try { JellyInterpreter interpreter = BeanShellExpressionFactory.getInterpreter(context); // @todo it'd be really nice to create a JellyNameSpace to pass into // this method so that any variables declared by beanshell could be exported // into the JellyContext String text = getBodyText(); interpreter.eval(text); } catch (EvalError e) { throw new JellyTagException(e); } } |
public void doTag(XMLOutput output) throws Exception { | public void doTag(XMLOutput output) throws JellyTagException { | public void doTag(XMLOutput output) throws Exception { if (log.isDebugEnabled()) log.debug("********Executing DummyTag Body*********"); if (m_classToBeLoaded != null) { try { Class clazz = getClass().getClassLoader().loadClass(m_classToBeLoaded); if (log.isDebugEnabled()) log.debug("Class[" + m_classToBeLoaded + "] FOUND"); } catch (ClassNotFoundException cnfe) { if (log.isWarnEnabled()) log.warn("Class[" + m_classToBeLoaded + "] NOT FOUND"); } } invokeBody(output); } |
byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; | allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; | int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
byte[] markers; byte[] zeroArray = {0,0}; | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
|
markers = zeroArray; | allele1 = 0; allele2 = 0; | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
markers = currentInd.getMarker(loc); | allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
allele1 = markers[0]; allele2 = markers[1]; | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele2 = markers[1]; //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if (currentFamily.containsMember(currentInd.getMomID()) && currentFamily.containsMember(currentInd.getDadID())){ //do mendel check byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele2 = markers[1]; String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; } |
|
logger.log(Level.FINE, "Unknown error", e); | logger.log(Level.SEVERE, "Unknown error", e); | public boolean isQualified(ApplicationConfig applicationConfig) { ServerConnection serverConnection = null; try { serverConnection = ServerConnector.getServerConnection(applicationConfig); String value = (String)serverConnection.getAttribute(objectName, attributeName); return value.startsWith("1.5"); } catch (ConnectionFailedException e){ logger.log(Level.FINE, new StringBuilder().append( "Error retrieving attributes for:").append( applicationConfig.getName()).toString(), e); } catch(Exception e){ if(e instanceof InstanceNotFoundException || e.getCause() instanceof InstanceNotFoundException){ logger.log(Level.INFO, "Specified object name/ attribute not found"); }else{ logger.log(Level.FINE, "Unknown error", e); } } finally{ ServiceUtils.close(serverConnection); } return false; } |
ConnectorRegistry.remove(config); | public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { AccessController.checkAccess(context.getServiceContext(), ACL_EDIT_APPLICATIONS); ConnectorForm connForm = (ConnectorForm) actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( connForm.getApplicationId()); assert config != null; config.setName(connForm.getName()); Map<String, String> paramValueMap = config.getParamValues(); String[] paramNames = connForm.getConfigNames(); String[] paramValues = connForm.getConfigValues(); for (int i = 0; i < paramNames.length; i++) { if(paramValues[i] != null) { paramValueMap.put(paramNames[i], paramValues[i]); } else { paramValueMap.remove(paramNames[i]); } } config.setParamValues(paramValueMap); ApplicationConfigManager.updateApplication(config); /* update the AlertEngine */ AlertEngine.getInstance().updateApplication(config); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated application " + "\"" + config.getName() + "\""); return mapping.findForward(Forwards.SUCCESS); } |
|
stylesheet.setValueOfAction( new Action() { public void run(Node node) throws Exception { String text = node.getStringValue(); if ( text != null && text.length() > 0 ) { output.write( text ); } } } ); | public StylesheetTag() { // add default actions stylesheet.setValueOfAction( new Action() { public void run(Node node) throws Exception { String text = node.getStringValue(); if ( text != null && text.length() > 0 ) { output.write( text ); } } } ); } |
|
stylesheet.addRule( rule ); | getStylesheet().addRule( rule ); | public void addTemplate( Rule rule ) { stylesheet.addRule( rule ); } |
this.output = output; try { getBody().run(context, output); if ( log.isDebugEnabled() ) { log.debug( "About to evaluate stylesheet on source: " + source ); } stylesheet.setModeName( getMode() ); stylesheet.run( source ); } finally { this.output = null; stylesheet.clear(); } } | this.output = output; Stylesheet stylesheet = getStylesheet(); stylesheet.clear(); getBody().run(context, output); stylesheet.setModeName(getMode()); if (var != null) { context.setVariable(var, stylesheet); } else { Object source = getSource(); if (log.isDebugEnabled()) { log.debug("About to evaluate stylesheet on source: " + source); } stylesheet.run(source); } } | public void doTag(XMLOutput output) throws Exception { // for use by inner classes this.output = output; try { // run the body to add the rules getBody().run(context, output); if ( log.isDebugEnabled() ) { log.debug( "About to evaluate stylesheet on source: " + source ); } stylesheet.setModeName( getMode() ); stylesheet.run( source ); } finally { // help the GC this.output = null; stylesheet.clear(); } } |
if ( stylesheet == null ) { stylesheet = createStylesheet(); } | public Stylesheet getStylesheet() { return stylesheet; } |
|
this.variables = variables; | this.variables.putAll( variables ); | public void setVariables(Map variables) { this.variables = variables; } |
logger.info("Making Changes to the key of the column"); | public void setPrimaryKeySeq(Integer argPrimaryKeySeq) { Integer oldPrimaryKeySeq = primaryKeySeq; if (argPrimaryKeySeq != null && !this.autoIncrement) { setNullable(DatabaseMetaData.columnNoNulls); } if (this.primaryKeySeq != null && this.primaryKeySeq.equals(argPrimaryKeySeq)) return; this.primaryKeySeq = argPrimaryKeySeq; if (parent != null) { Collections.sort(getParentTable().columnsFolder.children, new SortByPKSeq()); getParentTable().normalizePrimaryKey(); } fireDbObjectChanged("primaryKeySeq",oldPrimaryKeySeq,argPrimaryKeySeq); } |
|
getBody().run(context, output); | invokeBody(output); | public void doTag(XMLOutput output) throws Exception { if (test != null) { if (test.evaluateAsBoolean(context)) { getBody().run(context, output); } } else { throw new MissingAttributeException( "test" ); } } |
super("Insert Column", | super("New Column", | public InsertColumnAction() { super("Insert Column", ASUtils.createIcon("NewColumn", "Insert Column", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); } |
"Insert Column", | "New Column", | public InsertColumnAction() { super("Insert Column", ASUtils.createIcon("NewColumn", "Insert Column", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); } |
putValue(SHORT_DESCRIPTION, "New Column"); | public InsertColumnAction() { super("Insert Column", ASUtils.createIcon("NewColumn", "Insert Column", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); } |
|
Haplotype[] crossHaplos = generateHaplotypes(inputVector, 1)[0]; | Haplotype[] crossHaplos = generateHaplotypes(inputVector, 1,true)[0]; | Haplotype[][] generateCrossovers(Haplotype[][] haplos) throws HaploViewException{ Vector crossBlock = new Vector(); double CROSSOVER_THRESHOLD = 0.01; //to what percentage do we want to consider crossings? if (haplos.length == 0) return null; //seed first block with ordering numbers for (int u = 0; u < haplos[0].length; u++){ haplos[0][u].setListOrder(u); } for (int i = 0; i < haplos.length; i++){ haplos[i][0].clearTags(); } multidprimeArray = new double[haplos.length]; //get "tag" SNPS if there is only one block: if (haplos.length==1){ Vector theBestSubset = getBestSubset(haplos[0]); for (int i = 0; i < theBestSubset.size(); i++){ haplos[0][0].addTag(((Integer)theBestSubset.elementAt(i)).intValue()); } } for (int gap = 0; gap < haplos.length - 1; gap++){ //compute crossovers for each inter-block gap Vector preGapSubset = getBestSubset(haplos[gap]); Vector postGapSubset = getBestSubset(haplos[gap+1]); int[] preMarkerID = haplos[gap][0].getMarkers(); //index haplos to markers in whole dataset int[] postMarkerID = haplos[gap+1][0].getMarkers(); crossBlock.clear(); //make a "block" of the markers which id the pre- and post- gap haps for (int i = 0; i < preGapSubset.size(); i++){ crossBlock.add(new Integer(preMarkerID[((Integer)preGapSubset.elementAt(i)).intValue()])); //mark tags haplos[gap][0].addTag(((Integer)preGapSubset.elementAt(i)).intValue()); } for (int i = 0; i < postGapSubset.size(); i++){ crossBlock.add(new Integer(postMarkerID[((Integer)postGapSubset.elementAt(i)).intValue()])); //mark tags haplos[gap+1][0].addTag(((Integer)postGapSubset.elementAt(i)).intValue()); } Vector inputVector = new Vector(); int[] intArray = new int[crossBlock.size()]; for (int i = 0; i < crossBlock.size(); i++){ //input format for hap generating routine intArray[i] = ((Integer)crossBlock.elementAt(i)).intValue(); } inputVector.add(intArray); Haplotype[] crossHaplos = generateHaplotypes(inputVector, 1)[0]; //get haplos of gap double[][] multilocusTable = new double[haplos[gap].length][]; double[] rowSum = new double[haplos[gap].length]; double[] colSum = new double[haplos[gap+1].length]; double multilocusTotal = 0; for (int i = 0; i < haplos[gap].length; i++){ double[] crossPercentages = new double[haplos[gap+1].length]; StringBuffer firstHapCodeB = new StringBuffer(preGapSubset.size()); for (int j = 0; j < preGapSubset.size(); j++){ //make a string out of uniquely identifying genotypes for this hap firstHapCodeB.append(haplos[gap][i].getGeno()[((Integer)preGapSubset.elementAt(j)).intValue()]); } String firstHapCode = firstHapCodeB.toString(); for (int gapHaplo = 0; gapHaplo < crossHaplos.length; gapHaplo++){ //look at each crossover hap if (crossHaplos[gapHaplo].getPercentage() > CROSSOVER_THRESHOLD){ StringBuffer gapBeginHapCodeB = new StringBuffer(preGapSubset.size()); for (int j = 0; j < preGapSubset.size(); j++){ //make a string as above gapBeginHapCodeB.append(crossHaplos[gapHaplo].getGeno()[j]); } String gapBeginHapCode = gapBeginHapCodeB.toString(); if (gapBeginHapCode.equals(firstHapCode)){ //if this crossover hap corresponds to this pregap hap StringBuffer gapEndHapCodeB = new StringBuffer(preGapSubset.size()); for (int j = preGapSubset.size(); j < crossHaplos[gapHaplo].getGeno().length; j++){ gapEndHapCodeB.append(crossHaplos[gapHaplo].getGeno()[j]); } String gapEndHapCode = gapEndHapCodeB.toString(); for (int j = 0; j < haplos[gap+1].length; j++){ StringBuffer endHapCodeB = new StringBuffer(); for (int k = 0; k < postGapSubset.size(); k++){ endHapCodeB.append(haplos[gap+1][j].getGeno()[((Integer)postGapSubset.elementAt(k)).intValue()]); } String endHapCode = endHapCodeB.toString(); if (gapEndHapCode.equals(endHapCode)){ crossPercentages[j] = crossHaplos[gapHaplo].getPercentage(); } } } } } //thought i needed to fix these percentages, but the raw values are just as good. /* double percentageSum = 0; double[] fixedCross = new double[crossPercentages.length]; for (int y = 0; y < crossPercentages.length; y++){ percentageSum += crossPercentages[y]; } for (int y = 0; y < crossPercentages.length; y++){ fixedCross[y] = crossPercentages[y]/percentageSum; }*/ haplos[gap][i].addCrossovers(crossPercentages); multilocusTable[i] = crossPercentages; } //sort based on "straight line" crossings int hilimit; int lolimit; if (haplos[gap+1].length > haplos[gap].length) { hilimit = haplos[gap+1].length; lolimit = haplos[gap].length; }else{ hilimit = haplos[gap].length; lolimit = haplos[gap+1].length; } boolean[] unavailable = new boolean[hilimit]; int[] prevBlockLocs = new int[haplos[gap].length]; for (int q = 0; q < prevBlockLocs.length; q++){ prevBlockLocs[haplos[gap][q].getListOrder()] = q; } for (int u = 0; u < haplos[gap+1].length; u++){ double currentBestVal = 0; int currentBestLoc = -1; for (int v = 0; v < lolimit; v++){ if (!(unavailable[v])){ if (haplos[gap][prevBlockLocs[v]].getCrossover(u) >= currentBestVal) { currentBestLoc = haplos[gap][prevBlockLocs[v]].getListOrder(); currentBestVal = haplos[gap][prevBlockLocs[v]].getCrossover(u); } } } //it didn't get lined up with any of the previous block's markers //put it at the end of the list if (currentBestLoc == -1){ for (int v = 0; v < unavailable.length; v++){ if (!(unavailable[v])){ currentBestLoc = v; break; } } } haplos[gap+1][u].setListOrder(currentBestLoc); unavailable[currentBestLoc] = true; } //compute multilocus D' for (int i = 0; i < rowSum.length; i++){ for (int j = 0; j < colSum.length; j++){ rowSum[i] += multilocusTable[i][j]; colSum[j] += multilocusTable[i][j]; multilocusTotal += multilocusTable[i][j]; if (rowSum[i] == 0) rowSum[i] = 0.0001; if (colSum[j] == 0) colSum[j] = 0.0001; } } double multidprime = 0; boolean noDivByZero = false; for (int i = 0; i < rowSum.length; i++){ for (int j = 0; j < colSum.length; j++){ double num = (multilocusTable[i][j]/multilocusTotal) - (rowSum[i]/multilocusTotal)*(colSum[j]/multilocusTotal); double denom; if (num < 0){ double denom1 = (rowSum[i]/multilocusTotal)*(colSum[j]/multilocusTotal); double denom2 = (1.0 - (rowSum[i]/multilocusTotal))*(1.0 - (colSum[j]/multilocusTotal)); if (denom1 < denom2) { denom = denom1; }else{ denom = denom2; } }else{ double denom1 = (rowSum[i]/multilocusTotal)*(1.0 -(colSum[j]/multilocusTotal)); double denom2 = (1.0 - (rowSum[i]/multilocusTotal))*(colSum[j]/multilocusTotal); if (denom1 < denom2){ denom = denom1; }else{ denom = denom2; } } if (denom != 0){ noDivByZero = true; multidprime += (rowSum[i]/multilocusTotal)*(colSum[j]/multilocusTotal)*Math.abs(num/denom); } } } if (noDivByZero){ multidprimeArray[gap] = multidprime; }else{ multidprimeArray[gap] = 1.00; } } return haplos; } |
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ | Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh, boolean crossover) throws HaploViewException{ | 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 ( dpTable.getLDStats(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; } //kirby patch EM theEM = new EM(chromosomes,numTrios); theEM.doEM(theBlock); int p = 0; Haplotype[] tempArray = new Haplotype[theEM.numHaplos()]; int[][] returnedHaplos = theEM.getHaplotypes(); double[] returnedFreqs = theEM.getFrequencies(); for (int i = 0; i < theEM.numHaplos(); i++){ int[] genos = new int[returnedHaplos[i].length]; for (int j = 0; j < genos.length; j++){ if (returnedHaplos[i][j] == 1){ genos[j] = Chromosome.getMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getMarker(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 //for markers with MAF close to 0.50 we can't use major/minor alleles to match //'em up 'cause these might change given missing data if (Chromosome.getMarker(selectedMarkers[currentClass]).getMAF() > 0.4){ for (int z = 0; z < chromosomes.size(); z++){ Chromosome thisChrom = (Chromosome)chromosomes.elementAt(z); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++z); int theGeno = thisChrom.getGenotype(selectedMarkers[currentClass]); int nextGeno = nextChrom.getGenotype(selectedMarkers[currentClass]); if (theGeno == nextGeno && theGeno == genos[indexIntoBlock] && thisChrom.getGenotype(preFiltBlock[q]) != 0){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(thisChrom.getGenotype(preFiltBlock[q]))); } } }else{ if (Chromosome.getMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getMarker(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 = returnedFreqs[i]; 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; } |
} if (!crossover){ haplotypes = 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 ( dpTable.getLDStats(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; } //kirby patch EM theEM = new EM(chromosomes,numTrios); theEM.doEM(theBlock); int p = 0; Haplotype[] tempArray = new Haplotype[theEM.numHaplos()]; int[][] returnedHaplos = theEM.getHaplotypes(); double[] returnedFreqs = theEM.getFrequencies(); for (int i = 0; i < theEM.numHaplos(); i++){ int[] genos = new int[returnedHaplos[i].length]; for (int j = 0; j < genos.length; j++){ if (returnedHaplos[i][j] == 1){ genos[j] = Chromosome.getMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getMarker(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 //for markers with MAF close to 0.50 we can't use major/minor alleles to match //'em up 'cause these might change given missing data if (Chromosome.getMarker(selectedMarkers[currentClass]).getMAF() > 0.4){ for (int z = 0; z < chromosomes.size(); z++){ Chromosome thisChrom = (Chromosome)chromosomes.elementAt(z); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++z); int theGeno = thisChrom.getGenotype(selectedMarkers[currentClass]); int nextGeno = nextChrom.getGenotype(selectedMarkers[currentClass]); if (theGeno == nextGeno && theGeno == genos[indexIntoBlock] && thisChrom.getGenotype(preFiltBlock[q]) != 0){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(thisChrom.getGenotype(preFiltBlock[q]))); } } }else{ if (Chromosome.getMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getMarker(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 = returnedFreqs[i]; 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; } |
|
PokeDBThread (SQLDatabase sd) { | PokeDBThread (SQLObject so) { | PokeDBThread (SQLDatabase sd) { super(); this.sd = sd; } |
this.sd = sd; | this.so = so; | PokeDBThread (SQLDatabase sd) { super(); this.sd = sd; } |
ArchitectUtils.pokeDatabase(sd); | ArchitectUtils.pokeDatabase(so); | public void run() { try { ArchitectUtils.pokeDatabase(sd); } catch (ArchitectException ex) { logger.error("problem poking database " + sd.getName(),ex); } logger.debug("finished poking database " + sd.getName()); } |
logger.error("problem poking database " + sd.getName(),ex); | logger.error("problem poking database " + so.getName(),ex); | public void run() { try { ArchitectUtils.pokeDatabase(sd); } catch (ArchitectException ex) { logger.error("problem poking database " + sd.getName(),ex); } logger.debug("finished poking database " + sd.getName()); } |
logger.debug("finished poking database " + sd.getName()); | logger.debug("finished poking database " + so.getName()); | public void run() { try { ArchitectUtils.pokeDatabase(sd); } catch (ArchitectException ex) { logger.error("problem poking database " + sd.getName(),ex); } logger.debug("finished poking database " + sd.getName()); } |
GraphApplet.this.repaint(); | public void run(){ while(true){ try { Thread.sleep(pollingInterval * 1000); } catch (InterruptedException e) { } /* get new data */ poll(); /* repaint */ GraphApplet.this.repaint(); } } |
|
if(output == null) return null; | private Properties getNewValues(){ String output = doHttpPost(); Properties properties = new Properties(); try { properties.load(new ByteArrayInputStream(output.getBytes())); } catch (IOException e) { throw new RuntimeException(e); } return properties; } |
|
if(properties == null) return; | private void poll() { Properties properties = getNewValues(); long timestamp = Long.parseLong(properties.getProperty("timestamp")); // todo: this is not used String attributes = properties.getProperty("attributes"); String values = properties.getProperty("values"); if(dataset == null){ dataset = new TimeSeriesCollection(); dataset.setDomainIsPointsInTime(false); StringTokenizer tokenizer = new StringTokenizer(displayNames, "|"); series = new TimeSeries[tokenizer.countTokens()]; for(int i=0; tokenizer.hasMoreTokens(); i++){ series[i] = new TimeSeries(tokenizer.nextToken(), Second.class); dataset.addSeries(series[i]); } } /* set the next set of values */ StringTokenizer tokenizer = new StringTokenizer(values, "|"); assert series.length == tokenizer.countTokens(); Second second = new Second(new Date(timestamp)); for(int i=0; i<series.length; i++){ double attrValue = Double.parseDouble(tokenizer.nextToken()); series[i].add(second, attrValue); } } |
|
EventSystem.getInstance().fireEvent(new ApplicationChangedEvent(config)); | public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { AccessController.checkAccess(context.getServiceContext(), ACL_EDIT_APPLICATIONS); ApplicationForm appForm = (ApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); if(appForm.getPort() != null) config.setPort(new Integer(appForm.getPort())); config.setURL(appForm.getURL()); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!ApplicationForm.FORM_PASSWORD.equals(password)){ config.setPassword(password); } Map<String, String> paramValues = config.getParamValues(); if(appForm.getJndiFactory() != null){ paramValues.put(ApplicationConfig.JNDI_FACTORY, appForm.getJndiFactory()); }else{ paramValues.remove(ApplicationConfig.JNDI_FACTORY); } if(appForm.getJndiURL() != null){ paramValues.put(ApplicationConfig.JNDI_URL, appForm.getJndiURL()); }else{ paramValues.remove(ApplicationConfig.JNDI_URL); } ApplicationConfigManager.updateApplication(config); /* update the AlertEngine */ AlertEngine.getInstance().updateApplication(config); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated application "+"\""+config.getName()+"\""); return mapping.findForward(Forwards.SUCCESS); } |
|
getBody().run(context, output); | invokeBody(output); | public void doTag(XMLOutput output) throws Exception { if ( var == null ) { var = "org.apache.commons.jelly.ojb.Broker"; } if ( broker != null ) { context.setVariable(var, broker); getBody().run(context, output); } else { broker = PersistenceBrokerFactory.createPersistenceBroker(); context.setVariable(var, broker); try { getBody().run(context, output); } finally { broker.clearCache(); PersistenceBrokerFactory.releaseInstance(broker); broker = null; context.removeVariable(var); } } } |
t.initFolders(); | t.initFolders(true); | public void actionPerformed(ActionEvent evt) { SQLTable t = new SQLTable(); t.initFolders(); t.setTableName("New_Table"); TablePane tp = new TablePane(t); pp.addFloating(tp); } |
String ident = logicalName.replace(' ','_').toUpperCase(); | String ident = logicalName.replace(' ','_'); | public String toIdentifier(String logicalName, String physicalName) { // replace spaces with underscores if (logicalName == null) return null; logger.debug("getting physical name for: " + logicalName); String ident = logicalName.replace(' ','_').toUpperCase(); logger.debug("after replace of spaces: " + ident); // see if it's a reserved word, and add something alpha to front if it is... if (isReservedWord(ident)) { ident = "X" + ident; logger.debug("identifier was reserved word, appending X: " + ident); } // replace anything that is not a letter, character, or underscore with an underscore... String tempString = ident; Pattern p2 = Pattern.compile("[^a-xA-Z0-9_@$#]"); Matcher m2 = p2.matcher(ident); while (m2.find()) { tempString = tempString.replace(m2.group(),"_"); } // first time through if (physicalName == null) { // length is ok if (ident.length() < 129) { return ident; } else { // length is too big logger.debug("truncating identifier: " + ident); String base = ident.substring(0,125); int tiebreaker = ((ident.hashCode() % 1000) + 1000) % 1000; logger.debug("new identifier: " + base + tiebreaker); return (base + tiebreaker); } } else { // back for more, which means that we probably // had a namespace conflict. Hack the ident down // to size if it's too big, and then generate // a hash tiebreaker using the ident and the // passed value physicalName logger.debug("physical identifier is not unique, regenerating: " + physicalName); String base = ident; if (ident.length() > 125) { base = ident.substring(0,125); } int tiebreaker = (((ident + physicalName).hashCode() % 1000) + 1000) % 1000; logger.debug("regenerated identifier is: " + (base + tiebreaker)); return (base + tiebreaker); } } |
String tempString = ident; Pattern p2 = Pattern.compile("[^a-xA-Z0-9_@$#]"); Matcher m2 = p2.matcher(ident); while (m2.find()) { tempString = tempString.replace(m2.group(),"_"); } | ident = ident.replaceAll("[^a-zA-Z0-9_@$#]", "_"); | public String toIdentifier(String logicalName, String physicalName) { // replace spaces with underscores if (logicalName == null) return null; logger.debug("getting physical name for: " + logicalName); String ident = logicalName.replace(' ','_').toUpperCase(); logger.debug("after replace of spaces: " + ident); // see if it's a reserved word, and add something alpha to front if it is... if (isReservedWord(ident)) { ident = "X" + ident; logger.debug("identifier was reserved word, appending X: " + ident); } // replace anything that is not a letter, character, or underscore with an underscore... String tempString = ident; Pattern p2 = Pattern.compile("[^a-xA-Z0-9_@$#]"); Matcher m2 = p2.matcher(ident); while (m2.find()) { tempString = tempString.replace(m2.group(),"_"); } // first time through if (physicalName == null) { // length is ok if (ident.length() < 129) { return ident; } else { // length is too big logger.debug("truncating identifier: " + ident); String base = ident.substring(0,125); int tiebreaker = ((ident.hashCode() % 1000) + 1000) % 1000; logger.debug("new identifier: " + base + tiebreaker); return (base + tiebreaker); } } else { // back for more, which means that we probably // had a namespace conflict. Hack the ident down // to size if it's too big, and then generate // a hash tiebreaker using the ident and the // passed value physicalName logger.debug("physical identifier is not unique, regenerating: " + physicalName); String base = ident; if (ident.length() > 125) { base = ident.substring(0,125); } int tiebreaker = (((ident + physicalName).hashCode() % 1000) + 1000) % 1000; logger.debug("regenerated identifier is: " + (base + tiebreaker)); return (base + tiebreaker); } } |
variables.put("context", this); variables.put("systemScope", System.getProperties()); } | variables.put("context",this); try { variables.put("systemScope", System.getProperties() ); } catch (SecurityException e) { } } | private void init() { variables.put("context", this); variables.put("systemScope", System.getProperties()); } |
if(parentGeno>=2 && kidsGeno>=1) tdtfams += parentGeno/2; | if(parentGeno>=2 && kidsGeno>=1){ if (parentGeno/2 > kidsGeno){ tdtfams += kidsGeno; }else{ tdtfams += parentGeno/2; } } | private int getNumOfFamTrio(Enumeration famList, Hashtable parentgeno, Hashtable kidgeno){ //int totalfams = 0; int tdtfams =0; while(famList.hasMoreElements()){ //totalfams++; int parentGeno=0, kidsGeno =0; String key = (String)famList.nextElement(); Integer pGeno = (Integer)parentgeno.get(key); Integer kGeno = (Integer)kidgeno.get(key); if(pGeno != null) parentGeno = pGeno.intValue(); if(kGeno != null) kidsGeno = kGeno.intValue(); if(parentGeno>=2 && kidsGeno>=1) tdtfams += parentGeno/2; } return tdtfams; } |
expandedFolders = new HashSet(); | public FolderController( PhotoInfo[] model ) { super( model ); addedToFolders = new HashSet(); removedFromFolders = new HashSet(); initTree(); } |
|
expandedFolders.add( folder ); | void addPhotoToTree( PhotoInfo photo ) { Collection folders = photo.getFolders(); Iterator iter = folders.iterator(); while ( iter.hasNext() ) { PhotoFolder folder = (PhotoFolder) iter.next(); FolderNode fn = (FolderNode) nodeMapper.mapFolderToNode( folder ); fn.addPhoto( photo ); } } |
|
expandedFolders.clear(); | public void setModel( Object[] model, boolean preserveState ) { this.model = model; if ( !preserveState && addedToFolders != null ) { addedToFolders.clear(); removedFromFolders.clear(); } initTree(); } |
|
expandTreePaths(); | public void updateAllViews() { Iterator iter = views.iterator(); while ( iter.hasNext() ) { PhotoInfoView view = (PhotoInfoView) iter.next(); view.setFolderTreeModel( treeModel ); } } |
|
this(s,include,exclude,ac,DEFAULT_RSQ_CUTOFF,AGGRESSIVE_TRIPLE); | this(s,include,exclude,ac,DEFAULT_RSQ_CUTOFF,AGGRESSIVE_TRIPLE, DEFAULT_MAXDIST); | public Tagger(Vector s, Vector include, Vector exclude, AlleleCorrelator ac){ this(s,include,exclude,ac,DEFAULT_RSQ_CUTOFF,AGGRESSIVE_TRIPLE); } |
if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(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)); } | public Vector findTags() { tags = new Vector(); untagged = new Vector(); taggedSoFar = 0; //potentialTagsHash stores the PotentialTag objects keyed on the corresponding sequences Hashtable potentialTagHash = 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) ) ){//|| (currentVarSeq instanceof SNP && ((SNP)currentVarSeq).getMAF() < .05))) { PotentialTag tempPT = new PotentialTag(currentVarSeq); for(int j=0;j<snps.size();j++) { if( getPairwiseCompRsq(currentVarSeq,(VariantSequence) snps.get(j)) >= minRSquared) { tempPT.addTagged((VariantSequence) snps.get(j)); } } potentialTagHash.put(currentVarSeq,tempPT); } } Vector sitesToCapture = (Vector) snps.clone(); Iterator potItr = sitesToCapture.iterator(); debugPrint("snps to tag: " + sitesToCapture.size()); Vector potentialTags = new Vector(potentialTagHash.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 && potentialTagHash.containsKey(variantSequence)) { includedPotentialTags.add((PotentialTag) potentialTagHash.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); Vector newlyTagged = addTag(curPT,potentialTagHash,sitesToCapture); countTagged += newlyTagged.size(); sitesToCapture.removeAll(newlyTagged); sitesToCapture.remove(curPT.sequence); } //loop until all snps are tagged while(sitesToCapture.size() > 0) { potentialTags = new Vector(potentialTagHash.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(); Vector newlyTagged = addTag(currentBestTag,potentialTagHash,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); } return new Vector(tags); } |
if(history == null){ if(logger.isLoggable(Level.INFO)){ logger.info("Added application " + appConfig.getName() + " to the downtimesMap."); } final long recordingSince = System.currentTimeMillis(); addApplicationToDB(appConfig.getApplicationId(), recordingSince); history = new ApplicationDowntimeHistory(recordingSince); downtimesMap.put(appConfig, history); } | assert history != null; | public ApplicationDowntimeHistory getDowntimeHistory(ApplicationConfig appConfig){ if(appConfig == null){ throw new NullPointerException("appConfig must be specified"); } ApplicationDowntimeHistory history = downtimesMap.get(appConfig); if(history == null){ /* it is an application that we are not aware of -- add it to the map */ if(logger.isLoggable(Level.INFO)){ logger.info("Added application " + appConfig.getName() + " to the downtimesMap."); } final long recordingSince = System.currentTimeMillis(); addApplicationToDB(appConfig.getApplicationId(), recordingSince); history = new ApplicationDowntimeHistory(recordingSince); downtimesMap.put(appConfig, history); } return history; } |
if(event instanceof NewApplicationEvent){ addApplication((NewApplicationEvent)event); return; } | public void handleEvent(EventObject event) { if(!(event instanceof ApplicationEvent)){ throw new IllegalArgumentException("event must of type ApplicationEvent"); } ApplicationEvent appEvent = (ApplicationEvent)event; ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(appEvent.getApplicationConfig()); assert downtimeHistory != null; if(appEvent instanceof ApplicationUpEvent){ // application must have went down earlier assert downtimeHistory.getDowntimeBegin() != null; // log the downtime to the db recordDowntime(appEvent.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), appEvent.getTime()); downtimeHistory.applicationCameUp(appEvent.getTime()); }else if(event instanceof ApplicationDownEvent){ downtimeHistory.applicationWentDown(appEvent.getTime()); } } |
|
if (lowCI > FindBlocks.cutLowCI && highCI >= FindBlocks.cutHighCI) { | if (lowCI >= FindBlocks.cutLowCI && highCI >= FindBlocks.cutHighCI) { | public void colorDPrime(int scheme){ PairwiseLinkage dPrime[][] = theData.filteredDPrimeTable; if (scheme == STD_SCHEME){ // set coloring based on LOD and D' for (int i = 0; i < dPrime.length; i++){ for (int j = i+1; j < dPrime[i].length; j++){ PairwiseLinkage thisPair = dPrime[i][j]; if (thisPair == null){ continue; } double d = thisPair.getDPrime(); double l = thisPair.getLOD(); Color boxColor = null; if (l > 2) { if (d < 0.5) { //high LOD, low D' boxColor = new Color(255, 224, 224); } else { //high LOD, high D' shades of red double blgr = (255-32)*2*(1-d); boxColor = new Color(255, (int) blgr, (int) blgr); //boxColor = new Color(224, (int) blgr, (int) blgr); } } else if (d > 0.99) { //high D', low LOD blueish color boxColor = new Color(192, 192, 240); } else { //no LD boxColor = Color.white; } thisPair.setColor(boxColor); } } }else if (scheme == SFS_SCHEME){ for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null){ continue; } //get the right bits double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); //color in squares if (lowCI > FindBlocks.cutLowCI && highCI >= FindBlocks.cutHighCI) { thisPair.setColor(Color.darkGray); //strong LD }else if (highCI > FindBlocks.recHighCI) { thisPair.setColor(Color.lightGray); //uninformative } else { thisPair.setColor(Color.white); //recomb } } } }else if (scheme == GAM_SCHEME){ for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null) { continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > FindBlocks.fourGameteCutoff) numGam++; } //color in squares if(numGam > 3){ thisPair.setColor(Color.white); }else{ thisPair.setColor(Color.darkGray); } } } } currentScheme = scheme; } |
}else if (highCI > FindBlocks.recHighCI) { | }else if (highCI >= FindBlocks.recHighCI) { | public void colorDPrime(int scheme){ PairwiseLinkage dPrime[][] = theData.filteredDPrimeTable; if (scheme == STD_SCHEME){ // set coloring based on LOD and D' for (int i = 0; i < dPrime.length; i++){ for (int j = i+1; j < dPrime[i].length; j++){ PairwiseLinkage thisPair = dPrime[i][j]; if (thisPair == null){ continue; } double d = thisPair.getDPrime(); double l = thisPair.getLOD(); Color boxColor = null; if (l > 2) { if (d < 0.5) { //high LOD, low D' boxColor = new Color(255, 224, 224); } else { //high LOD, high D' shades of red double blgr = (255-32)*2*(1-d); boxColor = new Color(255, (int) blgr, (int) blgr); //boxColor = new Color(224, (int) blgr, (int) blgr); } } else if (d > 0.99) { //high D', low LOD blueish color boxColor = new Color(192, 192, 240); } else { //no LD boxColor = Color.white; } thisPair.setColor(boxColor); } } }else if (scheme == SFS_SCHEME){ for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null){ continue; } //get the right bits double lowCI = thisPair.getConfidenceLow(); double highCI = thisPair.getConfidenceHigh(); //color in squares if (lowCI > FindBlocks.cutLowCI && highCI >= FindBlocks.cutHighCI) { thisPair.setColor(Color.darkGray); //strong LD }else if (highCI > FindBlocks.recHighCI) { thisPair.setColor(Color.lightGray); //uninformative } else { thisPair.setColor(Color.white); //recomb } } } }else if (scheme == GAM_SCHEME){ for (int x = 0; x < dPrime.length-1; x++){ for (int y = x+1; y < dPrime.length; y++){ PairwiseLinkage thisPair = dPrime[x][y]; if (thisPair == null) { continue; } double[] freqs = thisPair.getFreqs(); int numGam = 0; for (int i = 0; i < freqs.length; i++){ if (freqs[i] > FindBlocks.fourGameteCutoff) numGam++; } //color in squares if(numGam > 3){ thisPair.setColor(Color.white); }else{ thisPair.setColor(Color.darkGray); } } } } currentScheme = scheme; } |
public void handleEvent(Event event) { if(sourceConfig.getApplicationConfig().equals(event.getApplicationConfig()) && event instanceof ApplicationDownEvent){ | public void handleEvent(EventObject event) { if(event instanceof ApplicationDownEvent && sourceConfig.getApplicationConfig().equals( ((ApplicationDownEvent)event).getApplicationConfig())){ | public void handleEvent(Event event) { if(sourceConfig.getApplicationConfig().equals(event.getApplicationConfig()) && event instanceof ApplicationDownEvent){ handler.handle(new AlertInfo()); } } |
ApplicationDowntimeService.getInstance().addListener(new ApplicationDowntimeEventListener()); | EventSystem.getInstance().addListener(new ApplicationDowntimeEventListener(), ApplicationDownEvent.class); | public void register(AlertHandler handler, String alertId, String alertName) { this.handler = handler; ApplicationDowntimeService.getInstance().addListener(new ApplicationDowntimeEventListener()); } |
xmlWriter.setEscapeText(isEscapeText()); | protected XMLOutput createXMLOutput(Writer writer) throws Exception { OutputFormat format = null; if (prettyPrint) { format = OutputFormat.createPrettyPrint(); } else { format = new OutputFormat(); } if ( encoding != null ) { format.setEncoding( encoding ); } if ( omitXmlDeclaration ) { format.setSuppressDeclaration(true); } boolean isHtml = outputMode != null && outputMode.equalsIgnoreCase( "html" ); final XMLWriter xmlWriter = (isHtml) ? new HTMLWriter(writer, format) : new XMLWriter(writer, format); XMLOutput answer = new XMLOutput() { public void close() throws IOException { xmlWriter.close(); } }; answer.setContentHandler(xmlWriter); answer.setLexicalHandler(xmlWriter); return answer; } |
|
UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(user.getUsername()); if(!user.getPassword().equals(completeUser.getPassword()) || !User.STATUS_ACTIVE.equals(completeUser.getStatus())){ throw new RuntimeException("Invalid user credentials."); | AuthService authService = ServiceFactory.getAuthService(); try { authService.login(context, user.getUsername(), user._getPlaintextPassword()); } catch (Exception e) { throw new RuntimeException(e); | private static void authenticate(ServiceContextImpl context, String className, String methodName){ User user = context.getUser(); if(user == null){ /* only the login method in AuthService is allowed without authentication */ if(!className.equals(AuthService.class.getName()) || !methodName.equals("login")){ throw new RuntimeException("Service method called without " + "User credentials"); } return; } /* User must have username and password specified */ assert user.getUsername() != null; assert user.getPassword() != null; UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(user.getUsername()); /* validate password */ if(!user.getPassword().equals(completeUser.getPassword()) || !User.STATUS_ACTIVE.equals(completeUser.getStatus())){ throw new RuntimeException("Invalid user credentials."); } context.setUser(completeUser); } |
context.setUser(completeUser); | private static void authenticate(ServiceContextImpl context, String className, String methodName){ User user = context.getUser(); if(user == null){ /* only the login method in AuthService is allowed without authentication */ if(!className.equals(AuthService.class.getName()) || !methodName.equals("login")){ throw new RuntimeException("Service method called without " + "User credentials"); } return; } /* User must have username and password specified */ assert user.getUsername() != null; assert user.getPassword() != null; UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(user.getUsername()); /* validate password */ if(!user.getPassword().equals(completeUser.getPassword()) || !User.STATUS_ACTIVE.equals(completeUser.getStatus())){ throw new RuntimeException("Invalid user credentials."); } context.setUser(completeUser); } |
|
if( ! (curFam.containsKey(currentInd.getDadID()))) { | if( !currentInd.getDadID().equals("0") && ! (curFam.containsKey(currentInd.getDadID()))) { | 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()); } 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( ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } } |
if(! (curFam.containsKey(currentInd.getMomID()))) { | if(!currentInd.getMomID().equals("0") && ! (curFam.containsKey(currentInd.getMomID()))) { | 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()); } 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( ! (curFam.containsKey(currentInd.getDadID()))) { currentInd.setDadID("0"); bogusParents = true; } if(! (curFam.containsKey(currentInd.getMomID()))) { currentInd.setMomID("0"); bogusParents = true; } } } |
public void clearDriverJarList() { driverJarList.clear(); } | public void clearDriverJarList(); | public void clearDriverJarList() { driverJarList.clear(); } |
public boolean removeDriverJar(String fullPath) { return driverJarList.remove(fullPath); } | public boolean removeDriverJar(String fullPath); | public boolean removeDriverJar(String fullPath) { return driverJarList.remove(fullPath); } |
return date; | return date != null ? (Date)date.clone() : null; | public Date getDate() { return date; } |
private void createDatabase() { | private boolean createDatabase() { | private void createDatabase() { // Ask for the admin password PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { // Creating an embedded database db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); } db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); JOptionPane.showMessageDialog( this, "Database " + nameFld.getText() + " created successfully", "Database created", JOptionPane.INFORMATION_MESSAGE ); } |
PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); | try { PVDatabase db = new PVDatabase(); db.setName( nameFld.getText() ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); | private void createDatabase() { // Ask for the admin password PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { // Creating an embedded database db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); } db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); JOptionPane.showMessageDialog( this, "Database " + nameFld.getText() + " created successfully", "Database created", JOptionPane.INFORMATION_MESSAGE ); } |
db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); | db.createDatabase( user, passwd ); settings.saveConfig(); } catch (PhotovaultException ex) { JOptionPane.showMessageDialog( this, ex.getMessage(), "Error creating database", JOptionPane.ERROR_MESSAGE ); return false; | private void createDatabase() { // Ask for the admin password PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { // Creating an embedded database db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); } db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); JOptionPane.showMessageDialog( this, "Database " + nameFld.getText() + " created successfully", "Database created", JOptionPane.INFORMATION_MESSAGE ); } |
db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); | private void createDatabase() { // Ask for the admin password PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { // Creating an embedded database db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); } db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); JOptionPane.showMessageDialog( this, "Database " + nameFld.getText() + " created successfully", "Database created", JOptionPane.INFORMATION_MESSAGE ); } |
|
return true; | private void createDatabase() { // Ask for the admin password PVDatabase db = new PVDatabase(); String user = ""; String passwd = ""; if ( dbServerBtn.isSelected() ) { AdminLoginDlg loginDlg = new AdminLoginDlg( this, true ); if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) { user = loginDlg.getUsername(); passwd = loginDlg.getPasswd(); } db.setDbName( dbNameFld.getText() ); db.setDbHost( dbHostFld.getText() ); db.setName( nameFld.getText() ); Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() ); db.addVolume( vol ); } else { // Creating an embedded database db.setName( nameFld.getText() ); db.setInstanceType( PVDatabase.TYPE_EMBEDDED ); db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) ); } db.createDatabase( user, passwd ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); settings.addDatabase( db ); settings.saveConfig(); JOptionPane.showMessageDialog( this, "Database " + nameFld.getText() + " created successfully", "Database created", JOptionPane.INFORMATION_MESSAGE ); } |
|
String componentDisplay = component.draw(new DashboardContextImpl(context, | String componentDisplay = component.draw(new DashboardContextImpl(context, currentDashboardConfig, | public int doStartTag() throws JspException{ HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); WebContext context = null; try{ context = WebContext.get(request); ApplicationConfig appConfig = context.getApplicationConfig(); // Graphs at cluster level are not supported yet assert !appConfig.isCluster(); String dashboardId = request.getParameter("dashBID"); DashboardConfig currentDashboardConfig = DashboardRepository.getInstance().get(dashboardId); assert currentDashboardConfig != null : "Error retrieving dashboard details"; DashboardComponent component = currentDashboardConfig.getComponents().get(getId()); String componentDisplay = component.draw(new DashboardContextImpl(context, (HttpServletRequest)pageContext.getRequest())); componentDisplay = MessageFormat.format(componentDisplay, getWidth(), getHeight(), Utils.getCookieValue(request, "JSESSIONID")); pageContext.getOut().println(componentDisplay); }catch(Throwable e){ logger.log(Level.SEVERE, "Error displaying component", e); }finally{ if(context != null) context.releaseResources(); } return SKIP_BODY; } |
if (catalogTerm == null) { | if (getCatalogTerm() == null) { | public String getCatalogSeparator() throws SQLException { if (catalogTerm == null) { throw new SQLException("Catalogs are not supported"); } else { return "."; } } |
if (logger.isDebugEnabled()) logger.debug("getCatalogs: added '"+catName+"'"); | public ResultSet getCatalogs() throws SQLException { String catalogList = connection.getProperties().getProperty("catalogs"); MockJDBCResultSet rs = new MockJDBCResultSet(null, 1); rs.setColumnName(1, "TABLE_CAT"); if (getCatalogTerm() != null) { for (String catName : Arrays.asList(catalogList.split(","))) { rs.addRow(); rs.updateObject(1, catName); } } rs.beforeFirst(); return rs; } |
|
return null; | MockJDBCResultSet rs = new MockJDBCResultSet(null, 22); rs.setColumnName(1, "TABLE_CAT"); rs.setColumnName(2, "TABLE_SCHEM"); rs.setColumnName(3, "TABLE_NAME"); rs.setColumnName(4, "COLUMN_NAME"); rs.setColumnName(5, "DATA_TYPE"); rs.setColumnName(6, "TYPE_NAME"); rs.setColumnName(7, "COLUMN_SIZE"); rs.setColumnName(8, "BUFFER_LENGTH"); rs.setColumnName(9, "DECIMAL_DIGITS"); rs.setColumnName(10, "NUM_PREC_RADIX"); rs.setColumnName(11, "NULLABLE"); rs.setColumnName(12, "REMARKS"); rs.setColumnName(13, "COLUMN_DEF"); rs.setColumnName(14, "SQL_DATA_TYPE"); rs.setColumnName(15, "SQL_DATETIME_SUB"); rs.setColumnName(16, "CHAR_OCTET_LENGTH"); rs.setColumnName(17, "ORDINAL_POSITION"); rs.setColumnName(18, "IS_NULLABLE"); rs.setColumnName(19, "SCOPE_CATLOG"); rs.setColumnName(20, "SCOPE_SCHEMA"); rs.setColumnName(21, "SCOPE_TABLE"); rs.setColumnName(22, "SOURCE_DATA_TYPE"); return rs; | public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } |
throw new UnsupportedOperationException("Not implemented"); | MockJDBCResultSet rs = new MockJDBCResultSet(null, 14); rs.setColumnName(1, "PKTABLE_CAT"); rs.setColumnName(2, "PKTABLE_SCHEM"); rs.setColumnName(3, "PKTABLE_NAME"); rs.setColumnName(4, "PKCOLUMN_NAME"); rs.setColumnName(5, "FKTABLE_CAT"); rs.setColumnName(6, "FKTABLE_SCHEM"); rs.setColumnName(7, "FKTABLE_NAME"); rs.setColumnName(8, "FKCOLUMN_NAME"); rs.setColumnName(9, "KEY_SEQ"); rs.setColumnName(10, "UPDATE_RULE"); rs.setColumnName(11, "DELETE_RULE"); rs.setColumnName(12, "FK_NAME"); rs.setColumnName(13, "PK_NAME"); rs.setColumnName(14, "DEFERRABILITY"); return rs; | public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException { throw new UnsupportedOperationException("Not implemented"); } |
throw new UnsupportedOperationException("Not implemented"); | MockJDBCResultSet rs = new MockJDBCResultSet(null, 14); rs.setColumnName(1, "PKTABLE_CAT"); rs.setColumnName(2, "PKTABLE_SCHEM"); rs.setColumnName(3, "PKTABLE_NAME"); rs.setColumnName(4, "PKCOLUMN_NAME"); rs.setColumnName(5, "FKTABLE_CAT"); rs.setColumnName(6, "FKTABLE_SCHEM"); rs.setColumnName(7, "FKTABLE_NAME"); rs.setColumnName(8, "FKCOLUMN_NAME"); rs.setColumnName(9, "KEY_SEQ"); rs.setColumnName(10, "UPDATE_RULE"); rs.setColumnName(11, "DELETE_RULE"); rs.setColumnName(12, "FK_NAME"); rs.setColumnName(13, "PK_NAME"); rs.setColumnName(14, "DEFERRABILITY"); return rs; | public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { throw new UnsupportedOperationException("Not implemented"); } |
throw new UnsupportedOperationException("Not implemented"); | MockJDBCResultSet rs = new MockJDBCResultSet(null, 6); rs.setColumnName(1, "TABLE_CAT"); rs.setColumnName(2, "TABLE_SCHEM"); rs.setColumnName(3, "TABLE_NAME"); rs.setColumnName(4, "COLUMN_NAME"); rs.setColumnName(5, "KEY_SEQ"); rs.setColumnName(6, "PK_NAME"); return rs; | public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { throw new UnsupportedOperationException("Not implemented"); } |
logger.debug("getSchemas: schemaTerm==null; returning empty result set"); | public ResultSet getSchemas() throws SQLException { String catalogList = connection.getProperties().getProperty("catalogs"); MockJDBCResultSet rs = new MockJDBCResultSet(null, 2); rs.setColumnName(1, "TABLE_SCHEM"); rs.setColumnName(2, "TABLE_CATALOG"); if (getSchemaTerm() == null) { // no schemas. return empty rs } else if (getCatalogTerm() == null) { // database has schemas but not catalogs String schemaList = connection.getProperties().getProperty("schemas"); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, null); rs.updateObject(2, schName); } } else { // database has catalogs and schemas for (String catName : Arrays.asList(catalogList.split(","))) { String schemaList = connection.getProperties().getProperty("schemas."+catName); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, catName); rs.updateObject(2, schName); } } } rs.beforeFirst(); return rs; } |
|
rs.updateObject(1, null); rs.updateObject(2, schName); | rs.updateObject(1, schName); rs.updateObject(2, null); if (logger.isDebugEnabled()) logger.debug("getSchemas: added '"+schName+"'"); | public ResultSet getSchemas() throws SQLException { String catalogList = connection.getProperties().getProperty("catalogs"); MockJDBCResultSet rs = new MockJDBCResultSet(null, 2); rs.setColumnName(1, "TABLE_SCHEM"); rs.setColumnName(2, "TABLE_CATALOG"); if (getSchemaTerm() == null) { // no schemas. return empty rs } else if (getCatalogTerm() == null) { // database has schemas but not catalogs String schemaList = connection.getProperties().getProperty("schemas"); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, null); rs.updateObject(2, schName); } } else { // database has catalogs and schemas for (String catName : Arrays.asList(catalogList.split(","))) { String schemaList = connection.getProperties().getProperty("schemas."+catName); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, catName); rs.updateObject(2, schName); } } } rs.beforeFirst(); return rs; } |
logger.debug("getSchemas: database has catalogs and schemas!"); | public ResultSet getSchemas() throws SQLException { String catalogList = connection.getProperties().getProperty("catalogs"); MockJDBCResultSet rs = new MockJDBCResultSet(null, 2); rs.setColumnName(1, "TABLE_SCHEM"); rs.setColumnName(2, "TABLE_CATALOG"); if (getSchemaTerm() == null) { // no schemas. return empty rs } else if (getCatalogTerm() == null) { // database has schemas but not catalogs String schemaList = connection.getProperties().getProperty("schemas"); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, null); rs.updateObject(2, schName); } } else { // database has catalogs and schemas for (String catName : Arrays.asList(catalogList.split(","))) { String schemaList = connection.getProperties().getProperty("schemas."+catName); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, catName); rs.updateObject(2, schName); } } } rs.beforeFirst(); return rs; } |
|
rs.updateObject(1, catName); rs.updateObject(2, schName); | rs.updateObject(1, schName); rs.updateObject(2, catName); if (logger.isDebugEnabled()) logger.debug("getSchemas: added '"+catName+"'.'"+schName+"'"); | public ResultSet getSchemas() throws SQLException { String catalogList = connection.getProperties().getProperty("catalogs"); MockJDBCResultSet rs = new MockJDBCResultSet(null, 2); rs.setColumnName(1, "TABLE_SCHEM"); rs.setColumnName(2, "TABLE_CATALOG"); if (getSchemaTerm() == null) { // no schemas. return empty rs } else if (getCatalogTerm() == null) { // database has schemas but not catalogs String schemaList = connection.getProperties().getProperty("schemas"); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, null); rs.updateObject(2, schName); } } else { // database has catalogs and schemas for (String catName : Arrays.asList(catalogList.split(","))) { String schemaList = connection.getProperties().getProperty("schemas."+catName); for (String schName : Arrays.asList(schemaList.split(","))) { rs.addRow(); rs.updateObject(1, catName); rs.updateObject(2, schName); } } } rs.beforeFirst(); return rs; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.