当前位置: 首页>>代码示例>>Java>>正文


Java StructureParser类代码示例

本文整理汇总了Java中org.helm.notation.tools.StructureParser的典型用法代码示例。如果您正苦于以下问题:Java StructureParser类的具体用法?Java StructureParser怎么用?Java StructureParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StructureParser类属于org.helm.notation.tools包,在下文中一共展示了StructureParser类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: containAnyAtom

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
public boolean containAnyAtom() throws IOException {
	boolean containsA = false;
	String smiles = getCanSMILES();
	if (null != smiles && smiles.length() > 0) {
		Molecule mol = StructureParser.getMolecule(smiles);
		MolAtom[] atoms = mol.getAtomArray();
		for (MolAtom atom : atoms) {
			String symbol = atom.getSymbol();
			if ("A".equals(symbol)) {
				containsA = true;
				break;
			}
		}
	}
	return containsA;
}
 
开发者ID:PistoiaHELM,项目名称:HELMNotationToolkit,代码行数:17,代码来源:Monomer.java

示例2: buildSmilesMonomerDB

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
private static Map<String, Monomer> buildSmilesMonomerDB(
		Map<String, Map<String, Monomer>> monomerDB) {
	Map<String, Monomer> map = new HashMap<String, Monomer>();
	Set<String> polymerSet = monomerDB.keySet();
	for (Iterator i = polymerSet.iterator(); i.hasNext();) {
		String polymer = (String) i.next();
		Map<String, Monomer> monomerMap = monomerDB.get(polymer);
		Set<String> monomerSet = monomerMap.keySet();
		for (Iterator it = monomerSet.iterator(); it.hasNext();) {
			String monomerID = (String) it.next();
			Monomer monomer = monomerMap.get(monomerID);
			String smiles = monomer.getCanSMILES();
			try {
				smiles = StructureParser.getUniqueExtendedSMILES(smiles);
			} catch (Exception e) {
				// ignored
			}
			monomer.setCanSMILES(smiles);
			map.put(smiles, monomer);

		}
	}
	// System.out.println("smiles map count"+map.size());
	return map;
}
 
开发者ID:PistoiaHELM,项目名称:HELMNotationToolkit,代码行数:26,代码来源:MonomerFactory.java

示例3: getMolWeight

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
private double getMolWeight(String notation) throws NotationException,
		MonomerException, StructureException, JDOMException, IOException,
		PluginException {
	String smiles = ComplexNotationParser.getComplexPolymerSMILES(notation);
	MoleculeInfo mi = StructureParser.getMoleculeInfo(smiles);
	return mi.getMolecularWeight();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:8,代码来源:OligonucleotideFragmenter.java

示例4: getCapMoleculeInfo

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
/**
 * This method returns the MoleculeInfo for the input R group label of this
 * monomer
 * 
 * @param label
 *            - R1, R2...
 * @return MoleculeInfo for the cap group, R group will contribute nothing
 * @throws IOException
 * @throws PluginException
 */
public MoleculeInfo getCapMoleculeInfo(String label) throws IOException,
		PluginException {
	for (Attachment attachment : attachmentList) {
		if (attachment.getLabel().equalsIgnoreCase(label)) {
			String capSmi = attachment.getCapGroupSMILES();
			return StructureParser.getMoleculeInfo(capSmi);
		}
	}
	return null;
}
 
开发者ID:PistoiaHELM,项目名称:HELMNotationToolkit,代码行数:21,代码来源:Monomer.java

示例5: isValidNewMonomer

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
public boolean isValidNewMonomer() {
	try {
		Monomer m = getEditedMonomer();
		MonomerParser.validateMonomer(m);

		MonomerFactory monomerFactory = MonomerFactory.getInstance();
		Map<String, Map<String, Monomer>> monomerDB = monomerFactory
				.getMonomerDB();

		Map<String, Monomer> idMap = monomerDB.get(m.getPolymerType());
		Monomer[] monomers = idMap.values().toArray(new Monomer[0]);
		for (int i = 0; i < monomers.length; i++) {
			if (monomers[i].getAlternateId().equals(m.getAlternateId())) {
				JOptionPane.showMessageDialog(
						this,
						"Monomer with the same ID of " + m.getAlternateId()
								+ " already exists in "
								+ m.getPolymerType(),
						"Monomer Validation Error",
						JOptionPane.ERROR_MESSAGE);
				return false;
			}
		}

		// for structure that contains any atom, it is ok for smiles and
		// attachment to be the same

		Map<String, Monomer> smilesMap = monomerFactory
				.getSmilesMonomerDB();

		String smiles = StructureParser.getUniqueExtendedSMILES(m
				.getCanSMILES());
		if (smilesMap.containsKey(smiles)) {
			Monomer existM = smilesMap.get(smiles);

			boolean isAdhocMonomer = false;
			if (this.monomer != null) {
				isAdhocMonomer = this.monomer.isAdHocMonomer();
			}

			boolean sameAttachment = m.attachmentEquals(existM);
			if (sameAttachment || isAdhocMonomer) {
				boolean containsAnyAtom = m.containAnyAtom();
				if (!containsAnyAtom) {
					JOptionPane.showMessageDialog(
							this,
							"Monomer with the same structure already exists in "
									+ existM.getPolymerType()
									+ " with monomer ID of "
									+ existM.getAlternateId(),
							"Monomer Validation Error",
							JOptionPane.ERROR_MESSAGE);
					return false;
				}
			}
		}

		return true;

	} catch (Exception ex) {
		JOptionPane.showMessageDialog(this, ex.getMessage(),
				"Monomer Validation Error", JOptionPane.ERROR_MESSAGE);
		Logger.getLogger(MonomerViewer.class.getName()).log(Level.WARNING,
				"isValidNewMonomer", ex);
		return false;
	}

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:69,代码来源:MonomerViewer.java

示例6: actionPerformed

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
	editor.getFrame().setCursor(
			Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
	try {
		String notation = "";
		String warningMsg = "";
		String smiles = "";
		if (structureType.equals(ALL_STRUCTURE_TYPE)) {
			notation = editor.getNotation();
			if (null == notation || notation.length() == 0) {
				warningMsg = "Empty Structure!";
			}
		} else if (structureType.equals(SELECTED_STRUCTURE_TYPE)) {
			notation = editor.getSelectedNotation();
			if (null == notation || notation.length() == 0) {
				warningMsg = "No Selected Structure!";
			}
		} else {
			throw new UnsupportedOperationException(
					"Unsupported operation type :" + structureType);
		}

		if (warningMsg.length() > 0) {
			JOptionPane.showMessageDialog(editor.getFrame(), warningMsg,
					"Molecular Structure", JOptionPane.WARNING_MESSAGE);
		} else {

			// SM 2014-04-14 show structure did fail for monomers coming
			// from xhelm (XHELM-15)
			MonomerStore store = MonomerStoreCache.getInstance()
					.getCombinedMonomerStore();

			// TY
			notation = org.helm.editor.utility.NotationParser
					.transferDynamicChemicalModifiersToMonomers(notation,
							store);

			smiles = ComplexNotationParser.getComplexPolymerSMILES(
					notation, store);
			Molecule mol = StructureParser.getMolecule(smiles);
			mol.dearomatize();
			viewer.setStructure(mol);
		}

	} catch (Exception ex) {
		Logger.getLogger(ShowMolecularStructureAction.class.getName()).log(
				Level.WARNING,
				ShowMolecularStructureAction.class.getName(), ex);
		ExceptionHandler.handleException(ex);
	}

	editor.getFrame().setCursor(
			Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:55,代码来源:ShowMolecularStructureAction.java

示例7: addMonomer

import org.helm.notation.tools.StructureParser; //导入依赖的package包/类
/**
 * Adds a monomer to the store and optionally sets the dbChanged flag
 * 
 * @param monomer
 * @param dbChanged
 * @throws IOException
 * @throws MonomerException
 */
public void addMonomer(Monomer monomer, boolean dbChanged)
		throws IOException, MonomerException {
	Map<String, Monomer> monomerMap = monomerDB.get(monomer
			.getPolymerType());
	String polymerType = monomer.getPolymerType();
	String alternateId = monomer.getAlternateId();
	String smilesString = monomer.getCanSMILES();

	try {
		smilesString = StructureParser
				.getUniqueExtendedSMILES(smilesString);
	} catch (Exception e) {
		smilesString = monomer.getCanSMILES();
	}

	boolean hasSmilesString = (smilesString != null && smilesString
			.length() > 0);

	if (null == monomerMap) {
		monomerMap = new HashMap<String, Monomer>();
		monomerDB.put(polymerType, monomerMap);
	}

	Monomer copyMonomer = DeepCopy.copy(monomer);
	
	// ensure the canonical SMILES is indexed in the monomer store
	if (hasSmilesString) {
		copyMonomer.setCanSMILES(smilesString);
	}

	boolean alreadyAdded = false;
	alreadyAdded = monomerMap.containsKey(alternateId);

	if (!alreadyAdded) {
		monomerMap.put(alternateId, copyMonomer);

		boolean alreadyInSMILESMap = hasSmilesString
				&& (smilesMonomerDB.containsKey(smilesString));

		if (!alreadyInSMILESMap) {
			smilesMonomerDB.put(smilesString, copyMonomer);
		}
	}

	if (dbChanged) {
		MonomerFactory.setDBChanged(true);
	}
}
 
开发者ID:PistoiaHELM,项目名称:HELMNotationToolkit,代码行数:57,代码来源:MonomerStore.java


注:本文中的org.helm.notation.tools.StructureParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。