bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
protected Object newInstance( Class theClass, Map attributes, XMLOutput output) throws JellyTagException { int style = getStyle(attributes); // now lets call the constructor with the parent Widget parent = getParentWidget(); Widget widget = (Widget) createWidget(theClass, parent, style); if (parent != null) { attachWidgets(parent, widget); } return widget; }
protected Object newInstance( Class theClass, Map attributes, XMLOutput output) throws JellyTagException { int style = getStyle(attributes); // now lets call the constructor with the parent Widget parent = getParentWidget(); Widget widget = (Widget) createWidget(theClass, parent, style); if (parent != null) { attachWidgets(parent, widget); } return widget; }
1,110,056
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0, haploid = 0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,057
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,058
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,059
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; if (!Chromosome.getDataChrom().equals("chrx") || currentInd.getGender() != 1) { if(allele1 != allele2) { founderHetCount++; }else{ founderHomCount[allele1]++; } count[allele2]++; } }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,060
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,061
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(_pedFile.getFamList(), founderGenoCount, kidgeno); //rating int rating = this.getRating(genopct, pvalue, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
private MarkerResult checkMarker(int loc)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, founderHetCount=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable founderGenoCount = new Hashtable(); Hashtable kidgeno = new Hashtable(); //Hashtable parenthom = new Hashtable(); int[] founderHomCount = new int[5]; //Hashtable count = new Hashtable(); int[] count = new int[5]; for(int i=0;i<5;i++) { founderHomCount[i] =0; count[i]=0; } //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); //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())).getMarkerA(loc); int momAllele2 = (currentFamily.getMember(currentInd.getMomID())).getMarkerB(loc); int dadAllele1 = (currentFamily.getMember(currentInd.getDadID())).getMarkerA(loc); int dadAllele2 = (currentFamily.getMember(currentInd.getDadID())).getMarkerB(loc); if(Chromosome.getDataChrom().equalsIgnoreCase("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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } }else { //kid must be het if(allele1 == allele2 ){ mendErrNum ++; 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 ++; 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 ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } } //end mendel check } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getZeroed(loc)){ allele1 = 0; allele2 = 0; }else{ allele1 = currentInd.getMarkerA(loc); allele2 = currentInd.getMarkerB(loc); } String familyID = currentInd.getFamilyID(); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has no parents -- i.e. is a founder if(!currentFamily.hasAncestor(currentInd.getIndividualID())){ //set founderGenoCount if(founderGenoCount.containsKey(familyID)){ int value = ((Integer)founderGenoCount.get(familyID)).intValue() +1; founderGenoCount.put(familyID, new Integer(value)); } else{ founderGenoCount.put(familyID, new Integer(1)); } if(allele1 != allele2) { founderHetCount++; } else{ founderHomCount[allele1]++; } count[allele1]++; count[allele2]++; }else{ if(kidgeno.containsKey(familyID)){ int value = ((Integer)kidgeno.get(familyID)).intValue() +1; kidgeno.put(familyID, new Integer(value)); } else{ kidgeno.put(familyID, new Integer(1)); } } if(allele1 == allele2) { hom++; } else { het++; } } //missing data else missing++; } } double obsHET = getObsHET(het, hom); double freqStuff[] = null; try{ freqStuff = getFreqStuff(count); }catch (PedFileException pfe){ throw new PedFileException("More than two alleles at marker " + (loc+1)); } double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(founderHomCount, founderHetCount); //geno percent double genopct = getGenoPercent(het, hom, 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); result.setObsHet(obsHET); result.setPredHet(preHET); result.setMAF(maf); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); return result; }
1,110,062
private double getGenoPercent(int het, int hom, int missing){ if (het+hom+missing == 0){ return 0; }else{ return 100.0*(het+hom)/(het+hom+missing); } }
private double getGenoPercent(int het, int hom, int missing){ if (het+hom+missing == 0){ return 0; }else{ return 100.0*(het+hom)/(het+hom+missing); } }
1,110,063
private double getGenoPercent(int het, int hom, int missing){ if (het+hom+missing == 0){ return 0; }else{ return 100.0*(het+hom)/(het+hom+missing); } }
private double getGenoPercent(int het, int hom, int missing){ if (het+hom+missing == 0){ return 0; }else{ return 100.0*(het+hom+haploid)/(het+hom+haploid+missing); } }
1,110,064
public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws JellyException { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { log.info( "Parsing XPath expression: " + attributeValue ); try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return null; }
public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws JellyException { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return null; }
1,110,065
public void doTag(final XMLOutput output) throws Exception { AttainTag attainTag = (AttainTag) findAncestorWithClass( AttainTag.class ); Session session = null; if ( attainTag == null ) { session = new JellySession( output ); } else { session = attainTag.getSession(); } ProjectTag projectTag = (ProjectTag) findAncestorWithClass( ProjectTag.class ); Project project = projectTag.getProject(); invokeBody(output); try { project.attainGoal( getName(), session ); } catch (UnattainableGoalException e) { Throwable root = e.getRootCause(); if ( root != null ) { if ( root instanceof JellyException ) { throw (JellyException) root; } if ( root instanceof UnattainableGoalException ) { throw e; } } else { e.fillInStackTrace(); throw e; } } }
public void doTag(final XMLOutput output) throws Exception { AttainTag attainTag = (AttainTag) findAncestorWithClass( AttainTag.class ); Session session = null; if ( attainTag == null ) { session = new JellySession( output ); } else { session = attainTag.getSession(); } ProjectTag projectTag = (ProjectTag) findAncestorWithClass( ProjectTag.class ); Project project = projectTag.getProject(); invokeBody(output); try { project.attainGoal( getName(), session ); } catch (UnattainableGoalException e) { Throwable root = e.getRootCause(); if ( root != null ) { if ( root instanceof JellyException ) { throw (JellyException) root; } if ( root instanceof UnattainableGoalException ) { throw e; } } else { e.fillInStackTrace(); throw e; } } }
1,110,066
public void flush() throws IOException { ((XMLWriter)contentHandler).flush(); }
public void flush() throws IOException { if( contentHandler instanceof XMLWriter ) { ((XMLWriter)contentHandler).flush(); } }
1,110,067
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; //todo: Need something better String appId = String.valueOf(System.currentTimeMillis()); ApplicationConfig config = ApplicationConfigFactory.create(appId, appForm.getName(), appForm.getType(), appForm.getHost(), new Integer(appForm.getPort()), null, appForm.getUsername(), appForm.getPassword(), null); ApplicationConfigManager.addApplication(config); return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { ApplicationForm appForm = (ApplicationForm)actionForm; //todo: Need something better String appId = String.valueOf(System.currentTimeMillis()); ApplicationConfig config = ApplicationConfigFactory.create(appId, appForm.getName(), appForm.getType(), appForm.getHost(), new Integer(appForm.getPort()), null, appForm.getUsername(), appForm.getPassword(), null); ApplicationConfigManager.addApplication(config); return mapping.findForward(Forwards.SUCCESS); }
1,110,068
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; //todo: Need something better String appId = String.valueOf(System.currentTimeMillis()); ApplicationConfig config = ApplicationConfigFactory.create(appId, appForm.getName(), appForm.getType(), appForm.getHost(), new Integer(appForm.getPort()), null, appForm.getUsername(), appForm.getPassword(), null); ApplicationConfigManager.addApplication(config); return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; //todo: Need something better String appId = String.valueOf(System.currentTimeMillis()); ApplicationConfig config = ApplicationConfigFactory.create(appId, appForm.getName(), appForm.getType(), appForm.getHost(), port, null, appForm.getUsername(), appForm.getPassword(), null); ApplicationConfigManager.addApplication(config); return mapping.findForward(Forwards.SUCCESS); }
1,110,069
public void setAttribute(String name, Object value) { if ( value == null ) { // should we send in null? super.setAttribute( name, "" ); } else { super.setAttribute( name, value.toString() ); } }
public void setAttribute(String name, Object value) { if ( value == null ) { // should we send in null? super.setAttribute( name, "" ); } else { if ( value instanceof Expression ) { super.setAttribute( name, ((Expression) value).evaluateAsValue(context) ); } else { super.setAttribute( name, value.toString() ); } } }
1,110,071
private void applicationChanged(ApplicationConfig appConfig) { ApplicationHeartBeatThread associatedThread = null; for(ApplicationHeartBeatThread thread:threads){ if(thread.getApplicationConfig().equals(appConfig)){ associatedThread = thread; break; } } if(associatedThread == null){ logger.log(Level.WARNING, "Thread not found for application: {0}", appConfig); }else{ threads.remove(associatedThread); addApplication(appConfig); } }
private void applicationChanged(ApplicationConfig appConfig) { ApplicationHeartBeatThread associatedThread = null; for(ApplicationHeartBeatThread thread:threads){ if(thread.getApplicationConfig().equals(appConfig)){ associatedThread = thread; break; } } if(associatedThread == null){ logger.log(Level.WARNING, "Thread not found for application: {0}", appConfig); }else{ threads.remove(associatedThread); addApplication(appConfig); } }
1,110,072
protected void configure() { // load the properties file of libraries available InputStream in = null; URL url = getClassLoader().getResource("org/apache/commons/jelly/jelly.properties"); if (url != null) { log.debug("Loading Jelly default tag libraries from: " + url); Properties properties = new Properties(); try { in = url.openStream(); properties.load(in); for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getKey(); String className = (String) entry.getValue(); String libraryURI = "jelly:" + uri; // don't overload any Mock Tags already if ( ! context.isTagLibraryRegistered(libraryURI) ) { context.registerTagLibrary(libraryURI, className); } } } catch (IOException e) { log.error("Could not load jelly properties from: " + url + ". Reason: " + e, e); } finally { try { in.close(); } catch (Exception e) { // ignore } } } }
protected void configure() { // load the properties file of libraries available InputStream in = null; URL url = getClassLoader().getResource("org/apache/commons/jelly/jelly.properties"); if (url != null) { log.debug("Loading Jelly default tag libraries from: " + url); Properties properties = new Properties(); try { in = url.openStream(); properties.load(in); for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getKey(); String className = (String) entry.getValue(); String libraryURI = "jelly:" + uri; // don't overload any Mock Tags already if ( ! context.isTagLibraryRegistered(libraryURI) ) { context.registerTagLibrary(libraryURI, className); } } } catch (IOException e) { log.error("Could not load jelly properties from: " + url + ". Reason: " + e, e); } finally { try { in.close(); } catch (Exception e) { // ignore } } } }
1,110,075
public void doTag(XMLOutput output) throws Exception { value = false; if ( test != null ) { if ( test.evaluateAsBoolean( context ) ) { value = true; invokeBody(output); } } }
public void doTag(XMLOutput output) throws Exception { value = false; if ( test != null ) { if ( test.evaluateAsBoolean( context ) ) { value = true; invokeBody(output); } } }
1,110,076
public void doTag(XMLOutput output) throws Exception { value = false; if ( test != null ) { if ( test.evaluateAsBoolean( context ) ) { value = true; invokeBody(output); } } }
public void doTag(XMLOutput output) throws Exception { value = false; if ( test != null ) { if ( test.evaluateAsBoolean( context ) ) { tag.setBlockEvaluated(true); invokeBody(output); } } }
1,110,077
public void doTag(final XMLOutput output) throws Exception { String name = getName(); if ( name == null ) { name = toString(); } // #### we need to redirect the output to a TestListener // or something? TestCase testCase = new TestCase(name) { protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // disable inheritence of variables and tag libraries newContext.setExportLibraries(false); newContext.setExport(false); // invoke the test case getBody().run(newContext, output); } }; // lets find the test suite TestSuite suite = getSuite(); if ( suite == null ) { throw new JellyException( "Could not find a TestSuite to add this test to. This tag should be inside a <test:suite> tag" ); } suite.addTest(testCase); }
public void doTag(final XMLOutput output) throws JellyTagException { String name = getName(); if ( name == null ) { name = toString(); } // #### we need to redirect the output to a TestListener // or something? TestCase testCase = new TestCase(name) { protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // disable inheritence of variables and tag libraries newContext.setExportLibraries(false); newContext.setExport(false); // invoke the test case getBody().run(newContext, output); } }; // lets find the test suite TestSuite suite = getSuite(); if ( suite == null ) { throw new JellyException( "Could not find a TestSuite to add this test to. This tag should be inside a <test:suite> tag" ); } suite.addTest(testCase); }
1,110,079
public void doTag(final XMLOutput output) throws Exception { String name = getName(); if ( name == null ) { name = toString(); } // #### we need to redirect the output to a TestListener // or something? TestCase testCase = new TestCase(name) { protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // disable inheritence of variables and tag libraries newContext.setExportLibraries(false); newContext.setExport(false); // invoke the test case getBody().run(newContext, output); } }; // lets find the test suite TestSuite suite = getSuite(); if ( suite == null ) { throw new JellyException( "Could not find a TestSuite to add this test to. This tag should be inside a <test:suite> tag" ); } suite.addTest(testCase); }
public void doTag(final XMLOutput output) throws Exception { String name = getName(); if ( name == null ) { name = toString(); } // #### we need to redirect the output to a TestListener // or something? TestCase testCase = new TestCase(name) { protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // disable inheritence of variables and tag libraries newContext.setExportLibraries(false); newContext.setExport(false); // invoke the test case getBody().run(newContext, output); } }; // lets find the test suite TestSuite suite = getSuite(); if ( suite == null ) { throw new JellyTagException( "Could not find a TestSuite to add this test to. This tag should be inside a <test:suite> tag" ); } suite.addTest(testCase); }
1,110,080
private ListItem(final Document document) { super("DocumentListAvatar$ListItem", listItemBackground); this.document = document; this.selectionTimer = new Timer(500, new ActionListener() { public void actionPerformed(final ActionEvent e) { selectDocument(document.getId()); } }); setLayout(new GridBagLayout()); addMouseListener(this); final GridBagConstraints c = new GridBagConstraints(); final String iconPath = isClosed() ? "images/documentIconGray.png" : "images/documentIconBlue.png"; final JLabel documentIcon = LabelFactory.create(); documentIcon.setIcon(new ImageIcon(ResourceUtil.getURL(iconPath))); documentIcon.addMouseListener(new MouseAdapter() { public void mouseEntered(final MouseEvent e) { setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(final MouseEvent e) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); c.insets = new Insets(0, 16, 0, 0); add(documentIcon, c.clone()); // h: 20 px // x indent: 40 px c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(3, 16, 3, 0); final Font labelFont = hasBeenSeen() ? UIConstants.DefaultFont : UIConstants.DefaultFontBold; add(LabelFactory.create(labelFont, document.getName()), c.clone()); }
private ListItem(final Document document) { super("DocumentListAvatar$ListItem", listItemBackground); this.document = document; this.selectionTimer = new Timer(500, new ActionListener() { public void actionPerformed(final ActionEvent e) { selectDocument(document.getId()); } }); setLayout(new GridBagLayout()); addMouseListener(this); final GridBagConstraints c = new GridBagConstraints(); final String iconPath = isClosed() ? "images/documentIconGray.png" : "images/documentIconBlue.png"; final JLabel documentIcon = LabelFactory.create(); documentIcon.setIcon(new ImageIcon(ResourceUtil.getURL(iconPath))); documentIcon.addMouseListener(new MouseAdapter() { public void mouseEntered(final MouseEvent e) { setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(final MouseEvent e) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); c.insets = new Insets(0, 16, 0, 0); add(documentIcon, c.clone()); // h: 20 px // x indent: 40 px c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(3, 16, 3, 0); final Font labelFont = hasBeenSeen() ? UIConstants.DefaultFont : UIConstants.DefaultFontBold; add(LabelFactory.create(labelFont, document.getName()), c.clone()); }
1,110,085
public void mouseEntered(final MouseEvent e) { startSelectionTimer(); }
public void mouseEntered(final MouseEvent e) { selectDocument(document.getId()); }
1,110,086
public void mouseExited(final MouseEvent e) { stopSelectionTimer(); unselect(); }
public void mouseExited(final MouseEvent e) { stopSelectionTimer(); unselect(); }
1,110,087
private void select() { selectionTimer.stop(); setBackground(listItemBackgroundSelect); repaint(); }
private void select() { setBackground(listItemBackgroundSelect); repaint(); }
1,110,088
private void selectDocument(final UUID documentId) { Assert.assertNotNull("Cannot select null document.", documentId); // if it's the same do nothing if(this.currentSelection == documentId || documentId.equals(currentSelection)) { return; } final Collection<Component> listItems = documentItemMap.values(); for(Component c : listItems) { ((ListItem) c).unselect(); } final ListItem listItem = (ListItem) documentItemMap.get(documentId); listItem.select(); controller.selectDocument(documentId); }
private void selectDocument(final UUID documentId) { Assert.assertNotNull("Cannot select null document.", documentId); // if it's the same do nothing if(this.currentSelection == documentId || documentId.equals(currentSelection)) { return; } final Collection<Component> listItems = documentItemMap.values(); for(Component c : listItems) { ((ListItem) c).unselect(); } final ListItem listItem = (ListItem) documentItemMap.get(documentId); listItem.select(); currentSelection = documentId; selectionTimer.start(); }
1,110,090
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,091
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,092
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,093
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); TablePane tp = c.importTableCopy(sourceTable, dropLoc); dropLoc.x += tp.getPreferredSize().width + 5; } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,094
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { logger.error(ufe); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,095
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { logger.error(ioe); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
1,110,096
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { ex.printStackTrace(); dtde.rejectDrop(); } catch (ArchitectException ex) { ex.printStackTrace(); dtde.rejectDrop(); } } }
public void drop(DropTargetDropEvent dtde) { if (tpTarget != null) { tpTarget.getDropTarget().drop(dtde); return; } Transferable t = dtde.getTransferable(); PlayPen c = (PlayPen) dtde.getDropTargetContext().getComponent(); DataFlavor importFlavor = bestImportFlavor(c, t.getTransferDataFlavors()); if (importFlavor == null) { dtde.rejectDrop(); } else { try { DBTree dbtree = ArchitectFrame.getMainInstance().dbTree; // XXX: this is bad ArrayList paths = (ArrayList) t.getTransferData(importFlavor); Iterator pathIt = paths.iterator(); Point dropLoc = c.unzoomPoint(new Point(dtde.getLocation())); while (pathIt.hasNext()) { Object someData = dbtree.getNodeForDnDPath((int[]) pathIt.next()); if (someData instanceof SQLTable) { dtde.acceptDrop(DnDConstants.ACTION_COPY); c.importTableCopy((SQLTable) someData, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLSchema) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLSchema sourceSchema = (SQLSchema) someData; c.addSchema(sourceSchema, dropLoc); dtde.dropComplete(true); return; } else if (someData instanceof SQLCatalog) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLCatalog sourceCatalog = (SQLCatalog) someData; Iterator cit = sourceCatalog.getChildren().iterator(); if (sourceCatalog.isSchemaContainer()) { while (cit.hasNext()) { SQLSchema sourceSchema = (SQLSchema) cit.next(); c.addSchema(sourceSchema, dropLoc); } } else { while (cit.hasNext()) { SQLTable sourceTable = (SQLTable) cit.next(); c.importTableCopy(sourceTable, dropLoc); } } dtde.dropComplete(true); return; } else if (someData instanceof SQLColumn) { dtde.acceptDrop(DnDConstants.ACTION_COPY); SQLColumn column = (SQLColumn) someData; JLabel colName = new JLabel(column.getColumnName()); colName.setSize(colName.getPreferredSize()); c.add(colName, dropLoc); logger.debug("Added "+column.getColumnName()+" to playpen (temporary, only for testing)"); colName.revalidate(); dtde.dropComplete(true); return; } else { dtde.rejectDrop(); } } } catch (UnsupportedFlavorException ufe) { ufe.printStackTrace(); dtde.rejectDrop(); } catch (IOException ioe) { ioe.printStackTrace(); dtde.rejectDrop(); } catch (InvalidDnDOperationException ex) { logger.error(ex); dtde.rejectDrop(); } catch (ArchitectException ex) { logger.error(ex); dtde.rejectDrop(); } } }
1,110,097
public void setAttribute(String name, Object value) { // Catch the normal setAttribute, and call throw Ant's // normal property-deref routines. Project project = task.getProject(); String newValue = project.replaceProperties( (String) value ); super.setAttribute( name, newValue ); }
public void setAttribute(String name, Object value) { // Catch the normal setAttribute, and call throw Ant's // normal property-deref routines. Project project = task.getProject(); String newValue = ProjectHelper.replaceProperties( project, (String) value, project.getProperties() ); super.setAttribute( name, newValue ); }
1,110,099
protected void trimBody() { synchronized(body) { // #### should refactor this code into // #### trimWhitespace() methods on the Script objects if ( body instanceof CompositeTextScriptBlock ) { CompositeTextScriptBlock block = (CompositeTextScriptBlock) body; List list = block.getScriptList(); int size = list.size(); if ( size > 0 ) { Script script = (Script) list.get(0); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimStartWhitespace(); } if ( size > 1 ) { script = (Script) list.get(size - 1); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimEndWhitespace(); } } } } else if ( body instanceof ScriptBlock ) { ScriptBlock block = (ScriptBlock) body; List list = block.getScriptList(); for ( int i = list.size() - 1; i >= 0; i-- ) { Script script = (Script) list.get(i); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; String text = textScript.getText(); text = text.trim(); if ( text.length() == 0 ) { list.remove(i); } else { textScript.setText(text); } } } } else if ( body instanceof TextScript ) { TextScript textScript = (TextScript) body; textScript.trimWhitespace(); } } }
protected void trimBody() { synchronized(body) { // #### should refactor this code into // #### trimWhitespace() methods on the Script objects if ( body instanceof CompositeTextScriptBlock ) { CompositeTextScriptBlock block = (CompositeTextScriptBlock) body; List list = block.getScriptList(); int size = list.size(); if ( size > 0 ) { Script script = (Script) list.get(0); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimStartWhitespace(); } if ( size > 1 ) { script = (Script) list.get(size - 1); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimEndWhitespace(); } } } } else if ( body instanceof ScriptBlock ) { ScriptBlock block = (ScriptBlock) body; List list = block.getScriptList(); for ( int i = list.size() - 1; i >= 0; i-- ) { Script script = (Script) list.get(i); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; String text = textScript.getText(); text = text.trim(); if ( text.length() == 0 ) { list.remove(i); } else { textScript.setText(text); } } } } else if ( body instanceof TextScript ) { TextScript textScript = (TextScript) body; textScript.trimWhitespace(); } } }
1,110,100
protected void trimBody() { synchronized(body) { // #### should refactor this code into // #### trimWhitespace() methods on the Script objects if ( body instanceof CompositeTextScriptBlock ) { CompositeTextScriptBlock block = (CompositeTextScriptBlock) body; List list = block.getScriptList(); int size = list.size(); if ( size > 0 ) { Script script = (Script) list.get(0); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimStartWhitespace(); } if ( size > 1 ) { script = (Script) list.get(size - 1); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimEndWhitespace(); } } } } else if ( body instanceof ScriptBlock ) { ScriptBlock block = (ScriptBlock) body; List list = block.getScriptList(); for ( int i = list.size() - 1; i >= 0; i-- ) { Script script = (Script) list.get(i); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; String text = textScript.getText(); text = text.trim(); if ( text.length() == 0 ) { list.remove(i); } else { textScript.setText(text); } } } } else if ( body instanceof TextScript ) { TextScript textScript = (TextScript) body; textScript.trimWhitespace(); } } }
protected void trimBody() { synchronized(body) { // #### should refactor this code into // #### trimWhitespace() methods on the Script objects if ( body instanceof CompositeTextScriptBlock ) { CompositeTextScriptBlock block = (CompositeTextScriptBlock) body; List list = block.getScriptList(); int size = list.size(); if ( size > 0 ) { Script script = (Script) list.get(0); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimStartWhitespace(); } if ( size > 1 ) { script = (Script) list.get(size - 1); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; textScript.trimEndWhitespace(); } } } } else if ( body instanceof ScriptBlock ) { ScriptBlock block = (ScriptBlock) body; List list = block.getScriptList(); for ( int i = list.size() - 1; i >= 0; i-- ) { Script script = (Script) list.get(i); if ( script instanceof TextScript ) { TextScript textScript = (TextScript) script; String text = textScript.getText(); text = text.trim(); if ( text.length() == 0 ) { list.remove(i); } else { textScript.setText(text); } } } } else if ( body instanceof TextScript ) { TextScript textScript = (TextScript) body; textScript.trimWhitespace(); } } }
1,110,101
public void parseHapMap(Vector rawLines) throws PedFileException { int colNum = -1; int numLines = rawLines.size(); Individual ind; this.order = new Vector(); //sort first Vector lines = new Vector(); Hashtable sortHelp = new Hashtable(numLines-1,1.0f); long[] pos = new long[numLines-1]; lines.add(rawLines.get(0)); for (int k = 1; k < numLines; k++){ StringTokenizer st = new StringTokenizer((String) rawLines.get(k)); //strip off 1st 3 cols st.nextToken();st.nextToken();st.nextToken(); pos[k-1] = new Long(st.nextToken()).longValue(); sortHelp.put(new Long(pos[k-1]),rawLines.get(k)); } Arrays.sort(pos); for (int i = 0; i < pos.length; i++){ lines.add(sortHelp.get(new Long(pos[i]))); } //enumerate indivs StringTokenizer st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); int numMetaColumns = 0; boolean doneMeta = false; while(!doneMeta && st.hasMoreTokens()){ String thisfield = st.nextToken(); numMetaColumns++; //first indiv ID will be a string beginning with "NA" if (thisfield.startsWith("NA")){ doneMeta = true; } } numMetaColumns--; st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); for (int i = 0; i < numMetaColumns; i++){ st.nextToken(); } Vector namesIncludingDups = new Vector(); StringTokenizer dt; while (st.hasMoreTokens()){ ind = new Individual(numLines); String name = st.nextToken(); namesIncludingDups.add(name); if (name.endsWith("dup")){ //skip dups (i.e. don't add 'em to ind array) continue; } String details = (String)hapMapTranslate.get(name); if (details == null){ throw new PedFileException("Hapmap data format error: " + name); } dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); ind.setIndividualID(dt.nextToken().trim()); ind.setDadID(dt.nextToken().trim()); ind.setMomID(dt.nextToken().trim()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + name); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } //start at k=1 to skip header which we just processed above. hminfo = new String[numLines-1][]; for(int k=1;k<numLines;k++){ StringTokenizer tokenizer = new StringTokenizer((String)lines.get(k)); //reading the first line if(colNum < 0){ //only check column number count for the first line colNum = tokenizer.countTokens(); } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in input file. line " + (k+1)); } if(tokenizer.hasMoreTokens()){ hminfo[k-1] = new String[2]; for (int skip = 0; skip < numMetaColumns; skip++){ //meta-data crap String s = tokenizer.nextToken().trim(); //get marker name, chrom and pos if (skip == 0){ hminfo[k-1][0] = s; } if (skip == 2){ String dc = Chromosome.getDataChrom(); if (dc != null){ if (dc.equalsIgnoreCase(s)){ throw new PedFileException("Hapmap file format error on line " + (k+1) + ":\n The file appears to contain multiple chromosomes:" + "\n" + dc + ", " + s); } }else{ Chromosome.setDataChrom(s); } } if (skip == 3){ hminfo[k-1][1] = s; } } int index = 0; int indexIncludingDups = -1; while(tokenizer.hasMoreTokens()){ String alleles = tokenizer.nextToken(); indexIncludingDups++; //we've skipped the dups in the ind array, so we skip their genotypes if (((String)namesIncludingDups.elementAt(indexIncludingDups)).endsWith("dup")){ continue; } ind = (Individual)order.elementAt(index); int allele1=0, allele2=0; if (alleles.substring(0,1).equals("A")){ allele1 = 1; }else if (alleles.substring(0,1).equals("C")){ allele1 = 2; }else if (alleles.substring(0,1).equals("G")){ allele1 = 3; }else if (alleles.substring(0,1).equals("T")){ allele1 = 4; } if (alleles.substring(1,2).equals("A")){ allele2 = 1; }else if (alleles.substring(1,2).equals("C")){ allele2 = 2; }else if (alleles.substring(1,2).equals("G")){ allele2 = 3; }else if (alleles.substring(1,2).equals("T")){ allele2 = 4; } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); index++; } } } }
public void parseHapMap(Vector rawLines) throws PedFileException { int colNum = -1; int numLines = rawLines.size(); Individual ind; this.order = new Vector(); //sort first Vector lines = new Vector(); Hashtable sortHelp = new Hashtable(numLines-1,1.0f); long[] pos = new long[numLines-1]; lines.add(rawLines.get(0)); for (int k = 1; k < numLines; k++){ StringTokenizer st = new StringTokenizer((String) rawLines.get(k)); //strip off 1st 3 cols st.nextToken();st.nextToken();st.nextToken(); pos[k-1] = new Long(st.nextToken()).longValue(); sortHelp.put(new Long(pos[k-1]),rawLines.get(k)); } Arrays.sort(pos); for (int i = 0; i < pos.length; i++){ lines.add(sortHelp.get(new Long(pos[i]))); } //enumerate indivs StringTokenizer st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); int numMetaColumns = 0; boolean doneMeta = false; while(!doneMeta && st.hasMoreTokens()){ String thisfield = st.nextToken(); numMetaColumns++; //first indiv ID will be a string beginning with "NA" if (thisfield.startsWith("NA")){ doneMeta = true; } } numMetaColumns--; st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); for (int i = 0; i < numMetaColumns; i++){ st.nextToken(); } Vector namesIncludingDups = new Vector(); StringTokenizer dt; while (st.hasMoreTokens()){ ind = new Individual(numLines); String name = st.nextToken(); namesIncludingDups.add(name); if (name.endsWith("dup")){ //skip dups (i.e. don't add 'em to ind array) continue; } String details = (String)hapMapTranslate.get(name); if (details == null){ throw new PedFileException("Hapmap data format error: " + name); } dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); ind.setIndividualID(dt.nextToken().trim()); ind.setDadID(dt.nextToken().trim()); ind.setMomID(dt.nextToken().trim()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + name); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } //start at k=1 to skip header which we just processed above. hminfo = new String[numLines-1][]; for(int k=1;k<numLines;k++){ StringTokenizer tokenizer = new StringTokenizer((String)lines.get(k)); //reading the first line if(colNum < 0){ //only check column number count for the first line colNum = tokenizer.countTokens(); } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in input file. line " + (k+1)); } if(tokenizer.hasMoreTokens()){ hminfo[k-1] = new String[2]; for (int skip = 0; skip < numMetaColumns; skip++){ //meta-data crap String s = tokenizer.nextToken().trim(); //get marker name, chrom and pos if (skip == 0){ hminfo[k-1][0] = s; } if (skip == 2){ String dc = Chromosome.getDataChrom(); if (dc != null){ if (!dc.equalsIgnoreCase(s)){ throw new PedFileException("Hapmap file format error on line " + (k+1) + ":\n The file appears to contain multiple chromosomes:" + "\n" + dc + ", " + s); } }else{ Chromosome.setDataChrom(s); } } if (skip == 3){ hminfo[k-1][1] = s; } } int index = 0; int indexIncludingDups = -1; while(tokenizer.hasMoreTokens()){ String alleles = tokenizer.nextToken(); indexIncludingDups++; //we've skipped the dups in the ind array, so we skip their genotypes if (((String)namesIncludingDups.elementAt(indexIncludingDups)).endsWith("dup")){ continue; } ind = (Individual)order.elementAt(index); int allele1=0, allele2=0; if (alleles.substring(0,1).equals("A")){ allele1 = 1; }else if (alleles.substring(0,1).equals("C")){ allele1 = 2; }else if (alleles.substring(0,1).equals("G")){ allele1 = 3; }else if (alleles.substring(0,1).equals("T")){ allele1 = 4; } if (alleles.substring(1,2).equals("A")){ allele2 = 1; }else if (alleles.substring(1,2).equals("C")){ allele2 = 2; }else if (alleles.substring(1,2).equals("G")){ allele2 = 3; }else if (alleles.substring(1,2).equals("T")){ allele2 = 4; } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); index++; } } } }
1,110,102
public void compoundEditEnd(UndoCompoundEvent e) { if (compoundDepth == 0) throw new IllegalStateException("Not in a compound edit"); compoundDepth--; if (compoundDepth == 0) { log.add(currentCompoundLog); currentCompoundLog = null; } }
public void compoundEditEnd(UndoCompoundEvent e) { if (compoundDepth == 0) throw new IllegalStateException("Not in a compound edit"); compoundDepth--; if (compoundDepth == 0) { log.add(currentCompoundLog); currentCompoundLog = null; } }
1,110,103
public void compoundEditStart(UndoCompoundEvent e) { compoundDepth++; if (compoundDepth == 1) { currentCompoundLog = new ArrayList(); } }
public void compoundEditStart(UndoCompoundEvent e) { compoundDepth++; if (compoundDepth == 1) { currentCompoundLog = new ArrayList(); } }
1,110,104
public void dbChildrenInserted(SQLObjectEvent e) { log.add(e); }
public void dbChildrenInserted(SQLObjectEvent e) { addToLog(LogItemType.INSERT, e); }
1,110,105
public void dbChildrenRemoved(SQLObjectEvent e) { log.add(e); }
public void dbChildrenRemoved(SQLObjectEvent e) { addToLog(LogItemType.REMOVE, e); }
1,110,106
public void dbObjectChanged(SQLObjectEvent e) { log.add(e); }
public void dbObjectChanged(SQLObjectEvent e) { addToLog(LogItemType.CHANGE, e); }
1,110,107
public void dbStructureChanged(SQLObjectEvent e) { log.add(e); }
public void dbStructureChanged(SQLObjectEvent e) { throw new UnsupportedOperationException("Structure changes are not undoable"); }
1,110,108
public List<Map<String,Object>> makeTableSnapshot(SQLTable t) { return null; //TODO: finish method }
public List<Map<String,Object>> makeTableSnapshot(SQLTable t) { return null; //TODO: finish method }
1,110,109
public void testChangeFifthColumnKey() throws ArchitectException{ SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); col5.setPrimaryKeySeq(0); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); }
public void testChangeFifthColumnKey() throws Exception { EventLogger l = new EventLogger(); SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); col5.setPrimaryKeySeq(0); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); }
1,110,110
public void testChangeFifthColumnKey() throws ArchitectException{ SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); col5.setPrimaryKeySeq(0); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); }
public void testChangeFifthColumnKey() throws ArchitectException{ SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); TableSnapshot original = l.makeTableSnapshot(table); ArchitectUtils.listenToHierarchy(l, table); col5.setPrimaryKeySeq(0); ArchitectUtils.unlistenToHierarchy(l, table); System.out.println("Event log:\n"+l); TableSnapshot afterChange = l.makeTableSnapshot(table); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); }
1,110,111
public void testChangeFifthColumnKey() throws ArchitectException{ SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); col5.setPrimaryKeySeq(0); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); }
public void testChangeFifthColumnKey() throws ArchitectException{ SQLColumn col5 = table.getColumnByName("five"); assertNotNull(col5); col5.setPrimaryKeySeq(0); assertEquals(4, table.getPkSize()); assertEquals(0, table.getColumnIndex(table.getColumnByName("one"))); assertEquals(1, table.getColumnIndex(table.getColumnByName("five"))); assertEquals(2, table.getColumnIndex(table.getColumnByName("two"))); assertEquals(3, table.getColumnIndex(table.getColumnByName("three"))); assertEquals(4, table.getColumnIndex(table.getColumnByName("four"))); assertEquals(5, table.getColumnIndex(table.getColumnByName("six"))); System.out.println("Original: "+original); System.out.println("After: "+afterChange); l.rollBack(afterChange); assertEquals(original.toString(), afterChange.toString()); }
1,110,112
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); // 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(), localName, 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); } catch (Throwable e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); return null; } }
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); // 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(), localName, 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); } catch (Throwable e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); return null; } }
1,110,113
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); // 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(), localName, 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); } catch (Throwable e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); return null; } }
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); // 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(), localName, attributeName, attributeValue); if (expression == null) { expression = createConstantExpression(localName, attributeName, attributeValue); } } return script; } return null; } catch (Exception e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); throw createSAXException(e); } catch (Throwable e) { log.warn( "Could not create taglib or URI: " + namespaceURI + " tag name: " + localName, e); return null; } }
1,110,114
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
1,110,115
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
1,110,116
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
1,110,117
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
1,110,118
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
public Vector check() throws PedFileException{ //before we perform the check we want to prune out individuals with too much missing data //or trios which contain individuals with too much missing data Vector indList = getOrder(); Individual currentInd; Family currentFamily; //the killMe array has a boolean for each person which specifies which people should be removed. //the parents or children of such a person are also removed. boolean[] killMe = new boolean[indList.size()]; Arrays.fill(killMe, false); for(int x=0; x < indList.size(); x++){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); if(currentInd.getIsTyped()){ //this person is a singleton if(currentFamily.getNumMembers() == 1){ double numMissing = 0; int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] thisMarker = currentInd.getMarker(i); if (thisMarker[0] == 0 || thisMarker[1] == 0){ numMissing++; } } if (numMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } }else if (currentInd.hasBothParents()){ //this person has parents Individual mom = currentFamily.getMember(currentInd.getMomID()); double momMissing = 0; double dadMissing = 0; Individual dad = currentFamily.getMember(currentInd.getDadID()); if (!(mom.hasBothParents() || dad.hasBothParents())){ //if my parents have parents, skip me because i don't add any information //i.e. i'm a 3rd+ generation member of this family int numMarkers = currentInd.getNumMarkers(); for (int i = 0; i < numMarkers; i++){ byte[] dadMarker = dad.getMarker(i); byte[] momMarker = mom.getMarker(i); if (momMarker[0] == 0 || momMarker[1] == 0){ momMissing++; } if (dadMarker[0] == 0 || dadMarker[1] == 0){ dadMissing++; } } if (momMissing/numMarkers > Options.getMissingThreshold() || dadMissing/numMarkers > Options.getMissingThreshold()){ killMe[x] = true; } } } } } for (int x = 0; x < killMe.length; x++){ //now loop through the list of people to be killed //making sure to get their parents and kids if they exist if (killMe[x]){ currentInd = (Individual)indList.elementAt(x); currentFamily = getFamily(currentInd.getFamilyID()); order.removeElement(currentInd); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(currentInd.getIndividualID()); Enumeration peopleinFam = currentFamily.getMemberList(); while (peopleinFam.hasMoreElements()){ //this looks at the whole family and if any of the members are //parents or kids of the current ind, we kill them too String p = (String)peopleinFam.nextElement(); Individual thisPerson = currentFamily.getMember(p); if (thisPerson.getMomID().equals(currentInd.getIndividualID()) || thisPerson.getDadID().equals(currentInd.getIndividualID()) || currentInd.getMomID().equals(thisPerson.getIndividualID()) || currentInd.getDadID().equals(thisPerson.getIndividualID())){ order.removeElement(thisPerson); axedPeople.add(currentInd.getIndividualID()); currentFamily.removeMember(thisPerson.getIndividualID()); } } if (currentFamily.getNumMembers() == 0){ //if everyone in a family is gone, we remove it from the list families.remove(currentInd.getFamilyID()); axedFamilies.add(currentInd.getFamilyID()); } } } CheckData cd = new CheckData(this); Vector results = cd.check(); /*int size = results.size(); for (int i = 0; i < size; i++) { MarkerResult markerResult = (MarkerResult) results.elementAt(i); System.out.println(markerResult.toString()); }*/ this.results = results; return results; }
1,110,119
public void parseHapMap(Vector rawLines) throws PedFileException { int colNum = -1; int numLines = rawLines.size(); Individual ind; this.order = new Vector(); //sort first Vector lines = new Vector(); Hashtable sortHelp = new Hashtable(numLines-1,1.0f); long[] pos = new long[numLines-1]; lines.add(rawLines.get(0)); for (int k = 1; k < numLines; k++){ StringTokenizer st = new StringTokenizer((String) rawLines.get(k)); //strip off 1st 3 cols st.nextToken();st.nextToken();st.nextToken(); pos[k-1] = new Long(st.nextToken()).longValue(); sortHelp.put(new Long(pos[k-1]),rawLines.get(k)); } Arrays.sort(pos); for (int i = 0; i < pos.length; i++){ lines.add(sortHelp.get(new Long(pos[i]))); } //enumerate indivs StringTokenizer st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); int numMetaColumns = 0; boolean doneMeta = false; while(!doneMeta && st.hasMoreTokens()){ String thisfield = st.nextToken(); numMetaColumns++; //so currently the first person ID always starts with NA (Coriell ID) but //todo: will this be true with AA samples etc? if (thisfield.startsWith("NA")){ doneMeta = true; } } numMetaColumns--; st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); for (int i = 0; i < numMetaColumns; i++){ st.nextToken(); } StringTokenizer dt; while (st.hasMoreTokens()){ ind = new Individual(numLines); String name = st.nextToken(); String details = (String)hapMapTranslate.get(name); if (details == null){ throw new PedFileException("Hapmap data format error: " + name); } dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); ind.setIndividualID(dt.nextToken().trim()); ind.setDadID(dt.nextToken().trim()); ind.setMomID(dt.nextToken().trim()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + name); } ind.setIsTyped(true); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } //start at k=1 to skip header which we just processed above. hminfo = new String[numLines-1][]; for(int k=1;k<numLines;k++){ StringTokenizer tokenizer = new StringTokenizer((String)lines.get(k)); //reading the first line if(colNum < 0){ //only check column number count for the first line colNum = tokenizer.countTokens(); } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in input file. line " + (k+1)); } if(tokenizer.hasMoreTokens()){ hminfo[k-1] = new String[2]; for (int skip = 0; skip < numMetaColumns; skip++){ //meta-data crap String s = tokenizer.nextToken().trim(); //get marker name, chrom and pos if (skip == 0){ hminfo[k-1][0] = s; } if (skip == 2){ if (Chromosome.dataChrom != null){ if (!Chromosome.dataChrom.equals(s)){ throw new PedFileException("Hapmap file format error on line " + (k+1)+ ":\n There appear to be multiple chromosomes in the file."); } }else{ Chromosome.dataChrom = s; } } if (skip == 3){ hminfo[k-1][1] = s; } } int index = 0; while(tokenizer.hasMoreTokens()){ ind = (Individual)order.elementAt(index); String alleles = tokenizer.nextToken(); int allele1=0, allele2=0; if (alleles.substring(0,1).equals("A")){ allele1 = 1; }else if (alleles.substring(0,1).equals("C")){ allele1 = 2; }else if (alleles.substring(0,1).equals("G")){ allele1 = 3; }else if (alleles.substring(0,1).equals("T")){ allele1 = 4; } if (alleles.substring(1,2).equals("A")){ allele2 = 1; }else if (alleles.substring(1,2).equals("C")){ allele2 = 2; }else if (alleles.substring(1,2).equals("G")){ allele2 = 3; }else if (alleles.substring(1,2).equals("T")){ allele2 = 4; } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); index++; } } } }
public void parseHapMap(Vector rawLines) throws PedFileException { int colNum = -1; int numLines = rawLines.size(); Individual ind; this.order = new Vector(); //sort first Vector lines = new Vector(); Hashtable sortHelp = new Hashtable(numLines-1,1.0f); long[] pos = new long[numLines-1]; lines.add(rawLines.get(0)); for (int k = 1; k < numLines; k++){ StringTokenizer st = new StringTokenizer((String) rawLines.get(k)); //strip off 1st 3 cols st.nextToken();st.nextToken();st.nextToken(); pos[k-1] = new Long(st.nextToken()).longValue(); sortHelp.put(new Long(pos[k-1]),rawLines.get(k)); } Arrays.sort(pos); for (int i = 0; i < pos.length; i++){ lines.add(sortHelp.get(new Long(pos[i]))); } //enumerate indivs StringTokenizer st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); int numMetaColumns = 0; boolean doneMeta = false; while(!doneMeta && st.hasMoreTokens()){ String thisfield = st.nextToken(); numMetaColumns++; //so currently the first person ID always starts with NA (Coriell ID) but //todo: will this be true with AA samples etc? if (thisfield.startsWith("NA")){ doneMeta = true; } } numMetaColumns--; st = new StringTokenizer((String)lines.get(0), "\n\t\" \""); for (int i = 0; i < numMetaColumns; i++){ st.nextToken(); } StringTokenizer dt; while (st.hasMoreTokens()){ ind = new Individual(numLines); String name = st.nextToken(); String details = (String)hapMapTranslate.get(name); if (details == null){ throw new PedFileException("Hapmap data format error: " + name); } dt = new StringTokenizer(details, "\n\t\" \""); ind.setFamilyID(dt.nextToken().trim()); ind.setIndividualID(dt.nextToken().trim()); ind.setDadID(dt.nextToken().trim()); ind.setMomID(dt.nextToken().trim()); try { ind.setGender(Integer.parseInt(dt.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(dt.nextToken().trim())); }catch(NumberFormatException nfe) { throw new PedFileException("File error: invalid gender or affected status for indiv " + name); } //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } //start at k=1 to skip header which we just processed above. hminfo = new String[numLines-1][]; for(int k=1;k<numLines;k++){ StringTokenizer tokenizer = new StringTokenizer((String)lines.get(k)); //reading the first line if(colNum < 0){ //only check column number count for the first line colNum = tokenizer.countTokens(); } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("Line number mismatch in input file. line " + (k+1)); } if(tokenizer.hasMoreTokens()){ hminfo[k-1] = new String[2]; for (int skip = 0; skip < numMetaColumns; skip++){ //meta-data crap String s = tokenizer.nextToken().trim(); //get marker name, chrom and pos if (skip == 0){ hminfo[k-1][0] = s; } if (skip == 2){ if (Chromosome.dataChrom != null){ if (!Chromosome.dataChrom.equals(s)){ throw new PedFileException("Hapmap file format error on line " + (k+1)+ ":\n There appear to be multiple chromosomes in the file."); } }else{ Chromosome.dataChrom = s; } } if (skip == 3){ hminfo[k-1][1] = s; } } int index = 0; while(tokenizer.hasMoreTokens()){ ind = (Individual)order.elementAt(index); String alleles = tokenizer.nextToken(); int allele1=0, allele2=0; if (alleles.substring(0,1).equals("A")){ allele1 = 1; }else if (alleles.substring(0,1).equals("C")){ allele1 = 2; }else if (alleles.substring(0,1).equals("G")){ allele1 = 3; }else if (alleles.substring(0,1).equals("T")){ allele1 = 4; } if (alleles.substring(1,2).equals("A")){ allele2 = 1; }else if (alleles.substring(1,2).equals("C")){ allele2 = 2; }else if (alleles.substring(1,2).equals("G")){ allele2 = 3; }else if (alleles.substring(1,2).equals("T")){ allele2 = 4; } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); index++; } } } }
1,110,121
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } boolean isTyped = false; while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if ( !( (allele1==0) && (allele2 == 0) ) ) isTyped = true; if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) ind.setIsTyped(isTyped); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if ( !( (allele1==0) && (allele2 == 0) ) ) isTyped = true; if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) ind.setIsTyped(isTyped); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
1,110,122
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } boolean isTyped = false; while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if ( !( (allele1==0) && (allele2 == 0) ) ) isTyped = true; if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) ind.setIsTyped(isTyped); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } boolean isTyped = false; while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) ind.setIsTyped(isTyped); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
1,110,123
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } boolean isTyped = false; while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if ( !( (allele1==0) && (allele2 == 0) ) ) isTyped = true; if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) ind.setIsTyped(isTyped); //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
public void parseLinkage(Vector pedigrees) throws PedFileException { int colNum = -1; boolean withOptionalColumn = false; int numLines = pedigrees.size(); Individual ind; this.order = new Vector(); for(int k=0; k<numLines; k++){ StringTokenizer tokenizer = new StringTokenizer((String)pedigrees.get(k), "\n\t\" \""); //reading the first line if(colNum < 1){ //only check column number count for the first nonblank line colNum = tokenizer.countTokens(); if(colNum%2==1) { withOptionalColumn = true; } } if(colNum != tokenizer.countTokens()) { //this line has a different number of columns //should send some sort of error message //TODO: add something which stores number of markers for all lines and checks that they're consistent throw new PedFileException("line number mismatch in pedfile. line " + (k+1)); } ind = new Individual(tokenizer.countTokens()); if(tokenizer.hasMoreTokens()){ ind.setFamilyID(tokenizer.nextToken().trim()); ind.setIndividualID(tokenizer.nextToken().trim()); ind.setDadID(tokenizer.nextToken().trim()); ind.setMomID(tokenizer.nextToken().trim()); try { //TODO: affected/liability should not be forced into Integers! ind.setGender(Integer.parseInt(tokenizer.nextToken().trim())); ind.setAffectedStatus(Integer.parseInt(tokenizer.nextToken().trim())); if(withOptionalColumn) { ind.setLiability(Integer.parseInt(tokenizer.nextToken().trim())); } }catch(NumberFormatException nfe) { throw new PedFileException("Pedfile error: invalid gender or affected status on line " + (k+1)); } boolean isTyped = false; while(tokenizer.hasMoreTokens()){ try { int allele1 = Integer.parseInt(tokenizer.nextToken().trim()); int allele2 = Integer.parseInt(tokenizer.nextToken().trim()); if ( !( (allele1==0) && (allele2 == 0) ) ) isTyped = true; if(allele1 <0 || allele1 > 4 || allele2 <0 || allele2 >4) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) + ".\n all genotypes must be 0-4."); } byte[] markers = new byte[2]; markers[0] = (byte)allele1; markers[1]= (byte)allele2; ind.addMarker(markers); }catch(NumberFormatException nfe) { throw new PedFileException("Pedigree file input error: invalid genotype on line " + (k+1) ); } } //note whether this is a real indiv (true) or a "dummy" (false) //check if the family exists already in the Hashtable Family fam = (Family)this.families.get(ind.getFamilyID()); if(fam == null){ //it doesnt exist, so create a new Family object fam = new Family(ind.getFamilyID()); } fam.addMember(ind); this.families.put(ind.getFamilyID(),fam); String[] indFamID = new String[2]; indFamID[0] = ind.getFamilyID(); indFamID[1] = ind.getIndividualID(); this.order.add(ind); } } }
1,110,124
public TagScript createTagScript(String name, Attributes attributes) throws Exception { TagScript answer = super.createTagScript(name, attributes); if ( answer == null ) { final Factory factory = getFactory( name ); if ( factory != null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } } } ); } } return answer; }
public TagScript createTagScript(String name, Attributes attributes) throws Exception { TagScript answer = super.createTagScript(name, attributes); if ( answer == null ) { final Factory factory = getFactory( name ); if ( factory != null ) { return new TagScript( new TagFactory() { public Tag createTag(String name, Attributes attributes) throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } } } ); } } return answer; }
1,110,125
public TagScript createTagScript(String name, Attributes attributes) throws Exception { TagScript answer = super.createTagScript(name, attributes); if ( answer == null ) { final Factory factory = getFactory( name ); if ( factory != null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } } } ); } } return answer; }
public TagScript createTagScript(String name, Attributes attributes) throws Exception { TagScript answer = super.createTagScript(name, attributes); if ( answer == null ) { final Factory factory = getFactory( name ); if ( factory != null ) { return new TagScript( new TagFactory() { public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(name, attributes); } else { return new ComponentTag(factory); } } } ); } } return answer; }
1,110,126
public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } }
public Tag createTag(String name, Attributes attributes) throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } }
1,110,127
public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(); } else { return new ComponentTag(factory); } }
public Tag createTag() throws Exception { if ( factory instanceof TagFactory ) { return ((TagFactory) factory).createTag(name, attributes); } else { return new ComponentTag(factory); } }
1,110,128
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask if ( ! ( parentObject instanceof Task ) && project.getTaskDefinitions().containsKey( tagName ) ) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask if ( ! ( parentObject instanceof Task ) && project.getTaskDefinitions().containsKey( tagName ) ) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { if ( log.isDebugEnabled() ) { log.debug( "Creating a nested object name: " + tagName ); } Object nested = createNestedObject( parentObject, tagName ); if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } }
1,110,129
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); } } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); } } } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; } else { sqlStatement = getBodyText(); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); } finally { if (statement != null) { try { statement.close(); } catch (SQLException e) { } // Not much we can do } if (rs != null) { try { rs.close(); } catch (SQLException e) { } // Not much we can do } if (conn != null && !isPartOfTransaction) { try { conn.close(); } catch (SQLException e) { } // Not much we can do conn = null; } clearParameters(); } }
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); log.error("Caught exception while closing statement: " + e, e); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); log.error("Caught exception while closing statement: " + e, e); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); log.error("Caught exception while closing statement: " + e, e); } log.error("Caught exception while closing statement: " + e, e); } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); log.error("Caught exception while closing statement: " + e, e); } log.error("Caught exception while closing statement: " + e, e); } log.error("Caught exception while closing statement: " + e, e); } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; log.error("Caught exception while closing statement: " + e, e); } else { sqlStatement = getBodyText(); log.error("Caught exception while closing statement: " + e, e); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); log.error("Caught exception while closing statement: " + e, e); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); log.error("Caught exception while closing statement: " + e, e); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); log.error("Caught exception while closing statement: " + e, e); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); log.error("Caught exception while closing statement: " + e, e); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); log.error("Caught exception while closing statement: " + e, e); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); log.error("Caught exception while closing statement: " + e, e); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); log.error("Caught exception while closing statement: " + e, e); } finally { if (statement != null) { try { statement.close(); log.error("Caught exception while closing statement: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing statement: " + e, e); } // Not much we can do log.error("Caught exception while closing statement: " + e, e); } if (rs != null) { try { rs.close(); log.error("Caught exception while closing statement: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing statement: " + e, e); } // Not much we can do log.error("Caught exception while closing statement: " + e, e); } if (conn != null && !isPartOfTransaction) { try { conn.close(); log.error("Caught exception while closing statement: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing statement: " + e, e); } // Not much we can do conn = null; log.error("Caught exception while closing statement: " + e, e); } clearParameters(); log.error("Caught exception while closing statement: " + e, e); } log.error("Caught exception while closing statement: " + e, e); }
1,110,130
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); } } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); } } } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; } else { sqlStatement = getBodyText(); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); } finally { if (statement != null) { try { statement.close(); } catch (SQLException e) { } // Not much we can do } if (rs != null) { try { rs.close(); } catch (SQLException e) { } // Not much we can do } if (conn != null && !isPartOfTransaction) { try { conn.close(); } catch (SQLException e) { } // Not much we can do conn = null; } clearParameters(); } }
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); log.error("Caught exception while closing result set: " + e, e); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); log.error("Caught exception while closing result set: " + e, e); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); log.error("Caught exception while closing result set: " + e, e); } log.error("Caught exception while closing result set: " + e, e); } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); log.error("Caught exception while closing result set: " + e, e); } log.error("Caught exception while closing result set: " + e, e); } log.error("Caught exception while closing result set: " + e, e); } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; log.error("Caught exception while closing result set: " + e, e); } else { sqlStatement = getBodyText(); log.error("Caught exception while closing result set: " + e, e); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); log.error("Caught exception while closing result set: " + e, e); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); log.error("Caught exception while closing result set: " + e, e); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); log.error("Caught exception while closing result set: " + e, e); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); log.error("Caught exception while closing result set: " + e, e); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); log.error("Caught exception while closing result set: " + e, e); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); log.error("Caught exception while closing result set: " + e, e); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); log.error("Caught exception while closing result set: " + e, e); } finally { if (statement != null) { try { statement.close(); log.error("Caught exception while closing result set: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing result set: " + e, e); } // Not much we can do log.error("Caught exception while closing result set: " + e, e); } if (rs != null) { try { rs.close(); log.error("Caught exception while closing result set: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing result set: " + e, e); } // Not much we can do log.error("Caught exception while closing result set: " + e, e); } if (conn != null && !isPartOfTransaction) { try { conn.close(); log.error("Caught exception while closing result set: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing result set: " + e, e); } // Not much we can do conn = null; log.error("Caught exception while closing result set: " + e, e); } clearParameters(); log.error("Caught exception while closing result set: " + e, e); } log.error("Caught exception while closing result set: " + e, e); }
1,110,131
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); } } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); } } } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; } else { sqlStatement = getBodyText(); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); } finally { if (statement != null) { try { statement.close(); } catch (SQLException e) { } // Not much we can do } if (rs != null) { try { rs.close(); } catch (SQLException e) { } // Not much we can do } if (conn != null && !isPartOfTransaction) { try { conn.close(); } catch (SQLException e) { } // Not much we can do conn = null; } clearParameters(); } }
public void doTag(XMLOutput output) throws Exception { if (!maxRowsSpecified) { Object obj = context.getVariable("org.apache.commons.jelly.sql.maxRows"); if (obj != null) { if (obj instanceof Integer) { maxRows = ((Integer) obj).intValue(); log.error("Caught exception while closing connection: " + e, e); } else if (obj instanceof String) { try { maxRows = Integer.parseInt((String) obj); log.error("Caught exception while closing connection: " + e, e); } catch (NumberFormatException nfe) { throw new JellyException( Resources.getMessage("SQL_MAXROWS_PARSE_ERROR", (String) obj), nfe); log.error("Caught exception while closing connection: " + e, e); } log.error("Caught exception while closing connection: " + e, e); } else { throw new JellyException(Resources.getMessage("SQL_MAXROWS_INVALID")); log.error("Caught exception while closing connection: " + e, e); } log.error("Caught exception while closing connection: " + e, e); } log.error("Caught exception while closing connection: " + e, e); } Result result = null; String sqlStatement = null; log.debug( "About to lookup connection" ); ResultSet rs = null; Statement statement = null; try { conn = getConnection(); /* * Use the SQL statement specified by the sql attribute, if any, * otherwise use the body as the statement. */ if (sql != null) { sqlStatement = sql; log.error("Caught exception while closing connection: " + e, e); } else { sqlStatement = getBodyText(); log.error("Caught exception while closing connection: " + e, e); } if (sqlStatement == null || sqlStatement.trim().length() == 0) { throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT")); log.error("Caught exception while closing connection: " + e, e); } /* * We shouldn't have a negative startRow or illegal maxrows */ if ((startRow < 0) || (maxRows < -1)) { throw new JellyException(Resources.getMessage("PARAM_BAD_VALUE")); log.error("Caught exception while closing connection: " + e, e); } /* * Note! We must not use the setMaxRows() method on the * the statement to limit the number of rows, since the * Result factory must be able to figure out the correct * value for isLimitedByMaxRows(); there's no way to check * if it was from the ResultSet. */ if ( log.isDebugEnabled() ) { log.debug( "About to execute query: " + sqlStatement ); log.error("Caught exception while closing connection: " + e, e); } if ( hasParameters() ) { PreparedStatement ps = conn.prepareStatement(sqlStatement); statement = ps; setParameters(ps); rs = ps.executeQuery(); log.error("Caught exception while closing connection: " + e, e); } else { statement = conn.createStatement(); rs = statement.executeQuery(sqlStatement); log.error("Caught exception while closing connection: " + e, e); } result = new ResultImpl(rs, startRow, maxRows); context.setVariable(var, result); log.error("Caught exception while closing connection: " + e, e); } catch (SQLException e) { throw new JellyException(sqlStatement + ": " + e.getMessage(), e); log.error("Caught exception while closing connection: " + e, e); } finally { if (statement != null) { try { statement.close(); log.error("Caught exception while closing connection: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing connection: " + e, e); } // Not much we can do log.error("Caught exception while closing connection: " + e, e); } if (rs != null) { try { rs.close(); log.error("Caught exception while closing connection: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing connection: " + e, e); } // Not much we can do log.error("Caught exception while closing connection: " + e, e); } if (conn != null && !isPartOfTransaction) { try { conn.close(); log.error("Caught exception while closing connection: " + e, e); } catch (SQLException e) { log.error("Caught exception while closing connection: " + e, e); } // Not much we can do conn = null; log.error("Caught exception while closing connection: " + e, e); } clearParameters(); log.error("Caught exception while closing connection: " + e, e); } log.error("Caught exception while closing connection: " + e, e); }
1,110,132
public void addChild(Component component, Object constraints) throws JellyTagException { BorderLayoutTag tag = (BorderLayoutTag) findAncestorWithClass( BorderLayoutTag.class ); if (tag == null) { throw new JellyTagException( "this tag must be nested within a <tr> tag" ); } tag.addLayoutComponent(component, getConstraints()); }
public void addChild(Component component, Object constraints) throws JellyTagException { BorderLayoutTag tag = (BorderLayoutTag) findAncestorWithClass( BorderLayoutTag.class ); if (tag == null) { throw new JellyTagException( "this tag must be nested within a <borderLayout> tag" ); } tag.addLayoutComponent(component, getConstraints()); }
1,110,133
static Vector doSpine(DPrimeTable dPrime){ // find blocks by searching for stretches between two markers A,B where // D prime is > a threshold for all informative combinations of A, (A+1...B) int baddies; int verticalExtent=0; int horizontalExtent=0; Vector blocks = new Vector(); for (int i = 0; i < Chromosome.getSize(); i++){ baddies=0; //find how far LD from marker i extends for (int j = i+1; j < dPrime.getLength(i); j++){ PairwiseLinkage thisPair = dPrime.getLDStats(i,j); if (thisPair == null){ continue; } //LD extends if D' > threshold if (thisPair.getDPrime() < spineDP){ //LD extends through one 'bad' marker if (baddies < 1){ baddies++; } else { verticalExtent = j-1; break; } } verticalExtent=j; } //now we need to find a stretch of LD of all markers between i and j //start with the longest possible block of LD and work backwards to find //one which is good for (int m = verticalExtent; m > i; m--){ for (int k = i; k < m; k++){ PairwiseLinkage thisPair = dPrime.getLDStats(k,m); if (thisPair == null){ continue; } if(thisPair.getDPrime() < spineDP){ if (baddies < 1){ baddies++; } else { break; } } horizontalExtent=k+1; } //is this a block of LD? //previously, this algorithm was more complex and made some calls better //but caused major problems in others. since the guessing is somewhat //arbitrary, this new and simple method is fine. if(horizontalExtent == m){ blocks.add(i + " " + m); i=m; } } } return stringVec2intVec(blocks); }
static Vector doSpine(DPrimeTable dPrime){ // find blocks by searching for stretches between two markers A,B where // D prime is > a threshold for all informative combinations of A, (A+1...B) int baddies; int verticalExtent=0; int horizontalExtent=0; Vector blocks = new Vector(); for (int i = 0; i < Chromosome.getSize(); i++){ baddies=0; //find how far LD from marker i extends for (int j = i+1; j < i + dPrime.getLength(i); j++){ PairwiseLinkage thisPair = dPrime.getLDStats(i,j); if (thisPair == null){ continue; } //LD extends if D' > threshold if (thisPair.getDPrime() < spineDP){ //LD extends through one 'bad' marker if (baddies < 1){ baddies++; } else { verticalExtent = j-1; break; } } verticalExtent=j; } //now we need to find a stretch of LD of all markers between i and j //start with the longest possible block of LD and work backwards to find //one which is good for (int m = verticalExtent; m > i; m--){ for (int k = i; k < m; k++){ PairwiseLinkage thisPair = dPrime.getLDStats(k,m); if (thisPair == null){ continue; } if(thisPair.getDPrime() < spineDP){ if (baddies < 1){ baddies++; } else { break; } } horizontalExtent=k+1; } //is this a block of LD? //previously, this algorithm was more complex and made some calls better //but caused major problems in others. since the guessing is somewhat //arbitrary, this new and simple method is fine. if(horizontalExtent == m){ blocks.add(i + " " + m); i=m; } } } return stringVec2intVec(blocks); }
1,110,134
public void doTag(XMLOutput output) throws Exception { Object answer = null; if ( value != null ) { answer = value.evaluate(context); } else { answer = getBodyText(); } if ( var != null ) { context.setVariable(var, answer); } else { if ( target == null ) { throw new JellyException( "Either a 'var' or a 'target' attribute must be defined for this tag" ); } if ( property == null ) { throw new JellyException( "You must define a 'property' attribute if you specify a 'target'" ); } setPropertyValue( target, property, value ); } }
public void doTag(XMLOutput output) throws Exception { Object answer = null; if ( value != null ) { answer = value.evaluate(context); } else { answer = getBodyText(); } if ( var != null ) { context.setVariable(var, answer); } else { if ( target == null ) { throw new JellyException( "Either a 'var' or a 'target' attribute must be defined for this tag" ); } if ( property == null ) { throw new JellyException( "You must define a 'property' attribute if you specify a 'target'" ); } setPropertyValue( target, property, answer ); } }
1,110,135
protected void setPropertyValue( Object target, String property, Object value ) throws Exception { if ( target instanceof Map ) { Map map = (Map) target; map.put( property, value ); } else { BeanUtils.setProperty( target, property, value ); } }
protected void setPropertyValue( Object target, String property, Object value ) throws Exception { if ( target instanceof Map ) { Map map = (Map) target; map.put( property, value ); } else { BeanUtils.setProperty( target, property, value ); } }
1,110,136
protected void setPropertyValue( Object target, String property, Object value ) throws Exception { if ( target instanceof Map ) { Map map = (Map) target; map.put( property, value ); } else { BeanUtils.setProperty( target, property, value ); } }
protected void setPropertyValue( Object target, String property, Object value ) throws Exception { if ( target instanceof Map ) { Map map = (Map) target; map.put( property, value ); } else { BeanUtils.setProperty( target, property, value ); } }
1,110,137
public void addColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" ADD COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.CREATE, c); }
public void addColumn(SQLColumn c) { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" ADD COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.CREATE, c); }
1,110,138
public void addColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" ADD COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.CREATE, c); }
public void addColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print(toQualifiedName(c.getParentTable())); print(" ADD COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.CREATE, c); }
1,110,139
public void addPrimaryKey(SQLTable t, String primaryKeyName) throws ArchitectException { Map colNameMap = new HashMap(); StringBuffer sqlStatement = new StringBuffer(); boolean first = true; sqlStatement.append("ALTER TABLE "+ toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " ADD PRIMARY KEY ("); for (SQLColumn c : t.getColumns()) { if (c.isPrimaryKey()) { if (!first) { sqlStatement.append(","); }else{ first =false; } sqlStatement.append(createPhysicalName(colNameMap,c)); } } sqlStatement.append(")"); if (!first) { print(sqlStatement.toString()); endStatement(DDLStatement.StatementType.CREATE,t); } }
public void addPrimaryKey(SQLTable t) throws ArchitectException { Map colNameMap = new HashMap(); StringBuffer sqlStatement = new StringBuffer(); boolean first = true; sqlStatement.append("ALTER TABLE "+ toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " ADD PRIMARY KEY ("); for (SQLColumn c : t.getColumns()) { if (c.isPrimaryKey()) { if (!first) { sqlStatement.append(","); }else{ first =false; } sqlStatement.append(createPhysicalName(colNameMap,c)); } } sqlStatement.append(")"); if (!first) { print(sqlStatement.toString()); endStatement(DDLStatement.StatementType.CREATE,t); } }
1,110,140
public void addPrimaryKey(SQLTable t, String primaryKeyName) throws ArchitectException { Map colNameMap = new HashMap(); StringBuffer sqlStatement = new StringBuffer(); boolean first = true; sqlStatement.append("ALTER TABLE "+ toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " ADD PRIMARY KEY ("); for (SQLColumn c : t.getColumns()) { if (c.isPrimaryKey()) { if (!first) { sqlStatement.append(","); }else{ first =false; } sqlStatement.append(createPhysicalName(colNameMap,c)); } } sqlStatement.append(")"); if (!first) { print(sqlStatement.toString()); endStatement(DDLStatement.StatementType.CREATE,t); } }
public void addPrimaryKey(SQLTable t, String primaryKeyName) throws ArchitectException { Map colNameMap = new HashMap(); StringBuffer sqlStatement = new StringBuffer(); boolean first = true; sqlStatement.append("ALTER TABLE "+ toQualifiedName(t.getName()) + " ADD PRIMARY KEY ("); for (SQLColumn c : t.getColumns()) { if (c.isPrimaryKey()) { if (!first) { sqlStatement.append(","); }else{ first =false; } sqlStatement.append(createPhysicalName(colNameMap,c)); } } sqlStatement.append(")"); if (!first) { print(sqlStatement.toString()); endStatement(DDLStatement.StatementType.CREATE,t); } }
1,110,141
public void addRelationship(SQLRelationship r) throws ArchitectDiffException { print("\n ALTER TABLE "); print( toQualifiedName(r.getFkTable()) ); print(" ADD CONSTRAINT "); print(r.getName()); print(" FOREIGN KEY ( "); Map<String, SQLColumn> colNameMap = new HashMap<String, SQLColumn> (); boolean firstColumn = true; for (ColumnMapping cm : r.getMappings()) { SQLColumn c = cm.getFkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if (firstColumn) { firstColumn = false; print(createPhysicalName(colNameMap, c)); } else { print(", " + createPhysicalName(colNameMap, c)); } colNameMap.put(c.getName(), c); } } print(" ) REFERENCES "); print( toQualifiedName(r.getPkTable()) ); print(" ( "); colNameMap = new HashMap<String, SQLColumn>(); firstColumn = true; for (ColumnMapping cm : r.getMappings()) { SQLColumn c = cm.getPkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if (firstColumn) { firstColumn = false; print(createPhysicalName(colNameMap, c)); } else { print(", " + createPhysicalName(colNameMap, c)); } colNameMap.put(c.getName(), c); } } print(" )"); endStatement(DDLStatement.StatementType.CREATE, r); }
public void addRelationship(SQLRelationship r) throws ArchitectDiffException { print("\n ALTER TABLE "); print( toQualifiedName(r.getFkTable()) ); print(" ADD CONSTRAINT "); print(r.getName()); print(" FOREIGN KEY ( "); Map<String, SQLColumn> colNameMap = new HashMap<String, SQLColumn> (); boolean firstColumn = true; for (ColumnMapping cm : r.getMappings()) { SQLColumn c = cm.getFkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if (firstColumn) { firstColumn = false; print(createPhysicalName(colNameMap, c)); } else { print(", " + createPhysicalName(colNameMap, c)); } colNameMap.put(c.getName(), c); } } print(" ) REFERENCES "); print( toQualifiedName(r.getPkTable()) ); print(" ( "); colNameMap = new HashMap<String, SQLColumn>(); firstColumn = true; for (ColumnMapping cm : r.getMappings()) { SQLColumn c = cm.getPkColumn(); // make sure this is unique if (colNameMap.get(c.getName()) == null) { if (firstColumn) { firstColumn = false; print(createPhysicalName(colNameMap, c)); } else { print(", " + createPhysicalName(colNameMap, c)); } colNameMap.put(c.getName(), c); } } print(" )"); endStatement(DDLStatement.StatementType.CREATE, r); }
1,110,142
protected String columnDefinition(SQLColumn c, Map colNameMap) throws ArchitectDiffException { StringBuffer def = new StringBuffer(); // Column name def.append(createPhysicalName(colNameMap, c)); def.append(" "); def.append(columnType(c)); def.append(" "); // Column nullability def.append(columnNullability(c)); return def.toString(); }
protected String columnDefinition(SQLColumn c, Map colNameMap) { StringBuffer def = new StringBuffer(); // Column name def.append(createPhysicalName(colNameMap, c)); def.append(" "); def.append(columnType(c)); def.append(" "); // Column nullability def.append(columnNullability(c)); return def.toString(); }
1,110,143
public void dropColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" DROP COLUMN "); print(createPhysicalName(colNameMap,c)); endStatement(DDLStatement.StatementType.DROP, c); }
public void dropColumn(SQLColumn c) { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" DROP COLUMN "); print(createPhysicalName(colNameMap,c)); endStatement(DDLStatement.StatementType.DROP, c); }
1,110,144
public void dropColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" DROP COLUMN "); print(createPhysicalName(colNameMap,c)); endStatement(DDLStatement.StatementType.DROP, c); }
public void dropColumn(SQLColumn c, SQLTable t) throws ArchitectDiffException { Map colNameMap = new HashMap(); print("\n ALTER TABLE "); print(toQualifiedName(c.getParentTable())); print(" DROP COLUMN "); print(createPhysicalName(colNameMap,c)); endStatement(DDLStatement.StatementType.DROP, c); }
1,110,145
public void dropPrimaryKey(SQLTable t, String primaryKeyName) { print("ALTER TABLE " + toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " DROP PRIMARY KEY " + primaryKeyName); endStatement(DDLStatement.StatementType.DROP,t); }
public void dropPrimaryKey(SQLTable t) { print("ALTER TABLE " + toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " DROP PRIMARY KEY " + primaryKeyName); endStatement(DDLStatement.StatementType.DROP,t); }
1,110,146
public void dropPrimaryKey(SQLTable t, String primaryKeyName) { print("ALTER TABLE " + toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " DROP PRIMARY KEY " + primaryKeyName); endStatement(DDLStatement.StatementType.DROP,t); }
public void dropPrimaryKey(SQLTable t, String primaryKeyName) { print("ALTER TABLE " + toQualifiedName(t.getCatalogName(),t.getSchemaName(),t.getName()) + " DROP PRIMARY KEY " + primaryKeyName); endStatement(DDLStatement.StatementType.DROP,t); }
1,110,147
public void dropTable(SQLTable t) { print(makeDropTableSQL(t.getCatalogName(), t.getSchemaName(), t.getName())); endStatement(DDLStatement.StatementType.DROP, t); }
public void dropTable(SQLTable t) { print(makeDropTableSQL(t.getName())); endStatement(DDLStatement.StatementType.DROP, t); }
1,110,148
public List generateDDLStatements(SQLDatabase source) throws SQLException, ArchitectException { warnings = new ArrayList(); ddlStatements = new ArrayList(); ddl = new StringBuffer(500); topLevelNames = new HashMap(); // for tracking dup table/relationship names try { if (allowConnection) { con = source.getConnection(); } else { con = null; } createTypeMap(); Iterator it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeTable(t); writePrimaryKey(t); } it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeExportedRelationships(t); } // TODO add warnings for the originals of the existing duplicate name warnings } finally { try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } return ddlStatements; }
public List<DDLStatement> generateDDLStatements(SQLDatabase source) throws SQLException, ArchitectException { warnings = new ArrayList(); ddlStatements = new ArrayList(); ddl = new StringBuffer(500); topLevelNames = new HashMap(); // for tracking dup table/relationship names try { if (allowConnection) { con = source.getConnection(); } else { con = null; } createTypeMap(); Iterator it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeTable(t); writePrimaryKey(t); } it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeExportedRelationships(t); } // TODO add warnings for the originals of the existing duplicate name warnings } finally { try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } return ddlStatements; }
1,110,149
public List generateDDLStatements(SQLDatabase source) throws SQLException, ArchitectException { warnings = new ArrayList(); ddlStatements = new ArrayList(); ddl = new StringBuffer(500); topLevelNames = new HashMap(); // for tracking dup table/relationship names try { if (allowConnection) { con = source.getConnection(); } else { con = null; } createTypeMap(); Iterator it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeTable(t); writePrimaryKey(t); } it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeExportedRelationships(t); } // TODO add warnings for the originals of the existing duplicate name warnings } finally { try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } return ddlStatements; }
public List generateDDLStatements(SQLDatabase source) throws SQLException, ArchitectException { warnings = new ArrayList(); ddlStatements = new ArrayList<DDLStatement>(); ddl = new StringBuffer(500); topLevelNames = new HashMap(); // for tracking dup table/relationship names try { if (allowConnection) { con = source.getConnection(); } else { con = null; } createTypeMap(); Iterator it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeTable(t); writePrimaryKey(t); } it = source.getChildren().iterator(); while (it.hasNext()) { SQLTable t = (SQLTable) it.next(); writeExportedRelationships(t); } // TODO add warnings for the originals of the existing duplicate name warnings } finally { try { if (con != null) con.close(); } catch (SQLException ex) { logger.error("Couldn't close connection", ex); } } return ddlStatements; }
1,110,150
public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { return "ALTER TABLE " +toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP FOREIGN KEY " +fkName; }
public String makeDropForeignKeySQL(String fkTable, String fkName) { return "ALTER TABLE " +toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP FOREIGN KEY " +fkName; }
1,110,151
public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { return "ALTER TABLE " +toQualifiedName(fkCatalog, fkSchema, fkTable) +" DROP FOREIGN KEY " +fkName; }
public String makeDropForeignKeySQL(String fkCatalog, String fkSchema, String fkTable, String fkName) { return "ALTER TABLE " +toQualifiedName(fkTable) +" DROP FOREIGN KEY " +fkName; }
1,110,152
public String makeDropTableSQL(String catalog, String schema, String table) { return "DROP TABLE "+toQualifiedName(catalog, schema, table); }
public String makeDropTableSQL(String catalog, String schema, String table) { return "DROP TABLE "+toQualifiedName(catalog, schema, table); }
1,110,153
public void modifyColumn(SQLColumn c) throws ArchitectDiffException { Map colNameMap = new HashMap(); SQLTable t = c.getParentTable(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" ALTER COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.MODIFY, c); }
public void modifyColumn(SQLColumn c) { Map colNameMap = new HashMap(); SQLTable t = c.getParentTable(); print("\n ALTER TABLE "); print( toQualifiedName(t) ); print(" ALTER COLUMN "); print(columnDefinition(c,colNameMap)); endStatement(DDLStatement.StatementType.MODIFY, c); }
1,110,154
public String toQualifiedName(SQLTable t) { String catalog = getTargetCatalog(); if ( catalog == null ) catalog = t.getCatalogName(); String schema = getTargetSchema(); if ( schema == null ) schema = t.getSchemaName(); return DDLUtils.toQualifiedName(catalog,schema,t.getPhysicalName()); }
public String toQualifiedName(SQLTable t) { String catalog = getTargetCatalog(); if ( catalog == null ) catalog = t.getCatalogName(); String schema = getTargetSchema(); if ( schema == null ) schema = t.getSchemaName(); return DDLUtils.toQualifiedName(catalog,schema,t.getPhysicalName()); }
1,110,155
protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); // geneate a physical name for this relationship createPhysicalName(topLevelNames,rel); // println(""); print("ALTER TABLE "); // this works because all the tables have had their physical names generated already... print( toQualifiedName(rel.getFkTable()) ); print(" ADD CONSTRAINT "); print(rel.getPhysicalName()); println(""); print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } // append(pkCols, cmap.getPkColumn().getPhysicalName()); append(fkCols, cmap.getFkColumn().getPhysicalName()); firstCol = false; } print(fkCols.toString()); println(")"); print("REFERENCES "); print( toQualifiedName(rel.getPkTable()) ); print(" ("); print(pkCols.toString()); print(")"); endStatement(DDLStatement.StatementType.ADD_FK, t); } }
protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); // geneate a physical name for this relationship createPhysicalName(topLevelNames,rel); // println(""); print("ALTER TABLE "); // this works because all the tables have had their physical names generated already... print( toQualifiedName(rel.getFkTable()) ); print(" ADD CONSTRAINT "); print(rel.getPhysicalName()); println(""); print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } // append(pkCols, cmap.getPkColumn().getPhysicalName()); append(fkCols, cmap.getFkColumn().getPhysicalName()); firstCol = false; } print(fkCols.toString()); println(")"); print("REFERENCES "); print( toQualifiedName(rel.getPkTable()) ); print(" ("); print(pkCols.toString()); print(")"); endStatement(DDLStatement.StatementType.ADD_FK, t); } }
1,110,156
public void delete() { Implementation odmg = ODMG.getODMGImplementation(); Database db = ODMG.getODMGDatabase(); ODMGXAWrapper txw = new ODMGXAWrapper(); db.deletePersistent( this ); if ( imageFile != null && !imageFile.delete() ) { log.error( "File " + imageFile.getAbsolutePath() + " could not be deleted" ); } txw.commit(); }
public void delete() { Implementation odmg = ODMG.getODMGImplementation(); Database db = ODMG.getODMGDatabase(); ODMGXAWrapper txw = new ODMGXAWrapper(); db.deletePersistent( this ); if ( imageFile != null && !imageFile.delete() ) { log.error( "File " + imageFile.getAbsolutePath() + " could not be deleted" ); } txw.commit(); }
1,110,157
public void delete() { Implementation odmg = ODMG.getODMGImplementation(); Database db = ODMG.getODMGDatabase(); ODMGXAWrapper txw = new ODMGXAWrapper(); db.deletePersistent( this ); if ( imageFile != null && !imageFile.delete() ) { log.error( "File " + imageFile.getAbsolutePath() + " could not be deleted" ); } txw.commit(); }
public void delete() { Implementation odmg = ODMG.getODMGImplementation(); Database db = ODMG.getODMGDatabase(); ODMGXAWrapper txw = new ODMGXAWrapper(); db.deletePersistent( this ); if ( imageFile != null && !imageFile.delete() ) { log.error( "File " + imageFile.getAbsolutePath() + " could not be deleted" ); } txw.commit(); }
1,110,158
public java.util.Date getCheckTime() { ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.READ ); txw.commit(); return checkTime; }
public java.util.Date getCheckTime() { ODMGXAWrapper txw = new ODMGXAWrapper(); txw.lock( this, Transaction.READ ); txw.commit(); return checkTime != null ? (java.util.Date) checkTime.clone() : null; }
1,110,159
public byte[] getHash() { if ( hash == null && imageFile != null ) { calcHash(); } return (byte[]) hash.clone(); }
public byte[] getHash() { if ( hash == null && imageFile != null ) { calcHash(); } return (hash != null) ? (byte[]) hash.clone() : null; }
1,110,160
protected void readImageFile() throws IOException { // Find the JPEG image reader // TODO: THis shoud decode also other readers from fname Iterator readers = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader)readers.next(); ImageInputStream iis = ImageIO.createImageInputStream( imageFile ); reader.setInput( iis, true ); width = reader.getWidth( 0 ); height = reader.getHeight( 0 ); iis.close(); }
protected void readImageFile() throws IOException { // Find the JPEG image reader // TODO: THis shoud decode also other readers from fname Iterator readers = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader)readers.next(); ImageInputStream iis = ImageIO.createImageInputStream( imageFile ); reader.setInput( iis, true ); width = reader.getWidth( 0 ); height = reader.getHeight( 0 ); iis.close(); }
1,110,161
public String getProperty(String name) { if (name == null) { return null; } return (String) this.context.getVariable(name); }
public String getProperty(String name) { if (name == null) { return null; } Object value = this.context.getVariable(name); if (value == null) { return null; } else { return value.toString(); } }
1,110,165
protected Rectangle getPhotoBounds( int photoNum ) { if ( photoNum < photoCollection.getPhotoCount() ) { PhotoInfo photoCandidate = photoCollection.getPhoto( photoNum ); log.warn( "Checking bounds" ); // Check whether the click was inside the thumbnail or not int width = 100; int height = 75; Thumbnail thumb = photoCandidate.getThumbnail(); if ( thumb != null ) { BufferedImage img = thumb.getImage(); width = img.getWidth(); height = img.getHeight(); } int row = (int) photoNum / columnCount; int col = photoNum - row*columnCount; int imgX = col * columnWidth + (columnWidth - width)/(int)2; int imgY = row * rowHeight + (rowHeight - height)/(int)2; Rectangle imgRect = new Rectangle( imgX, imgY, width, height ); return imgRect; } return null; }
protected Rectangle getPhotoBounds( int photoNum ) { if ( photoNum < photoCollection.getPhotoCount() ) { PhotoInfo photoCandidate = photoCollection.getPhoto( photoNum ); log.debug( "Checking bounds" ); // Check whether the click was inside the thumbnail or not int width = 100; int height = 75; Thumbnail thumb = photoCandidate.getThumbnail(); if ( thumb != null ) { BufferedImage img = thumb.getImage(); width = img.getWidth(); height = img.getHeight(); } int row = (int) photoNum / columnCount; int col = photoNum - row*columnCount; int imgX = col * columnWidth + (columnWidth - width)/(int)2; int imgY = row * rowHeight + (rowHeight - height)/(int)2; Rectangle imgRect = new Rectangle( imgX, imgY, width, height ); return imgRect; } return null; }
1,110,166
protected Rectangle getPhotoBounds( int photoNum ) { if ( photoNum < photoCollection.getPhotoCount() ) { PhotoInfo photoCandidate = photoCollection.getPhoto( photoNum ); log.warn( "Checking bounds" ); // Check whether the click was inside the thumbnail or not int width = 100; int height = 75; Thumbnail thumb = photoCandidate.getThumbnail(); if ( thumb != null ) { BufferedImage img = thumb.getImage(); width = img.getWidth(); height = img.getHeight(); } int row = (int) photoNum / columnCount; int col = photoNum - row*columnCount; int imgX = col * columnWidth + (columnWidth - width)/(int)2; int imgY = row * rowHeight + (rowHeight - height)/(int)2; Rectangle imgRect = new Rectangle( imgX, imgY, width, height ); return imgRect; } return null; }
protected Rectangle getPhotoBounds( int photoNum ) { if ( photoNum < photoCollection.getPhotoCount() ) { PhotoInfo photoCandidate = photoCollection.getPhoto( photoNum ); log.warn( "Checking bounds" ); // Check whether the click was inside the thumbnail or not int width = 100; int height = 75; Thumbnail thumb = null; if ( photoCandidate.hasThumbnail() ) { thumb = photoCandidate.getThumbnail(); } if ( thumb != null ) { BufferedImage img = thumb.getImage(); width = img.getWidth(); height = img.getHeight(); } int row = (int) photoNum / columnCount; int col = photoNum - row*columnCount; int imgX = col * columnWidth + (columnWidth - width)/(int)2; int imgY = row * rowHeight + (rowHeight - height)/(int)2; Rectangle imgRect = new Rectangle( imgX, imgY, width, height ); return imgRect; } return null; }
1,110,167
public void doTag(XMLOutput output) throws Exception { invokeBody(output); }
public void doTag(XMLOutput output) throws Exception { ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class ); if ( tag == null ) { throw new JellyException( "This tag must be enclosed inside a <choose> tag" ); } if ( ! tag.isBlockEvaluated() ) { tag.setBlockEvaluated(true); invokeBody(output); } }
1,110,170
public static Vector calcCCTDT(Vector chromosomes){ Vector results = new Vector(); int numMarkers = Chromosome.getSize(); for (int i = 0; i < numMarkers; i++){ TDTResult thisResult = new TDTResult(Chromosome.getMarker(i)); for (int j = 0; j < chromosomes.size()-1; j++){ Chromosome theChrom = (Chromosome)chromosomes.get(j); j++; Chromosome nextChrom = (Chromosome)chromosomes.get(j); if (theChrom.getAffected()){ thisResult.tallyCCInd(theChrom.getGenotype(i), nextChrom.getGenotype(i), 0); }else{ thisResult.tallyCCInd(theChrom.getGenotype(i), nextChrom.getGenotype(i), 1); } } results.add(thisResult); } return results; }
public static Vector calcCCTDT(Vector chromosomes){ Vector results = new Vector(); int numMarkers = Chromosome.getFilteredSize(); for (int i = 0; i < numMarkers; i++){ TDTResult thisResult = new TDTResult(Chromosome.getMarker(i)); for (int j = 0; j < chromosomes.size()-1; j++){ Chromosome theChrom = (Chromosome)chromosomes.get(j); j++; Chromosome nextChrom = (Chromosome)chromosomes.get(j); if (theChrom.getAffected()){ thisResult.tallyCCInd(theChrom.getGenotype(i), nextChrom.getGenotype(i), 0); }else{ thisResult.tallyCCInd(theChrom.getGenotype(i), nextChrom.getGenotype(i), 1); } } results.add(thisResult); } return results; }
1,110,171