⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdbconvention.java

📁 化学图形处理软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        if (atomCounter == 0) {            return;        }        boolean hasID = false;        boolean has3D = false;        boolean has3Dfract = false;        boolean has2D = false;        boolean hasFormalCharge = false;        boolean hasPartialCharge = false;        boolean hasHCounts = false;        boolean hasSymbols = false;        boolean hasTitles = false;        boolean hasIsotopes = false;        boolean hasDictRefs = false;        boolean hasSpinMultiplicities = false;        boolean hasOccupancies = false;        if (elid.size() == atomCounter) {            hasID = true;        } else {            logger.debug("No atom ids: " + elid.size(), " != " + atomCounter);        }        if (elsym.size() == atomCounter) {            hasSymbols = true;        } else {            logger.debug(                    "No atom symbols: " + elsym.size(), " != " + atomCounter);        }        if (eltitles.size() == atomCounter) {            hasTitles = true;        } else {            logger.debug(                    "No atom titles: " + eltitles.size(), " != " + atomCounter);        }        if ((x3.size() == atomCounter) && (y3.size() == atomCounter) &&             (z3.size() == atomCounter)) {            has3D = true;        } else {            logger.debug(                    "No 3D info: " + x3.size(), " " + y3.size(), " " +                     z3.size(), " != " + atomCounter);        }        if ((xfract.size() == atomCounter) && (yfract.size() == atomCounter) &&             (zfract.size() == atomCounter)) {            has3Dfract = true;        } else {            logger.debug(                    "No 3D fractional info: " + xfract.size(), " " + yfract.size(), " " +                     zfract.size(), " != " + atomCounter);        }        if ((x2.size() == atomCounter) && (y2.size() == atomCounter)) {            has2D = true;        } else {            logger.debug(                    "No 2D info: " + x2.size(), " " + y2.size(), " != " +                     atomCounter);        }        if (formalCharges.size() == atomCounter) {            hasFormalCharge = true;        } else {            logger.debug(                    "No formal Charge info: " + formalCharges.size(),                     " != " + atomCounter);        }        if (partialCharges.size() == atomCounter) {            hasPartialCharge = true;        } else {            logger.debug(                    "No partial Charge info: " + partialCharges.size(),                    " != " + atomCounter);        }        if (hCounts.size() == atomCounter) {            hasHCounts = true;        } else {            logger.debug(                    "No hydrogen Count info: " + hCounts.size(),                     " != " + atomCounter);        }        if (spinMultiplicities.size() == atomCounter) {            hasSpinMultiplicities = true;        } else {            logger.debug(                    "No spinMultiplicity info: " + spinMultiplicities.size(),                    " != " + atomCounter);        }        if (occupancies.size() == atomCounter) {            hasOccupancies = true;        } else {            logger.debug(                    "No occupancy info: " + occupancies.size(),                    " != " + atomCounter);        }        if (atomDictRefs.size() == atomCounter) {            hasDictRefs = true;        } else {            logger.debug(                    "No dictRef info: " + atomDictRefs.size(),                    " != " + atomCounter);        }        if (isotope.size() == atomCounter) {            hasIsotopes = true;        } else {            logger.debug(                    "No isotope info: " + isotope.size(),                    " != " + atomCounter);        }        if(atomCounter > 0){//        	cdo.startObject("PDBMonomer");        	currentMonomer = currentChemFile.getBuilder().newPDBMonomer();        }		for (int i = 0; i < atomCounter; i++) {            logger.info("Storing atom: ", i);//            cdo.startObject("PDBAtom");            currentAtom = currentChemFile.getBuilder().newPDBAtom("H");            if (hasID) {//                cdo.setObjectProperty("Atom", "id", (String)elid.get(i));                currentAtom.setID((String)elid.get(i));            }            if (hasTitles) {                if (hasSymbols) {                    String symbol = (String)elsym.get(i);                    if (symbol.equals("Du") || symbol.equals("Dummy")) {//                        cdo.setObjectProperty("PseudoAtom", "label", (String)eltitles.get(i));                        if (!(currentAtom instanceof IPseudoAtom)) {                            currentAtom = currentChemFile.getBuilder().newPseudoAtom(currentAtom);                        }                        ((IPseudoAtom)currentAtom).setLabel((String)eltitles.get(i));                    } else {//                        cdo.setObjectProperty("Atom", "title", (String)eltitles.get(i));                    	// FIXME: is a guess, Atom.title is not found in ChemFileCDO                    	currentAtom.setProperty(CDKConstants.TITLE, (String)eltitles.get(i));                    }                } else {//                    cdo.setObjectProperty("Atom", "title", (String)eltitles.get(i));//               	 FIXME: is a guess, Atom.title is not found in ChemFileCDO                	currentAtom.setProperty(CDKConstants.TITLE, (String)eltitles.get(i));                }            }            // store optional atom properties            if (hasSymbols) {                String symbol = (String)elsym.get(i);                if (symbol.equals("Du") || symbol.equals("Dummy")) {                    symbol = "R";                }//                cdo.setObjectProperty("Atom", "type", symbol);                if (symbol.equals("R") && !(currentAtom instanceof IPseudoAtom)) {                    currentAtom = currentChemFile.getBuilder().newPseudoAtom(currentAtom);                }                currentAtom.setSymbol(symbol);                try {					IsotopeFactory.getInstance(currentAtom.getBuilder()).configure(currentAtom);				} catch (Exception e) {					logger.error("Could not configure atom: " + currentAtom);					logger.debug(e);				}            }            if (has3D) {//                cdo.setObjectProperty("Atom", "x3", (String)x3.get(i));//                cdo.setObjectProperty("Atom", "y3", (String)y3.get(i));//                cdo.setObjectProperty("Atom", "z3", (String)z3.get(i));                currentAtom.setPoint3d(                	new Point3d(                		Double.parseDouble((String)x3.get(i)),                		Double.parseDouble((String)y3.get(i)),                		Double.parseDouble((String)z3.get(i))                	)                );            }            if (has3Dfract) {                // ok, need to convert fractional into eucledian coordinates//                cdo.setObjectProperty("Atom", "xFract", (String)xfract.get(i));//                cdo.setObjectProperty("Atom", "yFract", (String)yfract.get(i));//                cdo.setObjectProperty("Atom", "zFract", (String)zfract.get(i));                currentAtom.setFractionalPoint3d(                   	new Point3d(                   		Double.parseDouble((String)xfract.get(i)),                   		Double.parseDouble((String)yfract.get(i)),                   		Double.parseDouble((String)zfract.get(i))                   	)                );            }            if (hasFormalCharge) {//              cdo.setObjectProperty("Atom", "formalCharge", //                                    (String)formalCharges.get(i));            	currentAtom.setFormalCharge(Integer.parseInt((String)formalCharges.get(i)));            }            if (hasPartialCharge) {            	logger.debug("Storing partial atomic charge...");//          	cdo.setObjectProperty("Atom", "partialCharge", //          	(String)partialCharges.get(i));            	currentAtom.setCharge(Double.parseDouble((String)partialCharges.get(i)));            }            if (hasHCounts) {//          	cdo.setObjectProperty("Atom", "hydrogenCount", (String)hCounts.get(i));            	// FIXME: the hCount in CML is the total of implicit *and* explicit            	currentAtom.setHydrogenCount(Integer.parseInt((String)hCounts.get(i)));            }            if (has2D) {                if (x2.get(i) != null && y2.get(i) != null) {//                    cdo.setObjectProperty("Atom", "x2", (String)x2.get(i));//                    cdo.setObjectProperty("Atom", "y2", (String)y2.get(i));                	currentAtom.setPoint2d(                		new Point2d(                			Double.parseDouble((String)x2.get(i)),                			Double.parseDouble((String)y2.get(i))               			)                	);                }            }                        if (hasDictRefs) {//                cdo.setObjectProperty("Atom", "dictRef", (String)atomDictRefs.get(i));            	currentAtom.setProperty("org.openscience.cdk.dict", (String)atomDictRefs.get(i));            }            if (hasSpinMultiplicities && spinMultiplicities.get(i) != null) {//                cdo.setObjectProperty("Atom", "spinMultiplicity", (String)spinMultiplicities.get(i));            	int unpairedElectrons = Integer.parseInt((String)spinMultiplicities.get(i))-1;                for (int sm=0; sm<unpairedElectrons; sm++) {                    currentMolecule.addSingleElectron(currentChemFile.getBuilder().newSingleElectron(currentAtom));                }            }            if (hasOccupancies && occupancies.get(i) != null) {//                cdo.setObjectProperty("PDBAtom", "occupancy", (String)occupancies.get(i));                double occ = Double.parseDouble((String)occupancies.get(i));                if(occ >= 0.0)                    ((IPDBAtom)currentAtom).setOccupancy(occ);            }            if (hasIsotopes) {//              cdo.setObjectProperty("Atom", "massNumber", (String)isotope.get(i));            	currentAtom.setMassNumber(Integer.parseInt((String)isotope.get(i)));            }                        if(hasScalar){//                cdo.setObjectProperty("PDBAtom", "altLoc", altLocV.get(i).toString());                ((IPDBAtom)currentAtom).setAltLoc(altLocV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "chainID", chainIDV.get(i).toString());                ((IPDBAtom)currentAtom).setChainID(chainIDV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "hetAtom", hetAtomV.get(i).toString());                boolean hetAtom = false;                if(hetAtomV.get(i).toString().equals("true"))                	hetAtom = true;                ((IPDBAtom)currentAtom).setHetAtom(hetAtom);//                cdo.setObjectProperty("PDBAtom", "iCode", iCodeV.get(i).toString());                ((IPDBAtom)currentAtom).setICode(iCodeV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "name", nameV.get(i).toString());                ((IPDBAtom)currentAtom).setName(nameV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "oxt", oxtV.get(i).toString());                boolean oxt = false;                if(oxtV.get(i).toString().equals("true"))                	oxt = true;                ((IPDBAtom)currentAtom).setOxt(oxt);//                cdo.setObjectProperty("PDBAtom", "resSeq", resSeqV.get(i).toString());                ((IPDBAtom)currentAtom).setResSeq(resSeqV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "record", recordV.get(i).toString());                ((IPDBAtom)currentAtom).setRecord(recordV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "resName", resNameV.get(i).toString());                ((IPDBAtom)currentAtom).setResName(resNameV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "segID", segIDV.get(i).toString());                ((IPDBAtom)currentAtom).setSegID(segIDV.get(i).toString());//                cdo.setObjectProperty("PDBAtom", "serial", serialV.get(i).toString());                ((IPDBAtom)currentAtom).setSerial(Integer.parseInt(serialV.get(i).toString()));//                cdo.setObjectProperty("PDBAtom", "tempFactor", tempFactorV.get(i).toString());                ((IPDBAtom)currentAtom).setTempFactor(Double.parseDouble(tempFactorV.get(i).toString()));            }            //            cdo.endObject("PDBAtom");            String cResidue = ((IPDBAtom)currentAtom).getResName()+"A"+((IPDBAtom)currentAtom).getResSeq();            ((IPDBMonomer)currentMonomer).setMonomerName(cResidue);            ((IPDBMonomer)currentMonomer).setMonomerType(((IPDBAtom)currentAtom).getResName());            ((IPDBMonomer)currentMonomer).setChainID(((IPDBAtom)currentAtom).getChainID());            ((IPDBMonomer)currentMonomer).setICode(((IPDBAtom)currentAtom).getICode());            ((IPDBPolymer)currentMolecule).addAtom(            	((IPDBAtom)currentAtom),currentMonomer,currentStrand            );        }//		cdo.endObject("PDBMonomer");		// nothing done in the CDO for this event        if (elid.size() > 0) {            // assume this is the current working list            bondElid = elid;        }        newAtomData();    }        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -