rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
|
tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); | if (null == this.getXslt()) { throw new IllegalArgumentException("The xslt attribute cannot be null"); } | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
DocumentSource xmlDocSource = new DocumentSource(xmlDocument); | this.tf.setURIResolver(createURIResolver()); this.transformerHandler = this.tf.newTransformerHandler(this.getObjAsSAXSource(this.getXslt())); | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
String var = getVar(); if (var == null) { | this.doNestedParamTag(output); XMLReader xmlReader = this.createXMLReader(); xmlReader.setContentHandler(this.transformerHandler); xmlReader.setProperty(LEXICAL_HANDLER_PROPERTY, this.transformerHandler); String varName = this.getVar(); if (null == varName) { | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); | this.transformerHandler.setResult(this.createSAXResult(output)); xmlReader.parse(this.getXMLInputSource()); | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
transformer.transform(xmlDocSource, result); | this.transformerHandler.setResult(result); xmlReader.parse(this.getXMLInputSource()); | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
context.setVariable(var, transformedDoc); | this.context.setVariable(varName, transformedDoc); | public void doTag(XMLOutput output) throws Exception { Document xmlDocument = this.getXmlDocument(output); Document xslDocument = this.parse(this.xsl); tf.setURIResolver(createURIResolver()); Transformer transformer = tf.newTransformer(new DocumentSource(xslDocument)); DocumentSource xmlDocSource = new DocumentSource(xmlDocument); String var = getVar(); if (var == null) { // pass the result of the transform out as SAX events Result result = createSAXResult(output); transformer.transform(xmlDocSource, result); } else { DocumentResult result = new DocumentResult(); transformer.transform(xmlDocSource, result); // output the result as a variable Document transformedDoc = result.getDocument(); context.setVariable(var, transformedDoc); } } |
fc.setSelectedFile(null); | void doExportDPrime(){ int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ try { int scaleSize = theData.dPrimeTable.length*30; DrawingMethods dm = new DrawingMethods(); BufferedImage image = new BufferedImage(scaleSize, scaleSize, BufferedImage.TYPE_3BYTE_BGR); dm.dPrimeDraw(theData.dPrimeTable, infoKnown, theData.markerInfo, image.getGraphics()); dm.saveImage(image, fc.getSelectedFile().getPath()); } catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } } |
|
String saveDprimeName = infileName + ".LDout"; new TextMethods().saveDprimeToText(theData.dPrimeTable, saveDprimeName); | fc.setSelectedFile(null); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { new TextMethods().saveDprimeToText(theData.dPrimeTable, fc.getSelectedFile()); } | void saveDprimeToText(){ try{ String saveDprimeName = infileName + ".LDout"; new TextMethods().saveDprimeToText(theData.dPrimeTable, saveDprimeName); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } |
fc.setSelectedFile(null); | void saveHapsPic(){ int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION){ try { DrawingMethods dm = new DrawingMethods(); BufferedImage testImage = new BufferedImage(10,10,BufferedImage.TYPE_3BYTE_BGR); Dimension theSize = dm.haploGetPreferredSize(finishedHaplos, testImage.getGraphics()); BufferedImage image = new BufferedImage((int)theSize.getWidth(),(int)theSize.getHeight(),BufferedImage.TYPE_3BYTE_BGR); dm.haploDraw(image.getGraphics(), useThickness, colorThresh, crossThinThresh, crossThickThresh, theData.getMultiDprime() ,finishedHaplos); dm.saveImage(image, fc.getSelectedFile().getPath()); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } } |
|
File currentDir = new File(System.getProperty("user.dir")); int highCount = 0; String[] filez = currentDir.list(); for (int i = 0; i < filez.length; i++){ if (filez[i].startsWith("haptxt")){ if (filez[i].endsWith(infileName)){ int thisInt = Integer.parseInt(filez[i].substring(6,8)); if (thisInt > highCount){ highCount = thisInt; } } | try{ fc.setSelectedFile(null); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { new TextMethods().saveHapsToText(finishedHaplos, fc.getSelectedFile()); | void saveHapsToText(){ //first we see what files are in this directory File currentDir = new File(System.getProperty("user.dir")); int highCount = 0; String[] filez = currentDir.list(); for (int i = 0; i < filez.length; i++){ if (filez[i].startsWith("haptxt")){ if (filez[i].endsWith(infileName)){ //get counter number for this file int thisInt = Integer.parseInt(filez[i].substring(6,8)); if (thisInt > highCount){ highCount = thisInt; } } } } //put together various pieces to create filename for output String saveName = "haptxt"; if (highCount < 9) saveName += "0"; saveName += (highCount+1); saveName += "."; saveName += infileName; try{ new TextMethods().saveHapsToText(finishedHaplos, saveName); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } |
} String saveName = "haptxt"; if (highCount < 9) saveName += "0"; saveName += (highCount+1); saveName += "."; saveName += infileName; try{ new TextMethods().saveHapsToText(finishedHaplos, saveName); | void saveHapsToText(){ //first we see what files are in this directory File currentDir = new File(System.getProperty("user.dir")); int highCount = 0; String[] filez = currentDir.list(); for (int i = 0; i < filez.length; i++){ if (filez[i].startsWith("haptxt")){ if (filez[i].endsWith(infileName)){ //get counter number for this file int thisInt = Integer.parseInt(filez[i].substring(6,8)); if (thisInt > highCount){ highCount = thisInt; } } } } //put together various pieces to create filename for output String saveName = "haptxt"; if (highCount < 9) saveName += "0"; saveName += (highCount+1); saveName += "."; saveName += infileName; try{ new TextMethods().saveHapsToText(finishedHaplos, saveName); }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } |
|
if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); } | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command==RAW_DATA){ load(PED); }else if (command == PHASED_DATA){ load(HAPS); }else if (command == HAPMAP_DATA){ load(HMP); }else if (command == BROWSE_GENO){ browse(GENO); }else if (command == BROWSE_INFO){ browse(INFO); }else if (command == "OK"){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ caller.assocTest = 1; } else { caller.assocTest = 2; } }else{ caller.assocTest = 0; } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; caller.readGenotypes(returnStrings, fileType); if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); } if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); } this.dispose(); }else if (command == "Cancel"){ this.dispose(); }else if (command == "tdt"){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
|
if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); } | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command==RAW_DATA){ load(PED); }else if (command == PHASED_DATA){ load(HAPS); }else if (command == HAPMAP_DATA){ load(HMP); }else if (command == BROWSE_GENO){ browse(GENO); }else if (command == BROWSE_INFO){ browse(INFO); }else if (command == "OK"){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ caller.assocTest = 1; } else { caller.assocTest = 2; } }else{ caller.assocTest = 0; } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; caller.readGenotypes(returnStrings, fileType); if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); } if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); } this.dispose(); }else if (command == "Cancel"){ this.dispose(); }else if (command == "tdt"){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
|
if ( isTrim() && ! hasTrimmed ) { trimBody(); } | public Script getBody() { if ( isTrim() && ! hasTrimmed ) { trimBody(); } return body; } |
|
getBody().run(context, XMLOutput.createXMLOutput(writer)); | invokeBody(XMLOutput.createXMLOutput(writer)); | protected String getBodyText() throws Exception { // XXX: could maybe optimise this later on by having a pool of buffers StringWriter writer = new StringWriter(); getBody().run(context, XMLOutput.createXMLOutput(writer)); return writer.toString(); } |
getBody().run(context, output); | if ( isTrim() && ! hasTrimmed ) { trimBody(); } invokeBody(output); | protected void invokeBody(XMLOutput output) throws Exception { getBody().run(context, output); } |
if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ | if(Chromosome.getDataChrom().equalsIgnoreCase("chrx") && currentInd.getGender()==1){ | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); int[] founderHomCount = new int[5]; Vector mendels = new Vector(); 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()); allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,1); //if haploid, check for male hets if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ if(allele1 != allele2) { currentInd.zeroOutMarker(loc); pedFile.setHaploidHets(true); } } //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 int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,0); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,1); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,0); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,1); if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ //this is an x chrom for a male, so the only thing we need to check is if //allele1 matches either momallele1 or momallele2 if(allele1 != momAllele1 && allele1 != momAllele2) { mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else { //if gender is anything except 1 we assume female if(momAllele1 == momAllele2) { //mom hom and dad matches mom if(dadAllele1 == momAllele1) { //kid must be hom same allele if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ //mom het,so only need to check that at least one allele matches dad if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } } }else{ //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 ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,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 != 9){ //value of 9 means an 'h' allele for haps files... count[allele1]++; } if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2 || allele1 == 9 || allele2 == 9) { founderHetCount++; }else{ founderHomCount[allele1]++; } if(allele2 != 9){ 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 (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 == allele2) { hom++; }else { het++; } }else{ haploid++; } } //missing data else missing++; } currentFamily.setMendErrs(mendErrNum); } 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]; String minorAllele, majorAllele; if (freqStuff[2] == 1){ minorAllele = "A"; }else if (freqStuff[2] == 2){ minorAllele = "C"; }else if (freqStuff[2] == 3){ minorAllele = "G"; }else{ minorAllele = "T"; } if (freqStuff[3] == 1){ majorAllele = "A"; }else if (freqStuff[3] == 2){ majorAllele = "C"; }else if (freqStuff[3] == 3){ majorAllele = "G"; }else{ majorAllele = "T"; } //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, haploid, 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); if (mendErrNum > 0 && !pedFile.getMendelsExist()){ pedFile.setMendelsExist(true); } result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setMinorAllele(minorAllele); result.setMajorAllele(majorAllele); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setMendelErrors(mendels); return result; } |
if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ | if(Chromosome.getDataChrom().equalsIgnoreCase("chrx")){ if (dadAllele1 != dadAllele2){ dadAllele1 = 0; dadAllele2 = 0; } if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ if(currentInd.getGender() == 1) { | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); int[] founderHomCount = new int[5]; Vector mendels = new Vector(); 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()); allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,1); //if haploid, check for male hets if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ if(allele1 != allele2) { currentInd.zeroOutMarker(loc); pedFile.setHaploidHets(true); } } //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 int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,0); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,1); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,0); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,1); if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ //this is an x chrom for a male, so the only thing we need to check is if //allele1 matches either momallele1 or momallele2 if(allele1 != momAllele1 && allele1 != momAllele2) { mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else { //if gender is anything except 1 we assume female if(momAllele1 == momAllele2) { //mom hom and dad matches mom if(dadAllele1 == momAllele1) { //kid must be hom same allele if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ //mom het,so only need to check that at least one allele matches dad if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } } }else{ //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 ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,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 != 9){ //value of 9 means an 'h' allele for haps files... count[allele1]++; } if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2 || allele1 == 9 || allele2 == 9) { founderHetCount++; }else{ founderHomCount[allele1]++; } if(allele2 != 9){ 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 (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 == allele2) { hom++; }else { het++; } }else{ haploid++; } } //missing data else missing++; } currentFamily.setMendErrs(mendErrNum); } 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]; String minorAllele, majorAllele; if (freqStuff[2] == 1){ minorAllele = "A"; }else if (freqStuff[2] == 2){ minorAllele = "C"; }else if (freqStuff[2] == 3){ minorAllele = "G"; }else{ minorAllele = "T"; } if (freqStuff[3] == 1){ majorAllele = "A"; }else if (freqStuff[3] == 2){ majorAllele = "C"; }else if (freqStuff[3] == 3){ majorAllele = "G"; }else{ majorAllele = "T"; } //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, haploid, 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); if (mendErrNum > 0 && !pedFile.getMendelsExist()){ pedFile.setMendelsExist(true); } result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setMinorAllele(minorAllele); result.setMajorAllele(majorAllele); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setMendelErrors(mendels); return result; } |
} }else { if(momAllele1 == momAllele2) { if(dadAllele1 == momAllele1) { if(allele1 != momAllele1 || allele2 != momAllele2){ | }else { if(momAllele1 == momAllele2) { if(dadAllele1 == momAllele1) { if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ if(allele1 != dadAllele1 && allele2 != dadAllele1){ | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); int[] founderHomCount = new int[5]; Vector mendels = new Vector(); 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()); allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,1); //if haploid, check for male hets if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ if(allele1 != allele2) { currentInd.zeroOutMarker(loc); pedFile.setHaploidHets(true); } } //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 int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,0); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,1); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,0); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,1); if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ //this is an x chrom for a male, so the only thing we need to check is if //allele1 matches either momallele1 or momallele2 if(allele1 != momAllele1 && allele1 != momAllele2) { mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else { //if gender is anything except 1 we assume female if(momAllele1 == momAllele2) { //mom hom and dad matches mom if(dadAllele1 == momAllele1) { //kid must be hom same allele if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ //mom het,so only need to check that at least one allele matches dad if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } } }else{ //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 ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,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 != 9){ //value of 9 means an 'h' allele for haps files... count[allele1]++; } if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2 || allele1 == 9 || allele2 == 9) { founderHetCount++; }else{ founderHomCount[allele1]++; } if(allele2 != 9){ 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 (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 == allele2) { hom++; }else { het++; } }else{ haploid++; } } //missing data else missing++; } currentFamily.setMendErrs(mendErrNum); } 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]; String minorAllele, majorAllele; if (freqStuff[2] == 1){ minorAllele = "A"; }else if (freqStuff[2] == 2){ minorAllele = "C"; }else if (freqStuff[2] == 3){ minorAllele = "G"; }else{ minorAllele = "T"; } if (freqStuff[3] == 1){ majorAllele = "A"; }else if (freqStuff[3] == 2){ majorAllele = "C"; }else if (freqStuff[3] == 3){ majorAllele = "G"; }else{ majorAllele = "T"; } //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, haploid, 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); if (mendErrNum > 0 && !pedFile.getMendelsExist()){ pedFile.setMendelsExist(true); } result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setMinorAllele(minorAllele); result.setMajorAllele(majorAllele); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setMendelErrors(mendels); return result; } |
}else { if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); int[] founderHomCount = new int[5]; Vector mendels = new Vector(); 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()); allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,1); //if haploid, check for male hets if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ if(allele1 != allele2) { currentInd.zeroOutMarker(loc); pedFile.setHaploidHets(true); } } //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 int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,0); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,1); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,0); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,1); if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ //this is an x chrom for a male, so the only thing we need to check is if //allele1 matches either momallele1 or momallele2 if(allele1 != momAllele1 && allele1 != momAllele2) { mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else { //if gender is anything except 1 we assume female if(momAllele1 == momAllele2) { //mom hom and dad matches mom if(dadAllele1 == momAllele1) { //kid must be hom same allele if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ //mom het,so only need to check that at least one allele matches dad if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } } }else{ //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 ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,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 != 9){ //value of 9 means an 'h' allele for haps files... count[allele1]++; } if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2 || allele1 == 9 || allele2 == 9) { founderHetCount++; }else{ founderHomCount[allele1]++; } if(allele2 != 9){ 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 (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 == allele2) { hom++; }else { het++; } }else{ haploid++; } } //missing data else missing++; } currentFamily.setMendErrs(mendErrNum); } 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]; String minorAllele, majorAllele; if (freqStuff[2] == 1){ minorAllele = "A"; }else if (freqStuff[2] == 2){ minorAllele = "C"; }else if (freqStuff[2] == 3){ minorAllele = "G"; }else{ minorAllele = "T"; } if (freqStuff[3] == 1){ majorAllele = "A"; }else if (freqStuff[3] == 2){ majorAllele = "C"; }else if (freqStuff[3] == 3){ majorAllele = "G"; }else{ majorAllele = "T"; } //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, haploid, 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); if (mendErrNum > 0 && !pedFile.getMendelsExist()){ pedFile.setMendelsExist(true); } result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setMinorAllele(minorAllele); result.setMajorAllele(majorAllele); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setMendelErrors(mendels); return result; } |
|
if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { | if (!Chromosome.getDataChrom().equalsIgnoreCase("chrx") || currentInd.getGender() != 1) { | private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); int[] founderHomCount = new int[5]; Vector mendels = new Vector(); 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()); allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,1); //if haploid, check for male hets if(Chromosome.getDataChrom().equals("chrx") && currentInd.getGender()==1){ if(allele1 != allele2) { currentInd.zeroOutMarker(loc); pedFile.setHaploidHets(true); } } //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 int momAllele1 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,0); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getAllele(loc,1); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,0); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getAllele(loc,1); if(Chromosome.getDataChrom().equals("chrx")){ if(currentInd.getGender() == 1) { if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0)){ //this is an x chrom for a male, so the only thing we need to check is if //allele1 matches either momallele1 or momallele2 if(allele1 != momAllele1 && allele1 != momAllele2) { mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else { //if gender is anything except 1 we assume female if(momAllele1 == momAllele2) { //mom hom and dad matches mom if(dadAllele1 == momAllele1) { //kid must be hom same allele if(allele1 != momAllele1 || allele2 != momAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } }else{ //mom het,so only need to check that at least one allele matches dad if(allele1 != dadAllele1 && allele2 != dadAllele2){ mendErrNum ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } } }else{ //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 ++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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++; MendelError mend = new MendelError(currentInd.getFamilyID(), currentInd.getIndividualID()); mendels.add(mend); 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()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getAllele(loc,0); allele2 = currentInd.getAllele(loc,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 != 9){ //value of 9 means an 'h' allele for haps files... count[allele1]++; } if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2 || allele1 == 9 || allele2 == 9) { founderHetCount++; }else{ founderHomCount[allele1]++; } if(allele2 != 9){ 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 (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 == allele2) { hom++; }else { het++; } }else{ haploid++; } } //missing data else missing++; } currentFamily.setMendErrs(mendErrNum); } 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]; String minorAllele, majorAllele; if (freqStuff[2] == 1){ minorAllele = "A"; }else if (freqStuff[2] == 2){ minorAllele = "C"; }else if (freqStuff[2] == 3){ minorAllele = "G"; }else{ minorAllele = "T"; } if (freqStuff[3] == 1){ majorAllele = "A"; }else if (freqStuff[3] == 2){ majorAllele = "C"; }else if (freqStuff[3] == 3){ majorAllele = "G"; }else{ majorAllele = "T"; } //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, haploid, 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); if (mendErrNum > 0 && !pedFile.getMendelsExist()){ pedFile.setMendelsExist(true); } result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setMinorAllele(minorAllele); result.setMajorAllele(majorAllele); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setMendelErrors(mendels); return result; } |
add( buttonPane, BorderLayout.SOUTH ); | protected void createUI() { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); tabPane = new JTabbedPane(); add( tabPane, BorderLayout.CENTER ); // General pane JPanel generalPane = new JPanel(); tabPane.addTab( "General", generalPane ); // Create the fields & their labels // Photographer field JLabel photographerLabel = new JLabel( "Photographer" ); photographerField = new JTextField( 30 ); photographerDoc = photographerField.getDocument(); photographerDoc.addDocumentListener( this ); photographerDoc.putProperty( FIELD_NAME, PhotoInfoController.PHOTOGRAPHER ); // Shooting date field JLabel shootingDayLabel = new JLabel( "Shooting date" ); DateFormat df = DateFormat.getDateInstance(); DateFormatter shootingDayFormatter = new DateFormatter( df ); shootingDayField = new JFormattedTextField( df ); shootingDayField.setColumns( 10 ); shootingDayField.setValue( new Date( )); shootingDayField.addPropertyChangeListener( this ); shootingDayField.putClientProperty( FIELD_NAME, PhotoInfoController.SHOOTING_DATE ); // Shooting place field JLabel shootingPlaceLabel = new JLabel( "Shooting place" ); shootingPlaceField = new JTextField( 30 ); shootingPlaceDoc = shootingPlaceField.getDocument(); shootingPlaceDoc.addDocumentListener( this ); shootingPlaceDoc.putProperty( FIELD_NAME, PhotoInfoController.SHOOTING_PLACE ); // Description text JLabel descLabel = new JLabel( "Description" ); descriptionTextArea = new JTextArea( 5, 40 ); descriptionTextArea.setLineWrap( true ); descriptionTextArea.setWrapStyleWord( true ); JScrollPane descScrollPane = new JScrollPane( descriptionTextArea ); descScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); Border descBorder = BorderFactory.createEtchedBorder( EtchedBorder.LOWERED ); descBorder = BorderFactory.createTitledBorder( descBorder, "Description" ); descScrollPane.setBorder( descBorder ); descriptionDoc = descriptionTextArea.getDocument(); descriptionDoc.putProperty( FIELD_NAME, PhotoInfoController.DESCRIPTION ); descriptionDoc.addDocumentListener( this ); // Save button JButton saveBtn = new JButton( "Save" ); saveBtn.setActionCommand( "save" ); saveBtn.addActionListener( this ); // Discard button JButton discardBtn = new JButton( "Discard" ); discardBtn.setActionCommand( "discard" ); discardBtn.addActionListener( this ); // Lay out the created controls GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); generalPane.setLayout( layout ); JLabel[] labels = { photographerLabel, shootingDayLabel, shootingPlaceLabel }; JTextField[] fields = { photographerField, shootingDayField, shootingPlaceField }; addLabelTextRows( labels, fields, layout, generalPane ); generalPane.add( descScrollPane ); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints( descScrollPane, c ); c = new GridBagConstraints(); c.gridwidth = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.gridy = GridBagConstraints.RELATIVE; c.gridy = GridBagConstraints.RELATIVE; createTechDataUI(); // Create a pane for the buttols JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(discardBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(saveBtn); add( buttonPane, BorderLayout.SOUTH ); } |
|
String text = getBodyText(); | public void doTag(XMLOutput output) throws Exception { Task task = getTask(); String text = getBodyText(); // if the task has an addText() Method method = MethodUtils.getAccessibleMethod( taskType, "addText", addTaskParamTypes ); if (method != null) { Object[] args = { text }; method.invoke(task, args); } task.perform(); } |
|
} | } else { getBody().run(context, output); } | public void doTag(XMLOutput output) throws Exception { Task task = getTask(); String text = getBodyText(); // if the task has an addText() Method method = MethodUtils.getAccessibleMethod( taskType, "addText", addTaskParamTypes ); if (method != null) { Object[] args = { text }; method.invoke(task, args); } task.perform(); } |
if ( task == null ) { task = (Task) taskType.newInstance(); task.setProject(project); task.setTaskName(taskName); task.init(); setDynaBean( new ConvertingWrapDynaBean(task) ); | if ( this.task == null ) { if ( getTaskType() == null ) { setTaskType( (Class) getAntProject().getTaskDefinitions().get( getTaskName() ) ); } this.task = createTask( getTaskName(), getTaskType() ); setDynaBean( new ConvertingWrapDynaBean( this.task ) ); | public Task getTask() throws Exception { if ( task == null ) { task = (Task) taskType.newInstance(); task.setProject(project); task.setTaskName(taskName); task.init(); setDynaBean( new ConvertingWrapDynaBean(task) ); } return task; } |
return task; | return this.task; | public Task getTask() throws Exception { if ( task == null ) { task = (Task) taskType.newInstance(); task.setProject(project); task.setTaskName(taskName); task.init(); setDynaBean( new ConvertingWrapDynaBean(task) ); } return task; } |
setDynaBean( new ConvertingWrapDynaBean(task) ); | setDynaBean( new ConvertingWrapDynaBean( this.task ) ); | public void setTask(Task task) { this.task = task; setDynaBean( new ConvertingWrapDynaBean(task) ); } |
JMXConnector jmxc = JMXConnectorFactory.connect(url, null); | JMXConnector jmxc = JMXConnectorFactory.connect(url, env); | public ServerConnection getServerConnection(ApplicationConfig config) throws ConnectionFailedException { try { /* Create an RMI connector client */ HashMap env = new HashMap(); String[] credentials = new String[] {config.getUsername(), config.getPassword()}; env.put("jmx.remote.credentials", credentials); JMXServiceURL url = new JMXServiceURL(config.getURL()); JMXConnector jmxc = JMXConnectorFactory.connect(url, null); MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); return new JSR160ServerConnection(mbsc); } catch (Throwable e) { throw new ConnectionFailedException(e); } } |
db.setIgnoreReset(true); | db.setPlayPenDatabase(true); | public void testDatabaseInsert()throws ArchitectException { // setup a playpen like database SQLDatabase db = new SQLDatabase(); UndoManager undoManager = new UndoManager(db); db.setIgnoreReset(true); SQLTable table1 = new SQLTable(db,"table1","remark1","TABLE",true); SQLTable table2 = new SQLTable(db,"table2","remark2","TABLE",true); SQLTable table3 = new SQLTable(db,"table3","remark3","TABLE",true); SQLTable table4 = new SQLTable(db,"table4","remark4","TABLE",true); db.addChild(table1); db.addChild(table2); db.addChild(table3); db.addChild(table4); db.removeChild(2); undoManager.undo(); assertEquals("There should be 4 children",4,db.getChildCount()); assertEquals("The first table is in the wrong position",table1,db.getChild(0)); assertEquals("The Second table is in the wrong position",table2,db.getChild(1)); assertEquals("The Third table is in the wrong position",table3,db.getChild(2)); assertEquals("The Fourth table is in the wrong position",table4,db.getChild(3)); undoManager.redo(); assertEquals("There should be 3 children",3,db.getChildCount()); assertEquals("The first table is in the wrong position",table1,db.getChild(0)); assertEquals("The Second table is in the wrong position",table2,db.getChild(1)); assertEquals("The Third table is in the wrong position",table4,db.getChild(2)); } |
folder = PhotoFolder.create( "Top", null ); | folder = PhotoFolder.create( "PhotoAdditionTest", PhotoFolder.getRoot() ); | public void testPhotoAddition() { String testImgDir = "c:\\java\\photovault\\testfiles"; String fname = "test1.jpg"; File f = new File( testImgDir, fname ); PhotoInfo photo = null; try { photo = PhotoInfo.addToDB( f ); } catch ( PhotoNotFoundException e ) { fail( "Could not find photo: " + e.getMessage() ); } PhotoFolder folder = null; // Create a folder for the photo try { folder = PhotoFolder.create( "Top", null ); folder.addPhoto( photo ); assertEquals( "Photo not visible in folders' photo count", folder.getPhotoCount(), 1 ); } finally { // Clean up the test folder PhotoFolder parent = folder.getParentFolder(); parent.removeSubfolder( folder ); } } |
query.create( "select folders from " + PhotoFolder.class.getName() + " where name = \"Top\"" ); | query.create( "select folders from " + PhotoFolder.class.getName() + " where folderId = 1" ); | public void testRetrieve() { DList folders = null; Transaction tx = odmg.newTransaction(); tx.begin(); try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where name = \"Top\"" ); folders = (DList) query.execute(); tx.commit(); } catch ( Exception e ) { tx.abort(); fail( e.getMessage() ); } Iterator iter = folders.iterator(); boolean found = false; while ( iter.hasNext() ) { PhotoFolder folder = (PhotoFolder) iter.next(); if ( folder.getName().equals( "Top" ) ) { found = true; log.debug( "found top, id = " + folder.getFolderId() ); assertEquals( "Folder with id 0 should be the top", folder.getName(), "Top" ); } } assertTrue( "Top folder not found", found ); } |
assertEquals( "Folder with id 0 should be the top", folder.getName(), "Top" ); | assertEquals( "Folder with id 1 should be the top", folder.getName(), "Top" ); | public void testRetrieve() { DList folders = null; Transaction tx = odmg.newTransaction(); tx.begin(); try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where name = \"Top\"" ); folders = (DList) query.execute(); tx.commit(); } catch ( Exception e ) { tx.abort(); fail( e.getMessage() ); } Iterator iter = folders.iterator(); boolean found = false; while ( iter.hasNext() ) { PhotoFolder folder = (PhotoFolder) iter.next(); if ( folder.getName().equals( "Top" ) ) { found = true; log.debug( "found top, id = " + folder.getFolderId() ); assertEquals( "Folder with id 0 should be the top", folder.getName(), "Top" ); } } assertTrue( "Top folder not found", found ); } |
makePhoto( cal, "Lassille kuuluu hyv" ); | makePhoto( cal, "Lassille kuuluu hyvaa" ); | public void setUp() { // Create several photos with different shooting dates // Add them to a collection so that they are easy to delete afterwards Calendar cal = Calendar.getInstance(); photos = new Vector(); uids = new Vector(); cal.set( 2002, 11, 23 ); makePhoto( cal, "Katsokaa kun Lassi ui" ); cal.set( 2002, 11, 24 ); makePhoto( cal, "Lassille kuuluu hyv" ); makePhoto( cal, "" ); cal.set( 2002, 11, 25 ); makePhoto( cal, "" ); folder = PhotoFolder.create( "QueryTest", PhotoFolder.getRoot() ); subfolder = PhotoFolder.create( "QueryTest subfolder", folder ); folder.addPhoto( (PhotoInfo)photos.get(0) ); subfolder.addPhoto( (PhotoInfo)photos.get(3) ); folder.addPhoto( (PhotoInfo)photos.get(2) ); } |
Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { ((SQLObjectListener) it.next()).dbChildrenRemoved(e); | SQLObjectListener[] listeners = sqlObjectListeners.toArray(new SQLObjectListener[0]); for(int i = listeners.length-1;i>=0;i--) { listeners[i].dbChildrenRemoved(e); | protected void fireDbChildrenRemoved(int[] oldIndices, List oldChildren) { if (logger.isDebugEnabled()) { logger.debug(getClass().getName()+" "+toString()+": " + "firing dbChildrenRemoved event " + "(secondary = "+isSecondaryChangeMode()+")"); } SQLObjectEvent e = new SQLObjectEvent (this, oldIndices, (SQLObject[]) oldChildren.toArray(new SQLObject[oldChildren.size()]), isSecondaryChangeMode()); synchronized(sqlObjectListeners) { Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { ((SQLObjectListener) it.next()).dbChildrenRemoved(e); } } } |
Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { | SQLObjectListener[] listeners = sqlObjectListeners.toArray(new SQLObjectListener[0]); for(int i = listeners.length-1;i>=0;i--) { | protected void fireDbObjectChanged(String propertyName, Object oldValue, Object newValue) { SQLObjectEvent e = new SQLObjectEvent( this, propertyName, oldValue, newValue, isSecondaryChangeMode()); boolean same = (oldValue == null ? oldValue == newValue : oldValue.equals(newValue)); if (same) { logger.debug("Object changed event aborted, the old value '"+oldValue+"' of " +propertyName+" equals the new value '"+newValue+"'"); return; } if (logger.isDebugEnabled()) { logger.debug(getClass().getName()+" "+toString()+": " + "firing dbObjectChanged event " + "(secondary = "+isSecondaryChangeMode()+")"); } int count = 0; synchronized(sqlObjectListeners) { Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { count++; ((SQLObjectListener) it.next()).dbObjectChanged(e); } } if (logger.isDebugEnabled()) logger.debug("Notified "+count+" listeners."); } |
((SQLObjectListener) it.next()).dbObjectChanged(e); | listeners[i].dbObjectChanged(e); | protected void fireDbObjectChanged(String propertyName, Object oldValue, Object newValue) { SQLObjectEvent e = new SQLObjectEvent( this, propertyName, oldValue, newValue, isSecondaryChangeMode()); boolean same = (oldValue == null ? oldValue == newValue : oldValue.equals(newValue)); if (same) { logger.debug("Object changed event aborted, the old value '"+oldValue+"' of " +propertyName+" equals the new value '"+newValue+"'"); return; } if (logger.isDebugEnabled()) { logger.debug(getClass().getName()+" "+toString()+": " + "firing dbObjectChanged event " + "(secondary = "+isSecondaryChangeMode()+")"); } int count = 0; synchronized(sqlObjectListeners) { Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { count++; ((SQLObjectListener) it.next()).dbObjectChanged(e); } } if (logger.isDebugEnabled()) logger.debug("Notified "+count+" listeners."); } |
Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { | SQLObjectListener[] listeners = sqlObjectListeners.toArray(new SQLObjectListener[0]); for(int i = listeners.length-1;i>=0;i--) { | public void fireDbStructureChanged() { if (logger.isDebugEnabled()) { logger.debug(getClass().getName()+" "+toString()+": " + "firing dbStructureChanged event " + "(secondary = "+isSecondaryChangeMode()+")"); } SQLObjectEvent e = new SQLObjectEvent( this, null, isSecondaryChangeMode()); int count = 0; synchronized(sqlObjectListeners) { Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { count++; ((SQLObjectListener) it.next()).dbStructureChanged(e); } } if (logger.isDebugEnabled()) logger.debug("Notified "+count+" listeners."); } |
((SQLObjectListener) it.next()).dbStructureChanged(e); | listeners[i].dbStructureChanged(e); | public void fireDbStructureChanged() { if (logger.isDebugEnabled()) { logger.debug(getClass().getName()+" "+toString()+": " + "firing dbStructureChanged event " + "(secondary = "+isSecondaryChangeMode()+")"); } SQLObjectEvent e = new SQLObjectEvent( this, null, isSecondaryChangeMode()); int count = 0; synchronized(sqlObjectListeners) { Iterator it = sqlObjectListeners.iterator(); while (it.hasNext()) { count++; ((SQLObjectListener) it.next()).dbStructureChanged(e); } } if (logger.isDebugEnabled()) logger.debug("Notified "+count+" listeners."); } |
Iterator it = undoEventListeners.iterator(); | UndoCompoundEventListener[] listeners = sqlObjectListeners.toArray(new UndoCompoundEventListener[0]); | protected void fireUndoCompoundEvent(UndoCompoundEvent e) { Iterator it = undoEventListeners.iterator(); if (e.getType().isStartEvent()) { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditStart(e); } } else { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditEnd(e); } } } |
while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditStart(e); | for(int i = listeners.length-1;i>=0;i--) { listeners[i].compoundEditStart(e); | protected void fireUndoCompoundEvent(UndoCompoundEvent e) { Iterator it = undoEventListeners.iterator(); if (e.getType().isStartEvent()) { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditStart(e); } } else { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditEnd(e); } } } |
while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditEnd(e); | for(int i = listeners.length-1;i>=0;i--) { listeners[i].compoundEditEnd(e); | protected void fireUndoCompoundEvent(UndoCompoundEvent e) { Iterator it = undoEventListeners.iterator(); if (e.getType().isStartEvent()) { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditStart(e); } } else { while (it.hasNext()) { ((UndoCompoundEventListener) it.next()).compoundEditEnd(e); } } } |
+ ": " | + "): " | protected SAXException createSAXException(String message, Exception e) { log.warn("Underlying exception: " + e); e.printStackTrace(); if (locator != null) { String error = "Error at (" + locator.getLineNumber() + ", " + locator.getColumnNumber() + ": " + message; if (e != null) { return new SAXParseException(error, locator, e); } else { return new SAXParseException(error, locator); } } log.error("No Locator!"); if (e != null) { return new SAXException(message, e); } else { return new SAXException(message); } } |
} catch (IllegalAccessException e) { log.warn("Constructor for class is not accessible: " + uri + " so disabling the taglib"); } catch (InstantiationException e) { log.warn("Class could not be instantiated: " + uri + " so disabling the taglib"); } catch (ClassCastException e) { log.warn("Class is not a TagLibrary: " + uri + " so disabling the taglib"); | protected TagScript createTag( String namespaceURI, String localName, Attributes list) throws SAXException { try { // use the URI to load a taglib TagLibrary taglib = context.getTagLibrary(namespaceURI); if (taglib == null) { if (namespaceURI != null && namespaceURI.startsWith("jelly:")) { String uri = namespaceURI.substring(6); // try to find the class on the claspath try { Class taglibClass = getClassLoader().loadClass(uri); taglib = (TagLibrary) taglibClass.newInstance(); context.registerTagLibrary(namespaceURI, taglib); } catch (ClassNotFoundException e) { log.warn("Could not load class: " + uri + " so disabling the taglib"); } } } if (taglib != null) { TagScript script = taglib.createTagScript(localName, list); if ( script != null ) { configureTagScript(script); // clone the attributes to keep them around after this parse script.setSaxAttributes(new AttributesImpl(list)); // now iterate through through the expressions int size = list.getLength(); for (int i = 0; i < size; i++) { String attributeName = list.getLocalName(i); String attributeValue = list.getValue(i); Expression expression = taglib.createExpression( getExpressionFactory(), script, attributeName, attributeValue); if (expression == null) { expression = createConstantExpression(localName, attributeName, attributeValue); } script.addAttribute(attributeName, expression); } } return script; } return null; } catch (Exception e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); throw createSAXException(e); } } |
|
Object value = evaluateAsValue(context); | Object value = evaluateRecurse(context); | public boolean evaluateAsBoolean(JellyContext context) { Object value = evaluateAsValue(context); if ( value instanceof Boolean ) { Boolean b = (Boolean) value; return b.booleanValue(); } else if ( value instanceof String ) { // return Boolean.getBoolean( (String) value ); String str = (String) value; if ( str.equals( "on" ) || str.equals( "yes" ) || str.equals( "1" ) || str.equals( "true" ) ) { return true; } else { return false; } } return false; } |
Object value = evaluateAsValue(context); | Object value = evaluateRecurse(context); | public Iterator evaluateAsIterator(JellyContext context) { Object value = evaluateAsValue(context); if ( value == null ) { return EMPTY_ITERATOR; } else if ( value instanceof Iterator ) { return (Iterator) value; } else if ( value instanceof List ) { List list = (List) value; return list.iterator(); } else if ( value instanceof Map ) { Map map = (Map) value; return map.entrySet().iterator(); } else if ( value.getClass().isArray() ) { return new ArrayIterator( value ); } else if ( value instanceof Enumeration ) { return new EnumerationIterator((Enumeration ) value); } else if ( value instanceof Collection ) { Collection collection = (Collection) value; return collection.iterator(); } else { // XXX: should we return single iterator? return new SingletonIterator( value ); } } |
Object value = evaluateAsValue(context); | Object value = evaluateRecurse(context); | public String evaluateAsString(JellyContext context) { Object value = evaluateAsValue(context); // sometimes when Jelly is used inside Maven the value // of an expression can actually be an expression. // e.g. ${foo.bar} can lookup "foo.bar" in a Maven context // which could actually be an expression if ( value != null ) { return value.toString(); } return null; } |
return bodyPart.getSize(); | try { Object content = bodyPart.getContent(); if (content instanceof InputStream) { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtil.copy(((InputStream) content), os); return os.size(); } else if (content instanceof String) { return ((String) content).length(); } else { throw new IllegalStateException("Unsupported content: "+content.getClass().toString()); } } catch (IOException e) { throw new IllegalStateException("Unexpected IOException in getContent()"); } | public static int getMimePartSize(MimeMultipart parts, String mimeType) { if (parts != null) { try { for (int i = 0; i < parts.getCount(); i++) { BodyPart bodyPart = parts.getBodyPart(i); if (bodyPart.getContentType().startsWith(mimeType)) { return bodyPart.getSize(); } } } catch (MessagingException e) { log.info("failed to process body parts.", e); } } return 0; } |
TableUtils.fitColumnWidth(table, colIndex); | TableUtils.fitColumnWidth(table, colIndex, 0); | public void initSingleColumnSize(int colIndex) { TableUtils.fitColumnWidth(table, colIndex); } |
JFrame jf = new JFrame(); | int exitValue = 0; | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); | StreamGobbler isg = new StreamGobbler(child.getInputStream()); isg.start(); | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } | boolean dead = false; StringBuffer errorMsg = new StringBuffer("Fatal Error:\n"); BufferedReader besr = new BufferedReader(new InputStreamReader(child.getErrorStream())); String line = null; if ((line = besr.readLine()) != null) { errorMsg.append(line); child.destroy(); dead = true; | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
while ((c=is.read())!=-1){ System.out.print((char)c); } | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
|
JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); | if (headless){ System.out.println(errorMsg); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, errorMsg, null, JOptionPane.ERROR_MESSAGE); } exitValue = -1; | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); | if (headless){ System.out.println("Error:\nUnable to launch Haploview.\n"+e.getMessage()); }else{ JFrame jf = new JFrame(); JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.\n"+e.getMessage(), null, JOptionPane.ERROR_MESSAGE); } | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
System.exit(0); | System.exit(exitValue); | public static void main(String[] args) { JFrame jf = new JFrame(); String dir = System.getProperty("user.dir"); String sep = System.getProperty("file.separator"); String ver = System.getProperty("java.version"); System.out.println(ver); String jarfile = System.getProperty("java.class.path"); String argsToBePassed = new String(); boolean headless = false; for (int a = 0; a < args.length; a++){ argsToBePassed = argsToBePassed.concat(" " + args[a]); if (args[a].equals("-n")){ headless=true; } } try { //if the nogui flag is present we force it into headless mode String runString = "java -Xmx650m -classpath " + jarfile; if (headless){ runString += " -Djava.awt.headless=true"; } runString += " edu.mit.wi.haploview.HaploView"+argsToBePassed; Process child = Runtime.getRuntime().exec(runString); int c; boolean dead = false; StringBuffer errorMsg = new StringBuffer(); InputStream es = child.getErrorStream(); InputStream is = child.getInputStream(); //while the child is alive we wait for error messages while ((c=es.read())!=-1) { errorMsg.append((char)c); if (!dead){ child.destroy(); dead = true; } } //if the child has exited without throwing an error (which should've been caught and dealt //with above) we read all the accumulated msgs to stdout and print them... while ((c=is.read())!=-1){ System.out.print((char)c); } if (dead){ JOptionPane.showMessageDialog(jf, "Fatal Error:\n" + errorMsg, null, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(jf, "Error:\nUnable to launch Haploview.", null, JOptionPane.ERROR_MESSAGE); } System.exit(0); } |
for (int i = 0, size = whenTags.length; i < size; i++) { TagScript script = whenTags[i]; script.run(context, output); WhenTag tag = (WhenTag) script.getTag(); if (tag.getValue()) { return; } } if (otherwiseTag != null) { otherwiseTag.run(context, output); } | setBlockEvaluated(false); invokeBody(output); | public void doTag(XMLOutput output) throws Exception { for (int i = 0, size = whenTags.length; i < size; i++) { TagScript script = whenTags[i]; script.run(context, output); WhenTag tag = (WhenTag) script.getTag(); if (tag.getValue()) { return; } } if (otherwiseTag != null) { otherwiseTag.run(context, output); } } |
PreparedStatement ps = conn.prepareStatement(sqlStatement); setParameters(ps, parameters); result = ps.executeUpdate(); | if ( parameters == null || parameters.size() == 0 ) { Statement statement = conn.createStatement(); result = statement.executeUpdate(sqlStatement); } else { PreparedStatement ps = conn.prepareStatement(sqlStatement); setParameters(ps, parameters); result = ps.executeUpdate(); } | public void doTag(XMLOutput output) throws Exception { try { conn = getConnection(); } catch (SQLException e) { throw new JellyException(sql + ": " + e.getMessage(), e); } /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ String sqlStatement = null; if (sql != null) { sqlStatement = sql; } else { sqlStatement = getBodyText(); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); } int result = 0; try { PreparedStatement ps = conn.prepareStatement(sqlStatement); setParameters(ps, parameters); result = ps.executeUpdate(); if (var != null) { context.setVariable(var, new Integer(result)); } } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); } finally { if (conn != null && !isPartOfTransaction) { try { conn.close(); } catch (SQLException e) { // Not much we can do } } parameters = null; conn = null; } } |
pp.addTablePane(new TablePane(t1, pp), new Point(0,0)); | pp.addTablePane(tp1 = new TablePane(t1, pp), new Point(0,0)); | protected void setUp() throws Exception { super.setUp(); pp = ArchitectFrame.getMainInstance().getProject().getPlayPen(); SQLTable t1 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t1); pp.addTablePane(new TablePane(t1, pp), new Point(0,0)); SQLTable t2 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t2); pp.addTablePane(new TablePane(t2, pp), new Point(0,0)); SQLRelationship sqlrel = new SQLRelationship(); sqlrel.attachRelationship(t1, t2, false); rel = new Relationship(pp, sqlrel); } |
pp.addTablePane(new TablePane(t2, pp), new Point(0,0)); | pp.addTablePane(tp2 = new TablePane(t2, pp), new Point(0,0)); | protected void setUp() throws Exception { super.setUp(); pp = ArchitectFrame.getMainInstance().getProject().getPlayPen(); SQLTable t1 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t1); pp.addTablePane(new TablePane(t1, pp), new Point(0,0)); SQLTable t2 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t2); pp.addTablePane(new TablePane(t2, pp), new Point(0,0)); SQLRelationship sqlrel = new SQLRelationship(); sqlrel.attachRelationship(t1, t2, false); rel = new Relationship(pp, sqlrel); } |
sqlrel.addMapping(t1.getColumnByName("pkcol_1"), t2.getColumnByName("fkcol")); | protected void setUp() throws Exception { super.setUp(); pp = ArchitectFrame.getMainInstance().getProject().getPlayPen(); SQLTable t1 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t1); pp.addTablePane(new TablePane(t1, pp), new Point(0,0)); SQLTable t2 = new SQLTable(pp.getDatabase(), true); pp.getDatabase().addChild(t2); pp.addTablePane(new TablePane(t2, pp), new Point(0,0)); SQLRelationship sqlrel = new SQLRelationship(); sqlrel.attachRelationship(t1, t2, false); rel = new Relationship(pp, sqlrel); } |
|
odmg = OJB.getInstance(); db = odmg.newDatabase(); try { db.open( "repository.xml", Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) { db = null; } | odmg = ODMG.getODMGImplementation(); db = ODMG.getODMGDatabase(); | public void setUp() { odmg = OJB.getInstance(); db = odmg.newDatabase(); try { db.open( "repository.xml", Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) { // log.warn( "Could not open database: " + e.getMessage() ); db = null; } tx = odmg.newTransaction(); tx.begin(); DList folders = null; try { OQLQuery query = odmg.newOQLQuery(); query.create( "select folders from " + PhotoFolder.class.getName() + " where name = \"subfolderTest\"" ); folders = (DList) query.execute(); tx.commit(); } catch ( Exception e ) { tx.abort(); fail( e.getMessage() ); } rootFolder = (PhotoFolder) folders.get(0); model = new PhotoFolderTreeModel(); model.setRoot( rootFolder ); } |
}else if (e.getActionCommand().equals("dump tags")){ try{ HaploView.fc.setSelectedFile(new File("")); if (HaploView.fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = HaploView.fc.getSelectedFile(); tc.dumpTags(outfile); } }catch (IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } | public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("taggingdone")){ TaggerConfigPanel tcp = (TaggerConfigPanel) e.getSource(); setTags(tcp.getTaggerController()); }else if (e.getActionCommand().equals("dump")){ try{ HaploView.fc.setSelectedFile(new File("")); if (HaploView.fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = HaploView.fc.getSelectedFile(); tc.dumpTests(outfile); } }catch (IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } |
|
listsPanel.add(dumpTestsButton); | JButton dumpTagsButton = new JButton("Dump Tags File"); dumpTagsButton.setActionCommand("dump tags"); dumpTagsButton.addActionListener(this); JPanel listsButtonPanel = new JPanel(); listsButtonPanel.add(dumpTestsButton); listsButtonPanel.add(dumpTagsButton); listsPanel.add(listsButtonPanel); | public void setTags(TaggerController t) { tc = t; removeAll(); setLayout(new BoxLayout(this,BoxLayout.X_AXIS)); Vector colNames = new Vector(); Vector tableData = new Vector(); colNames.add("Allele"); colNames.add("Test"); colNames.add("r\u00b2"); for (int i = 0; i < Chromosome.getSize(); i++){ Vector v = t.getMarkerTagDetails(i); tableData.add(v); } BasicTableModel btm = new BasicTableModel(colNames, tableData); markerTable = new JTable(btm); GreyedOutRenderer gor = new GreyedOutRenderer(); markerTable.setDefaultRenderer(String.class,gor); JScrollPane tableScroller = new JScrollPane(markerTable); tags = t.getResults(); forceIncluded = new Vector(); Vector fi = t.getForceIncludeds(); for (int i = 0; i < fi.size(); i++){ forceIncluded.add(((edu.mit.wi.tagger.SNP)fi.get(i)).getName()); } DefaultListModel tagListModel = new DefaultListModel(); for(int i=0;i<tags.size();i++){ TagSequence ts = (TagSequence)tags.get(i); tagListModel.addElement(ts.getName()); } tagList = new JList(tagListModel); tagList.setCellRenderer(new TagListRenderer()); tagList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); tagList.setSelectedIndex(0); tagList.addListSelectionListener(this); tagList.setPreferredSize(new Dimension(tagList.getPreferredSize().width + 10, tagList.getPreferredSize().height)); JScrollPane listScrollPane = new JScrollPane(tagList); JPanel topListPanel = new JPanel(); topListPanel.setLayout(new BoxLayout(topListPanel,BoxLayout.Y_AXIS)); JLabel tagLabel = new JLabel("Tests"); Font defaultFont = tagLabel.getFont(); //make the word 'tests' nice and big. tagLabel.setFont(new Font(defaultFont.getName(),Font.BOLD,(int)(defaultFont.getSize()*1.5))); tagLabel.setAlignmentX(Component.CENTER_ALIGNMENT); topListPanel.add(tagLabel); topListPanel.add(Box.createRigidArea(new Dimension(0,10))); topListPanel.add(listScrollPane); if (forceIncluded.size() > 0){ //let them know why some are in bold JLabel forceLabel = new JLabel("(forced-in markers shown in bold)"); forceLabel.setAlignmentX(Component.CENTER_ALIGNMENT); topListPanel.add(forceLabel); } DefaultListModel taggedListModel = new DefaultListModel(); taggedList = new JList(taggedListModel); taggedList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tagList.setSelectedIndex(0); tagList.addListSelectionListener(this); JScrollPane taggedListScrollPane = new JScrollPane(taggedList); JPanel bottomListPanel = new JPanel(); bottomListPanel.setLayout(new BoxLayout(bottomListPanel, BoxLayout.Y_AXIS)); bottomListPanel.add(new JLabel("Alleles captured by Current Selection")); bottomListPanel.add(taggedListScrollPane); JPanel listsPanel = new JPanel(); listsPanel.setLayout(new BoxLayout(listsPanel,BoxLayout.Y_AXIS)); listsPanel.add(topListPanel); listsPanel.add(Box.createRigidArea(new Dimension(0,10))); listsPanel.add(bottomListPanel); listsPanel.add(Box.createRigidArea(new Dimension(0,10))); JLabel capLabel = new JLabel("Captured " + t.getTaggedSoFar() + " of " + Chromosome.getSize() + " alleles with mean r\u00b2 of " + Util.roundDouble(t.getMeanRSq(),3)); listsPanel.add(capLabel); listsPanel.add(new JLabel(t.getFracOver8() + " percent of captured alleles with r\u00b2 > 0.8")); JLabel useLabel = new JLabel("Using " +t.getNumTagSNPs() + " SNPs in " + t.getResults().size() + " tests."); listsPanel.add(useLabel); if(t.getUntaggableCount() > 0) { String cantTag = "Unable to capture " + t.getUntaggableCount() + " alleles (shown in red)."; JLabel cantTagLabel = new JLabel(cantTag); listsPanel.add(cantTagLabel); } listsPanel.add(Box.createRigidArea(new Dimension(0,10))); JButton dumpTestsButton = new JButton("Dump Tests File"); dumpTestsButton.setActionCommand("dump"); dumpTestsButton.addActionListener(this); listsPanel.add(dumpTestsButton); listsPanel.add(Box.createRigidArea(new Dimension(0,5))); add(listsPanel); add(Box.createRigidArea(new Dimension(5,0))); add(new JSeparator(JSeparator.VERTICAL)); add(Box.createRigidArea(new Dimension(5,0))); add(tableScroller); refresh(); } |
addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); | public BrowserWindow() { super( "Photovault Browser"); SwingUtilities.invokeLater(new java.lang.Runnable() { public void run() { createUI(); } }); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); } |
|
setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); | protected void createUI() { tabPane = new JTabbedPane(); queryPane = new QueryPane(); treePane = new PhotoFolderTree(); tabPane.addTab( "Query", queryPane ); tabPane.addTab( "Folders", treePane ); // viewPane = new TableCollectionView(); viewPane = new PhotoCollectionThumbView(); viewPane.setCollection( queryPane.getResultCollection() ); // Set listeners to both query and folder tree panes /* If an actionEvent comes from queryPane & the viewed folder is no the query resouts, swich to it (the result folder will be nodified of changes to quert parameters directly */ queryPane.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { if ( viewPane.getCollection() != queryPane.getResultCollection() ) { viewPane.setCollection( queryPane.getResultCollection() ); } } } ); /* If the selected folder is changed in treePane, switch to that immediately */ treePane.addPhotoFolderTreeListener( new PhotoFolderTreeListener() { public void photoFolderTreeSelectionChanged( PhotoFolderTreeEvent e ) { PhotoFolder f = e.getSelected(); if ( f != null ) { viewPane.setCollection( f ); } } } ); // Create the split pane to display both of these components JScrollPane viewScroll = new JScrollPane( viewPane ); JSplitPane split = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, tabPane, viewScroll ); Container cp = getContentPane(); cp.setLayout( new BorderLayout() ); cp.add( split, BorderLayout.CENTER ); // Create the menu bar & menus JMenuBar menuBar = new JMenuBar(); setJMenuBar( menuBar ); JMenu fileMenu = new JMenu( "File" ); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add( fileMenu ); JMenuItem newWindowItem = new JMenuItem( "New window", KeyEvent.VK_N ); newWindowItem.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { BrowserWindow br = new BrowserWindow(); // br.setVisible( true ); } }); fileMenu.add( newWindowItem ); JMenuItem importItem = new JMenuItem( "Import image...", KeyEvent.VK_I ); importItem.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { importFile(); } }); fileMenu.add( importItem ); JMenuItem exitItem = new JMenuItem( "Exit", KeyEvent.VK_X ); exitItem.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { System.exit( 0 ); } }); fileMenu.add( exitItem ); pack(); setVisible( true ); } |
|
BrowserWindow br = new BrowserWindow(); | importFile(); | public void actionPerformed( ActionEvent e ) { BrowserWindow br = new BrowserWindow(); // br.setVisible( true ); } |
importFile(); | System.exit( 0 ); | public void actionPerformed( ActionEvent e ) { importFile(); } |
registerWidgetTag( "tableTree", TableTree.class ); registerWidgetTag( "tableTreeItem", TableTreeItem.class ); | public SwtTagLibrary() { // widgets registerWidgetTag( "button", Button.class ); registerWidgetTag( "canvas", Canvas.class ); registerWidgetTag( "caret", Caret.class ); registerWidgetTag( "combo", Combo.class ); registerWidgetTag( "composite", Composite.class ); registerWidgetTag( "coolBar", CoolBar.class ); registerWidgetTag( "coolItem", CoolItem.class ); registerWidgetTag( "decorations", Decorations.class ); registerWidgetTag( "group", Group.class ); registerWidgetTag( "label", Label.class ); registerWidgetTag( "list", List.class ); registerTag( "menu", MenuTag.class ); registerWidgetTag( "menuItem", MenuItem.class ); registerWidgetTag( "messageBox", MessageBox.class ); registerWidgetTag( "progressBar", ProgressBar.class ); registerWidgetTag( "sash", Sash.class ); registerWidgetTag( "scale", Scale.class ); registerWidgetTag( "shell", Shell.class ); registerWidgetTag( "slider", Slider.class ); registerWidgetTag( "tabFolder", TabFolder.class ); registerWidgetTag( "tabItem", TabItem.class ); registerWidgetTag( "table", Table.class ); registerWidgetTag( "tableColumn", TableColumn.class ); registerWidgetTag( "tableItem", TableItem.class ); registerWidgetTag( "text", Text.class ); registerWidgetTag( "toolBar", ToolBar.class ); registerWidgetTag( "toolItem", ToolItem.class ); registerWidgetTag( "tracker", Tracker.class ); registerWidgetTag( "tree", Tree.class ); registerWidgetTag( "treeItem", TreeItem.class ); // layouts registerLayoutTag("fillLayout", FillLayout.class); registerLayoutTag("gridLayout", GridLayout.class); registerLayoutTag("rowLayout", RowLayout.class); // layout data objects registerLayoutDataTag( "gridData", GridData.class ); registerLayoutDataTag( "rowData", RowData.class ); // dialogs //registerWidgetTag( "colorDialog", ColorDialog.class ); //registerWidgetTag( "directoryDialog", DirectoryDialog.class ); //registerWidgetTag( "fileDialog", FileDialog.class ); //registerWidgetTag( "fontDialog", FontDialog.class ); // events registerTag("onEvent", OnEventTag.class); } |
|
JButton okButton = new JButton("Ok"); | JButton okButton = new JButton(ArchitectPanelBuilder.OK_BUTTON_LABEL); | public synchronized void setupDialog() { logger.debug("running setupDialog()"); if (plexp == null) { throw new NullPointerException("setupDialog: plexp was null"); } // always refresh Target Database (it might have changed) plexp.setTargetDataSource(ArchitectFrame.getMainInstance().getProject().getTargetDatabase().getDataSource()); // Cannot use ArchitectPanelBuilder here yet because // of the progressbar. d = new JDialog(ArchitectFrame.getMainInstance(), "Export ETL Transactions to PL Repository"); // set export defaults if necessary if (plexp.getFolderName() == null || plexp.getFolderName().trim().length() == 0) { plexp.setFolderName(PLUtils.toPLIdentifier(architectFrame.getProject().getName()+"_FOLDER")); } if (plexp.getJobId() == null || plexp.getJobId().trim().length() == 0) { plexp.setJobId(PLUtils.toPLIdentifier(architectFrame.getProject().getName()+"_JOB")); } JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plPanel.setPLExport(plexp); plp.add(plPanel, BorderLayout.CENTER); // make an intermediate JPanel JPanel bottomPanel = new JPanel(new GridLayout(1,2,25,0)); // 25 pixel hgap JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (!plPanel.applyChanges()) { return; } try { List targetTables = playpen.getDatabase().getTables(); List targetDBWarnings = listMissingTargetTables(targetTables); if (!targetDBWarnings.isEmpty()) { // modal dialog (hold things up until the user says YES or NO) JList warnings = new JList(targetDBWarnings.toArray()); JPanel cp = new JPanel(new BorderLayout()); cp.add(new JLabel("<html>The target database schema is not identical to your Architect schema.<br><br>Here are the differences:</html>"), BorderLayout.NORTH); cp.add(new JScrollPane(warnings), BorderLayout.CENTER); cp.add(new JLabel("Do you want to continue anyway?"), BorderLayout.SOUTH); int choice = JOptionPane.showConfirmDialog(architectFrame, cp, "Target Database Structure Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (choice == JOptionPane.NO_OPTION) { return; } } } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame,"Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); return; } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame,"Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans",arex); return; } // got this far, so it's ok to run the PL Export thread ExportTxProcess etp = new ExportTxProcess(plexp,d, plCreateTxProgressBar,plCreateTxLabel); new Thread(etp).start(); } }); buttonPanel.add(okButton); Action cancelAction = new AbstractAction() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }; cancelAction.putValue(Action.NAME, ArchitectPanelBuilder.CANCEL_BUTTON_LABEL); ArchitectPanelBuilder.makeJDialogCancellable(d, cancelAction); d.getRootPane().setDefaultButton(okButton); JButton cancelButton = new JButton(cancelAction); buttonPanel.add(cancelButton); // stick in the progress bar here... JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); plCreateTxProgressBar = new JProgressBar(); plCreateTxProgressBar.setStringPainted(true); progressPanel.add(plCreateTxProgressBar); plCreateTxLabel = new JLabel ("Exporting PL Transactions..."); progressPanel.add(plCreateTxLabel); // figure out how much space this needs before setting // child components to be invisible progressPanel.setPreferredSize(progressPanel.getPreferredSize()); plCreateTxProgressBar.setVisible(false); plCreateTxLabel.setVisible(false); bottomPanel.add(progressPanel); // left side, left justified bottomPanel.add(buttonPanel); // right side, right justified plp.add(bottomPanel, BorderLayout.SOUTH); d.setContentPane(plp); // experiment with preferred size crap: d.pack(); d.setLocationRelativeTo(ArchitectFrame.getMainInstance()); } |
Options.setAssocTest(1); | Options.setAssocTest(ASSOC_TRIO); | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(1); } else { Options.setAssocTest(2); } }else{ Options.setAssocTest(0); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
Options.setAssocTest(2); | Options.setAssocTest(ASSOC_CC); | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(1); } else { Options.setAssocTest(2); } }else{ Options.setAssocTest(0); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
Options.setAssocTest(0); | Options.setAssocTest(ASSOC_NONE); | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(1); } else { Options.setAssocTest(2); } }else{ Options.setAssocTest(0); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; | if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText()}; | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(1); } else { Options.setAssocTest(2); } }else{ Options.setAssocTest(0); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
addPhotoToTree( (PhotoInfo) model[n] ); | if ( model[n] != null ) { addPhotoToTree( (PhotoInfo) model[n] ); } | protected void initTree() { folderNodes = new HashMap(); topNode = null; if ( model == null ) { return; } // Add all photos in the model to folder tree for ( int n = 0; n < model.length; n++ ) { addPhotoToTree( (PhotoInfo) model[n] ); } treeModel.nodeStructureChanged(topNode); } |
print(" ADD FOREIGN KEY "); | print(" ADD CONSTRAINT "); | public void addRelationship(SQLRelationship r) throws ArchitectDiffException { print("\n ALTER TABLE "); printQualified(r.getFkTable().getPhysicalName()); print(" ADD FOREIGN KEY "); print(r.getName()); print(" ( "); Map<String, SQLColumn> colNameMap = new HashMap<String, SQLColumn> (); boolean firstColumn = true; for (ColumnMapping cm :r.getMapping()) { SQLColumn c = cm.getFkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if(firstColumn) { firstColumn = false; print(getPhysicalName(colNameMap,c)); } else { print(", "+getPhysicalName(colNameMap,c)); } colNameMap.put(c.getName(),c); } } print(" ) REFERENCES "); printQualified(r.getPkTable().getPhysicalName()); print(" ( "); colNameMap = new HashMap<String, SQLColumn> (); firstColumn = true; for (ColumnMapping cm :r.getMapping()) { SQLColumn c = cm.getPkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if(firstColumn) { firstColumn = false; print(getPhysicalName(colNameMap,c)); } else { print(", "+getPhysicalName(colNameMap,c)); } colNameMap.put(c.getName(),c); } } print(" )"); endStatement(DDLStatement.StatementType.CREATE, r); } |
print(" ( "); | print(" FOREIGN KEY ( "); | public void addRelationship(SQLRelationship r) throws ArchitectDiffException { print("\n ALTER TABLE "); printQualified(r.getFkTable().getPhysicalName()); print(" ADD FOREIGN KEY "); print(r.getName()); print(" ( "); Map<String, SQLColumn> colNameMap = new HashMap<String, SQLColumn> (); boolean firstColumn = true; for (ColumnMapping cm :r.getMapping()) { SQLColumn c = cm.getFkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if(firstColumn) { firstColumn = false; print(getPhysicalName(colNameMap,c)); } else { print(", "+getPhysicalName(colNameMap,c)); } colNameMap.put(c.getName(),c); } } print(" ) REFERENCES "); printQualified(r.getPkTable().getPhysicalName()); print(" ( "); colNameMap = new HashMap<String, SQLColumn> (); firstColumn = true; for (ColumnMapping cm :r.getMapping()) { SQLColumn c = cm.getPkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if(firstColumn) { firstColumn = false; print(getPhysicalName(colNameMap,c)); } else { print(", "+getPhysicalName(colNameMap,c)); } colNameMap.put(c.getName(),c); } } print(" )"); endStatement(DDLStatement.StatementType.CREATE, r); } |
private String columnDefinition(SQLColumn c, Map colNameMap) throws ArchitectDiffException | protected String columnDefinition(SQLColumn c, Map colNameMap) throws ArchitectDiffException | private String columnDefinition(SQLColumn c, Map colNameMap) throws ArchitectDiffException { StringBuffer def = new StringBuffer(); getPhysicalName(colNameMap,c); // also adds generated physical name to the map GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { td = (GenericTypeDescriptor) typeMap.get(getDefaultType()); //better be non-null! GenericTypeDescriptor oldType = new GenericTypeDescriptor (c.getSourceDataTypeName(), c.getType(), c.getPrecision(), null, null, c.getNullable(), false, false); oldType.determineScaleAndPrecision(); warnings.add(new TypeMapWarning(c, "Unknown Target Type", oldType, td)); } def.append(c.getPhysicalName()); def.append(" "); def.append(td.getName()); if (td.getHasPrecision()) { def.append("("+c.getPrecision()); if (td.getHasScale()) { def.append(","+c.getScale()); } def.append(")"); } if (c.isDefinitelyNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } def.append(" NULL"); } else { def.append(" NOT NULL"); } return def.toString(); } |
print(" DROP FOREIGN KEY "); | print(" DROP CONSTRAINT "); | public void dropRelationship(SQLRelationship r) { print("\n ALTER TABLE "); printQualified(r.getFkTable().getPhysicalName()); print(" DROP FOREIGN KEY "); print(r.getName()); endStatement(DDLStatement.StatementType.DROP, r); } |
setVisible( false ); | private void CancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelBtnActionPerformed retval = CANCEL_OPTION; }//GEN-LAST:event_CancelBtnActionPerformed |
|
public void run(Context context, XMLOutput output) throws Exception { | public void run(JellyContext context, XMLOutput output) throws Exception { | public void run(Context context, XMLOutput output) throws Exception { log.info( "Invoking dynamic tag with attributes: " + attributes ); attributes.put( "org.apache.commons.jelly.body", getBody() ); // create new context based on current attributes Context newContext = context.newContext( attributes ); getTemplate().run( newContext, output ); } |
Context newContext = context.newContext( attributes ); | JellyContext newJellyContext = context.newJellyContext( attributes ); | public void run(Context context, XMLOutput output) throws Exception { log.info( "Invoking dynamic tag with attributes: " + attributes ); attributes.put( "org.apache.commons.jelly.body", getBody() ); // create new context based on current attributes Context newContext = context.newContext( attributes ); getTemplate().run( newContext, output ); } |
getTemplate().run( newContext, output ); | getTemplate().run( newJellyContext, output ); | public void run(Context context, XMLOutput output) throws Exception { log.info( "Invoking dynamic tag with attributes: " + attributes ); attributes.put( "org.apache.commons.jelly.body", getBody() ); // create new context based on current attributes Context newContext = context.newContext( attributes ); getTemplate().run( newContext, output ); } |
File propFile = new File( propFname ); | log.debug( "Using property file " + propFname ); File propFile = new File( propFname ); | static public void init() { // Determine the property file name String propFname = System.getProperty( "photovault.propFname", defaultPropFname ); File propFile = new File( propFname ); props = new Properties(); try { InputStream is = new FileInputStream( propFile ); props.load( is ); } catch ( FileNotFoundException e ) { log.error( "Could not find the property file " + propFname ); } catch ( IOException e ) { log.error( "Could not load property file " + propFname + ": " + e ); } } |
log.debug( "paintThumbnail entry " + photo.getUid() ); | private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; if ( photo != null ) { Thumbnail thumbnail = null; if ( photo.hasThumbnail() ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); // long accuracy = ((long) photo.getTimeAccuracy() ) * 24 * 3600 * 1000;// log.warn( "Accuracy = " + accuracy );// String dateStr = "";// if ( accuracy > 0 ) {// double accuracyFormatLimits[] = {0, 3, 14, 180};// String accuracyFormatStrings[] = {// "dd.MM.yyyy",// "'wk' w yyyy",// "MMMM yyyy",// "yyyy"// };// // Find the correct format to use// double dblAccuracy = photo.getTimeAccuracy();// String formatStr =accuracyFormatStrings[0];// for ( int i = 1; i < accuracyFormatLimits.length; i++ ) {// if ( dblAccuracy < accuracyFormatLimits[i] ) {// break;// }// formatStr =accuracyFormatStrings[i];// } // // Show the limits of the accuracy range// DateFormat df = new SimpleDateFormat( formatStr );// Date lower = new Date( photo.getShootTime().getTime() - accuracy );// Date upper = new Date( photo.getShootTime().getTime() + accuracy );// String lowerStr = df.format( lower );// String upperStr = df.format( upper );// dateStr = lowerStr;// if ( !lowerStr.equals( upperStr ) ) {// dateStr += " - " + upperStr;// }// } else {// DateFormat df = new SimpleDateFormat( "dd.MM.yyyy k:mm" );// dateStr = df.format( photo.getShootTime() );// } String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); } } |
|
if ( photo.hasThumbnail() ) { | log.debug( "finding thumb" ); boolean hasThumbnail = photo.hasThumbnail(); log.debug( "asked if has thumb" ); if ( hasThumbnail ) { | private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; if ( photo != null ) { Thumbnail thumbnail = null; if ( photo.hasThumbnail() ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); // long accuracy = ((long) photo.getTimeAccuracy() ) * 24 * 3600 * 1000;// log.warn( "Accuracy = " + accuracy );// String dateStr = "";// if ( accuracy > 0 ) {// double accuracyFormatLimits[] = {0, 3, 14, 180};// String accuracyFormatStrings[] = {// "dd.MM.yyyy",// "'wk' w yyyy",// "MMMM yyyy",// "yyyy"// };// // Find the correct format to use// double dblAccuracy = photo.getTimeAccuracy();// String formatStr =accuracyFormatStrings[0];// for ( int i = 1; i < accuracyFormatLimits.length; i++ ) {// if ( dblAccuracy < accuracyFormatLimits[i] ) {// break;// }// formatStr =accuracyFormatStrings[i];// } // // Show the limits of the accuracy range// DateFormat df = new SimpleDateFormat( formatStr );// Date lower = new Date( photo.getShootTime().getTime() - accuracy );// Date upper = new Date( photo.getShootTime().getTime() + accuracy );// String lowerStr = df.format( lower );// String upperStr = df.format( upper );// dateStr = lowerStr;// if ( !lowerStr.equals( upperStr ) ) {// dateStr += " - " + upperStr;// }// } else {// DateFormat df = new SimpleDateFormat( "dd.MM.yyyy k:mm" );// dateStr = df.format( photo.getShootTime() );// } String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); } } |
log.debug( "drawing thumbnail" ); | private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; if ( photo != null ) { Thumbnail thumbnail = null; if ( photo.hasThumbnail() ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); // long accuracy = ((long) photo.getTimeAccuracy() ) * 24 * 3600 * 1000;// log.warn( "Accuracy = " + accuracy );// String dateStr = "";// if ( accuracy > 0 ) {// double accuracyFormatLimits[] = {0, 3, 14, 180};// String accuracyFormatStrings[] = {// "dd.MM.yyyy",// "'wk' w yyyy",// "MMMM yyyy",// "yyyy"// };// // Find the correct format to use// double dblAccuracy = photo.getTimeAccuracy();// String formatStr =accuracyFormatStrings[0];// for ( int i = 1; i < accuracyFormatLimits.length; i++ ) {// if ( dblAccuracy < accuracyFormatLimits[i] ) {// break;// }// formatStr =accuracyFormatStrings[i];// } // // Show the limits of the accuracy range// DateFormat df = new SimpleDateFormat( formatStr );// Date lower = new Date( photo.getShootTime().getTime() - accuracy );// Date upper = new Date( photo.getShootTime().getTime() + accuracy );// String lowerStr = df.format( lower );// String upperStr = df.format( upper );// dateStr = lowerStr;// if ( !lowerStr.equals( upperStr ) ) {// dateStr += " - " + upperStr;// }// } else {// DateFormat df = new SimpleDateFormat( "dd.MM.yyyy k:mm" );// dateStr = df.format( photo.getShootTime() );// } String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); } } |
|
log.debug( "paintThumbnail: exit " + photo.getUid() ); | private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; if ( photo != null ) { Thumbnail thumbnail = null; if ( photo.hasThumbnail() ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); // long accuracy = ((long) photo.getTimeAccuracy() ) * 24 * 3600 * 1000;// log.warn( "Accuracy = " + accuracy );// String dateStr = "";// if ( accuracy > 0 ) {// double accuracyFormatLimits[] = {0, 3, 14, 180};// String accuracyFormatStrings[] = {// "dd.MM.yyyy",// "'wk' w yyyy",// "MMMM yyyy",// "yyyy"// };// // Find the correct format to use// double dblAccuracy = photo.getTimeAccuracy();// String formatStr =accuracyFormatStrings[0];// for ( int i = 1; i < accuracyFormatLimits.length; i++ ) {// if ( dblAccuracy < accuracyFormatLimits[i] ) {// break;// }// formatStr =accuracyFormatStrings[i];// } // // Show the limits of the accuracy range// DateFormat df = new SimpleDateFormat( formatStr );// Date lower = new Date( photo.getShootTime().getTime() - accuracy );// Date upper = new Date( photo.getShootTime().getTime() + accuracy );// String lowerStr = df.format( lower );// String upperStr = df.format( upper );// dateStr = lowerStr;// if ( !lowerStr.equals( upperStr ) ) {// dateStr += " - " + upperStr;// }// } else {// DateFormat df = new SimpleDateFormat( "dd.MM.yyyy k:mm" );// dateStr = df.format( photo.getShootTime() );// } String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); } } |
|
log.debug( "No thumbnail" ); | public void thumbnailCreated( PhotoInfo photo ) { repaintPhoto( photo ); Container parent = getParent(); Rectangle viewRect = null; if ( parent instanceof JViewport ) { viewRect = ((JViewport)parent).getViewRect(); } PhotoInfo nextPhoto = null; // Walk through all phoso until we find a photo that is visible // and does not have a thumbnail for ( int n = 0; n < photoCollection.getPhotoCount(); n++ ) { PhotoInfo photoCandidate = photoCollection.getPhoto( n ); if ( !photoCandidate.hasThumbnail() ) { Rectangle photoRect = getPhotoBounds( n ); if ( photoRect.intersects( viewRect ) ) { // This photo is visible so it is a perfect candidate // for thumbnail creation. Do not look further nextPhoto = photoCandidate; break; } else if ( nextPhoto == null ) { // Not visible but no photo without thumbnail has been // found previously. Store as a candidate and keep looking. nextPhoto = photoCandidate; } } } if ( nextPhoto != null && !thumbCreatorThread.isBusy() ) { final PhotoInfo p = nextPhoto;// SwingUtilities.invokeLater( new Runnable() {// public void run() { log.debug( "Making request for the next thumbail, " + p.getUid() ); thumbCreatorThread.createThumbnail( p ); log.debug( "request submitted" );// }// }); } } |
|
super.setUp(); SQLDatabase mydb = new SQLDatabase(db.getDataSource()); Connection con = mydb.getConnection(); Statement stmt = con.createStatement(); try { stmt.executeUpdate("DROP TABLE REGRESSION_TEST1"); stmt.executeUpdate("DROP TABLE REGRESSION_TEST2"); } catch (SQLException sqle ){ System.out.println("+++ TestSQLDatabase exception should be for dropping a non-existant table"); sqle.printStackTrace(); } stmt.executeUpdate("CREATE TABLE REGRESSION_TEST1 (t1_c1 numeric(10), t1_c2 numeric(5))"); stmt.executeUpdate("CREATE TABLE REGRESSION_TEST2 (t2_c1 char(10))"); stmt.close(); mydb.disconnect(); } | super.setUp(); } | protected void setUp() throws Exception { super.setUp(); SQLDatabase mydb = new SQLDatabase(db.getDataSource()); Connection con = mydb.getConnection(); /* * Setting up a clean db for each of the tests */ Statement stmt = con.createStatement(); try { stmt.executeUpdate("DROP TABLE REGRESSION_TEST1"); stmt.executeUpdate("DROP TABLE REGRESSION_TEST2"); } catch (SQLException sqle ){ System.out.println("+++ TestSQLDatabase exception should be for dropping a non-existant table"); sqle.printStackTrace(); } stmt.executeUpdate("CREATE TABLE REGRESSION_TEST1 (t1_c1 numeric(10), t1_c2 numeric(5))"); stmt.executeUpdate("CREATE TABLE REGRESSION_TEST2 (t2_c1 char(10))"); stmt.close(); mydb.disconnect(); } |
public void testInherit() throws ArchitectException { SQLTable table1; SQLTable table2; table1 = db.getTableByName("REGRESSION_TEST1"); table2 = db.getTableByName("REGRESSION_TEST2"); | public void testInherit() throws ArchitectException { SQLTable table1; SQLTable table2; table1 = db.getTableByName("REGRESSION_TEST1"); table2 = db.getTableByName("REGRESSION_TEST2"); assertEquals(2, table1.getColumns().size()); assertEquals(1, table2.getColumns().size()); | public void testInherit() throws ArchitectException { SQLTable table1; SQLTable table2; table1 = db.getTableByName("REGRESSION_TEST1"); table2 = db.getTableByName("REGRESSION_TEST2"); table2.inherit(table1); assertEquals("The wrong 1st column was inherited",table2.getColumn(0).toString(),table1.getColumn(0).toString()); assertEquals("The wrong 2nd column was inherited",table2.getColumn(1).toString(),table1.getColumn(1).toString()); assertEquals("The wrong number of columns were inherited",table2.getColumns().size(), 3); try { table2.inherit(table2); } catch (ArchitectException ae) { if ("Cannot inherit from self".equals(ae.getMessage())) { System.out.println("Expected Behaviour is to not be able to inherit from self"); } else { throw ae; } } } |
table2.inherit(table1); assertEquals("The wrong 1st column was inherited",table2.getColumn(0).toString(),table1.getColumn(0).toString()); assertEquals("The wrong 2nd column was inherited",table2.getColumn(1).toString(),table1.getColumn(1).toString()); assertEquals("The wrong number of columns were inherited",table2.getColumns().size(), 3); try { table2.inherit(table2); } catch (ArchitectException ae) { if ("Cannot inherit from self".equals(ae.getMessage())) { System.out.println("Expected Behaviour is to not be able to inherit from self"); } else { throw ae; } | table2.inherit(table1); assertEquals("The wrong 1st column was inherited", table1.getColumn(0).toString(), table2.getColumn(1).toString()); assertEquals("The wrong 2nd column was inherited", table1.getColumn(1).toString(), table2.getColumn(2).toString()); assertEquals("The wrong number of columns were inherited", table2.getColumns().size(), 3); try { table2.inherit(table2); } catch (ArchitectException ae) { if ("Cannot inherit from self".equals(ae.getMessage())) { System.out.println("Expected Behaviour is to not be able to inherit from self"); } else { throw ae; | public void testInherit() throws ArchitectException { SQLTable table1; SQLTable table2; table1 = db.getTableByName("REGRESSION_TEST1"); table2 = db.getTableByName("REGRESSION_TEST2"); table2.inherit(table1); assertEquals("The wrong 1st column was inherited",table2.getColumn(0).toString(),table1.getColumn(0).toString()); assertEquals("The wrong 2nd column was inherited",table2.getColumn(1).toString(),table1.getColumn(1).toString()); assertEquals("The wrong number of columns were inherited",table2.getColumns().size(), 3); try { table2.inherit(table2); } catch (ArchitectException ae) { if ("Cannot inherit from self".equals(ae.getMessage())) { System.out.println("Expected Behaviour is to not be able to inherit from self"); } else { throw ae; } } } |
} | public void testInherit() throws ArchitectException { SQLTable table1; SQLTable table2; table1 = db.getTableByName("REGRESSION_TEST1"); table2 = db.getTableByName("REGRESSION_TEST2"); table2.inherit(table1); assertEquals("The wrong 1st column was inherited",table2.getColumn(0).toString(),table1.getColumn(0).toString()); assertEquals("The wrong 2nd column was inherited",table2.getColumn(1).toString(),table1.getColumn(1).toString()); assertEquals("The wrong number of columns were inherited",table2.getColumns().size(), 3); try { table2.inherit(table2); } catch (ArchitectException ae) { if ("Cannot inherit from self".equals(ae.getMessage())) { System.out.println("Expected Behaviour is to not be able to inherit from self"); } else { throw ae; } } } |
|
public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); | public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; | public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); assertEquals("We removed a column when we shouldn't have",table1.getColumns().size(),2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed",table1.getColumns().size(),1); assertEquals("The wrong column was removed",col2,table1.getColumn(0)); table1.removeColumn(0); assertEquals("Last Column failed to be removed",table1.getColumns().size(),0); Exception exc = null; try { table1.removeColumn(0); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; } assertNotNull("Should have thrown an exception",exc); } |
assertEquals("We removed a column when we shouldn't have",table1.getColumns().size(),2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed",table1.getColumns().size(),1); assertEquals("The wrong column was removed",col2,table1.getColumn(0)); | table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); assertEquals("We removed a column when we shouldn't have", table1.getColumns().size(), 2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed", table1.getColumns().size(), 1); assertEquals("The wrong column was removed", col2, table1.getColumn(0)); table1.removeColumn(0); assertEquals("Last Column failed to be removed", table1.getColumns().size(), 0); Exception exc = null; try { | public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); assertEquals("We removed a column when we shouldn't have",table1.getColumns().size(),2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed",table1.getColumns().size(),1); assertEquals("The wrong column was removed",col2,table1.getColumn(0)); table1.removeColumn(0); assertEquals("Last Column failed to be removed",table1.getColumns().size(),0); Exception exc = null; try { table1.removeColumn(0); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; } assertNotNull("Should have thrown an exception",exc); } |
assertEquals("Last Column failed to be removed",table1.getColumns().size(),0); Exception exc = null; try { table1.removeColumn(0); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; } assertNotNull("Should have thrown an exception",exc); | } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; | public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); assertEquals("We removed a column when we shouldn't have",table1.getColumns().size(),2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed",table1.getColumns().size(),1); assertEquals("The wrong column was removed",col2,table1.getColumn(0)); table1.removeColumn(0); assertEquals("Last Column failed to be removed",table1.getColumns().size(),0); Exception exc = null; try { table1.removeColumn(0); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; } assertNotNull("Should have thrown an exception",exc); } |
assertNotNull("Should have thrown an exception", exc); } | public void testRemoveColumn() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); col1 = table1.getColumn(0); col2 = table1.getColumn(1); assertEquals("We removed a column when we shouldn't have",table1.getColumns().size(),2); table1.removeColumn(col1); assertEquals("Either 0 or 2+ columns were removed",table1.getColumns().size(),1); assertEquals("The wrong column was removed",col2,table1.getColumn(0)); table1.removeColumn(0); assertEquals("Last Column failed to be removed",table1.getColumns().size(),0); Exception exc = null; try { table1.removeColumn(0); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; } assertNotNull("Should have thrown an exception",exc); } |
|
public void testRemoveColumnOutBounds() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); Exception exc = null; try { table1.removeColumn(16); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc=e; } assertNotNull("Should have thrown an exception",exc); | public void testRemoveColumnOutBounds() throws ArchitectException { SQLTable table1; table1 = db.getTableByName("REGRESSION_TEST1"); Exception exc = null; try { table1.removeColumn(16); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc = e; | public void testRemoveColumnOutBounds() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); Exception exc = null; try { table1.removeColumn(16); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc=e; } assertNotNull("Should have thrown an exception",exc); } |
assertNotNull("Should have thrown an exception", exc); } | public void testRemoveColumnOutBounds() throws ArchitectException { SQLTable table1; SQLColumn col1; SQLColumn col2; table1 = db.getTableByName("REGRESSION_TEST1"); Exception exc = null; try { table1.removeColumn(16); } catch (IndexOutOfBoundsException e) { System.out.println("Method throws proper error"); exc=e; } assertNotNull("Should have thrown an exception",exc); } |
|
outputType = -1; | private void argHandler(String[] args){ //TODO: -specify values from HaplotypeDisplayController (min hap percentage etc) //TODO: -want to be able to output haps file from pedfile /* boolean nogui = false; String batchMode = ""; String hapsFileName = ""; String pedFileName = ""; String infoFileName = ""; String hapmapFileName = ""; String blockFileName = ""; boolean showCheck = false; boolean skipCheck = false; Vector ignoreMarkers = new Vector(); int outputType = -1; int maxDistance = -1; boolean quietMode = false; boolean outputDprime=false; boolean outputPNG = false; boolean outputSmallPNG = false; boolean outputCheck=false;*/ int maxDistance = -1; for(int i =0; i < args.length; i++) { if(args[i].equals("-help") || args[i].equals("-h")) { System.out.println(HELP_OUTPUT); System.exit(0); } else if(args[i].equals("-n") || args[i].equals("-nogui")) { nogui = true; } else if(args[i].equals("-p") || args[i].equals("-pedfile")) { i++; if( i>=args.length || (args[i].charAt(0) == '-')){ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } else{ if(pedFileName != null){ System.out.println("multiple "+args[i-1] + " arguments found. only last pedfile listed will be used"); } pedFileName = args[i]; } } else if (args[i].equals("-skipcheck") || args[i].equals("--skipcheck")){ skipCheck = true; } //todo: fix ignoremarkers /* else if (args[i].equals("--ignoremarkers")){ i++; if(i>=args.length || (args[i].charAt(0) == '-')){ System.out.println("--ignoremarkers requires a list of markers"); System.exit(1); } else { StringTokenizer str = new StringTokenizer(args[i],","); while(str.hasMoreTokens()) { ignoreMarkers.add(str.nextToken()); } } } */ else if(args[i].equals("-ha") || args[i].equals("-l") || args[i].equals("-haps")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } else{ if(hapsFileName != null){ System.out.println("multiple "+args[i-1] + " arguments found. only last haps file listed will be used"); } hapsFileName = args[i]; } } else if(args[i].equals("-i") || args[i].equals("-info")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } else{ if(infoFileName != null){ System.out.println("multiple "+args[i-1] + " arguments found. only last info file listed will be used"); } infoFileName = args[i]; } } else if (args[i].equals("-a") || args[i].equals("-hapmap")){ i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } else{ if(hapmapFileName != null){ System.out.println("multiple "+args[i-1] + " arguments found. only last hapmap file listed will be used"); } hapmapFileName = args[i]; } } else if(args[i].equals("-k") || args[i].equals("-blocks")) { i++; if (!(i>=args.length) && !((args[i].charAt(0)) == '-')){ blockFileName = args[i]; outputType = BLOX_CUSTOM; }else{ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } } else if (args[i].equalsIgnoreCase("-png")){ outputPNG = true; } else if (args[i].equalsIgnoreCase("-smallpng") || args[i].equalsIgnoreCase("-compressedPNG")){ outputCompressedPNG = true; } else if (args[i].equals("-track")){ i++; if (!(i>=args.length) && !((args[i].charAt(0)) == '-')){ trackFileName = args[i]; }else{ System.out.println("-track requires a filename"); System.exit(1); } } else if(args[i].equals("-o") || args[i].equals("-output") || args[i].equalsIgnoreCase("-blockoutput")) { i++; if(!(i>=args.length) && !((args[i].charAt(0)) == '-')){ if(outputType != -1){ System.out.println("only one output argument is allowed"); System.exit(1); } if(args[i].equalsIgnoreCase("SFS") || args[i].equalsIgnoreCase("GAB")){ outputType = BLOX_GABRIEL; } else if(args[i].equalsIgnoreCase("GAM")){ outputType = BLOX_4GAM; } else if(args[i].equalsIgnoreCase("MJD") || args[i].equalsIgnoreCase("SPI")){ outputType = BLOX_SPINE; } else if(args[i].equalsIgnoreCase("ALL")) { outputType = BLOX_ALL; } } else { //defaults to SFS output outputType = BLOX_GABRIEL; i--; } } else if(args[i].equals("-d") || args[i].equals("--dprime") || args[i].equals("-dprime")) { outputDprime = true; } else if (args[i].equals("-c") || args[i].equals("-check")){ outputCheck = true; } else if(args[i].equals("-m") || args[i].equals("-maxdistance")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println(args[i-1] + " requires an integer argument"); System.exit(1); } else { if(maxDistance != -1){ System.out.println("only one "+args[i-1] + " argument allowed"); System.exit(1); } maxDistance = Integer.parseInt(args[i]); if(maxDistance<0){ System.out.println(args[i-1] + " argument must be a positive integer"); System.exit(1); } } } else if(args[i].equals("-b") || args[i].equals("-batch")) { //batch mode i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println(args[i-1] + " requires a filename"); System.exit(1); } else{ if(batchFileName != null){ System.out.println("multiple " + args[i-1] + " arguments found. only last batch file listed will be used"); } batchFileName = args[i]; } } else if(args[i].equals("-q") || args[i].equals("-quiet")) { quietMode = true; } else { System.out.println("invalid parameter specified: " + args[i]); } } int countOptions = 0; if(pedFileName != null) { countOptions++; } if(hapsFileName != null) { countOptions++; } if(hapmapFileName != null) { countOptions++; } if(batchFileName != null) { countOptions++; } if(countOptions > 1) { System.out.println("Only one genotype input file may be specified on the command line."); System.exit(1); } else if(countOptions == 0) { System.out.println("You must specify a genotype input file."); System.exit(1); } //mess with vars, set defaults, etc if( outputType == -1 && ( pedFileName != null || hapsFileName != null || batchFileName != null || hapmapFileName != null) && !outputDprime && !outputCheck && !outputPNG && !outputCompressedPNG) { outputType = BLOX_GABRIEL; if(nogui && !quietMode) { System.out.println("No output type specified. Default of Gabriel will be used"); } } if(skipCheck && !quietMode) { System.out.println("Skipping genotype file check"); } if(maxDistance == -1){ maxDistance = 500; } Options.setMaxDistance(maxDistance); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.