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


Java IAtomContainer.getProperty方法代码示例

本文整理汇总了Java中org.openscience.cdk.interfaces.IAtomContainer.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java IAtomContainer.getProperty方法的具体用法?Java IAtomContainer.getProperty怎么用?Java IAtomContainer.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openscience.cdk.interfaces.IAtomContainer的用法示例。


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

示例1: getMolName

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * returns the name of the chemical compound
 */
public static String getMolName(IAtomContainer ac) {
	String molName = (String) ac.getProperty("cdk:Title");
	if (molName == null) {
		molName = "MOL";
	}
	return molName;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:11,代码来源:ExporterHelper.java

示例2: abbreviate

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private void abbreviate(IAtomContainer mol, String mode, String annotate)
{
  switch (mode.toLowerCase()) {
    case "true":
    case "on":
    case "yes":
    case "groups":
      contractHydrates(mol);
      abbreviations.apply(mol);
      break;
    case "reagents":
      contractHydrates(mol);
      break;
  }
  // remove abbreviations of mapped atoms
  if ("mapidx".equals(annotate)) {
    List<Sgroup> sgroups  = mol.getProperty(CDKConstants.CTAB_SGROUPS);
    List<Sgroup> filtered = new ArrayList<>();
    if (sgroups != null) {
      for (Sgroup sgroup : sgroups) {
        // turn off display short-cuts
        if (sgroup.getType() == SgroupType.CtabAbbreviation ||
            sgroup.getType() == SgroupType.CtabMultipleGroup) {
          boolean okay = true;
          for (IAtom atom : sgroup.getAtoms()) {
            if (atom.getProperty(CDKConstants.ATOM_ATOM_MAPPING) != null) {
              okay = false;
              break;
            }
          }
          if (okay) filtered.add(sgroup);
        } else {
          filtered.add(sgroup);
        }
      }
      mol.setProperty(CDKConstants.CTAB_SGROUPS, filtered);
    }
  }
}
 
开发者ID:cdk,项目名称:depict,代码行数:40,代码来源:DepictController.java

示例3: draw

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void draw(String sdfFile){
	List<IAtomContainer> mols = SDFUtils.parseSDF(sdfFile);
	for(int i=0; i<mols.size(); i++){
		IAtomContainer mol = mols.get(i);
		String id = (String) mol.getProperty("PUBCHEM_COMPOUND_CID");
		String name = sdfFile.replace(".sdf", "_" + id);
		draw(mol, name);
	}
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:10,代码来源:MolDrawer.java

示例4: drawAsStruct

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void drawAsStruct(String sdfFile){
	List<IAtomContainer> mols = SDFUtils.parseSDF(sdfFile);
	for(int i=0; i<mols.size(); i++){
		IAtomContainer mol = mols.get(i);
		MolStruct struct = new CyclicStruct(mol);
		String id = (String) mol.getProperty("PUBCHEM_COMPOUND_CID");
		String name = sdfFile.replace(".sdf", "_struct_" + id);
		draw(struct, name);
	}
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:11,代码来源:MolDrawer.java

示例5: readCandidatesFromFile

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * @throws Exception
 * 
 */
private void readCandidatesFromFile() throws Exception {
	this.candidates = new java.util.Vector<ICandidate>();
	java.io.File f = new java.io.File((String) this.settings.get(VariableNames.LOCAL_DATABASE_PATH_NAME));
	java.util.Vector<String> identifiers = new java.util.Vector<String>();
	if (f.isFile()) {
		IteratingSDFReader reader = new IteratingSDFReader(new java.io.FileReader(f), DefaultChemObjectBuilder.getInstance());
		int index = 1;
		while (reader.hasNext()) {
			IAtomContainer molecule = reader.next();
			String identifier = molecule.getID();
			if (molecule.getProperty("Identifier") != null)
				identifier = (String) molecule.getProperty("Identifier");
			molecule = MoleculeFunctions.convertImplicitToExplicitHydrogens(molecule);
			AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);

			if (identifier == null || identifier.length() == 0)
				identifier = String.valueOf(index);
			if(identifiers.contains(identifier)) throw new Exception();
			identifiers.add(identifier);
			String[] inchiInfo = MoleculeFunctions.getInChIInfoFromAtomContainer(molecule);
			ICandidate precursorCandidate = new TopDownPrecursorCandidate(inchiInfo[0], identifier);

			java.util.Iterator<Object> properties = molecule.getProperties().keySet().iterator();
			while (properties.hasNext()) {
				String key = (String) properties.next();
				if (key != null && molecule.getProperty(key) != null)
					precursorCandidate.setProperty(key, molecule.getProperty(key));
			}
			precursorCandidate.setProperty(VariableNames.INCHI_KEY_1_NAME, inchiInfo[1].split("-")[0]);
			precursorCandidate.setProperty(VariableNames.INCHI_KEY_2_NAME, inchiInfo[1].split("-")[1]);
			precursorCandidate.setProperty(VariableNames.MOLECULAR_FORMULA_NAME, inchiInfo[0].split("/")[1]);
			try {
				precursorCandidate.setProperty(VariableNames.MONOISOTOPIC_MASS_NAME, precursorCandidate.getMolecularFormula().getMonoisotopicMass());
			} catch (AtomTypeNotKnownFromInputListException e) {
				continue;
			}
			this.candidates.add(precursorCandidate);
			index++;
		}
	}
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:46,代码来源:LocalSDFDatabase.java

示例6: export

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public void export(RandomAccessMDLReader reader, EncodingFingerprint fingerprinter, String label, File outputFile, boolean useAromaticFlag) {

	try {
		final FileWriter fw = new FileWriter(outputFile);
		double collisions = 0;
		double featureCount = 0.0;
		Long start = System.currentTimeMillis();
		
		ProgressBar progressBar = new ProgressBar(reader.getSize());
		for (int i = 0; i < reader.getSize(); i++) {
		
			IAtomContainer mol = reader.getMol(i);
			FeatureMap featureMap = new FeatureMap(fingerprinter.getFingerprint(mol));
			String molLabel = (String) mol.getProperty(label);
			if (molLabel != null) {
				featureMap.setLabel(molLabel);
			} else {
				featureMap.setLabel(ExporterHelper.getMolName(mol) + "_INDEX=" + i);
			}

			Set<IFeature> featureKeys = featureMap.getKeySet();
			featureCount = featureCount + featureKeys.size();
			HashMap<Integer, IFeature> features = new HashMap<Integer, IFeature>();

			for (IFeature feature : featureKeys) {
				int hashCode = ExporterHelper.rehash(feature.hashCode(), this.hashSpace);
				if (features.containsKey(hashCode)) {
					collisions++;
				} else {
					features.put(hashCode, feature);
				}
			}

			fw.append(featureMap.getLabel() + ", ");
			for (int h = 0; h < hashSpace; h++) {
				if (h == hashSpace - 1) {
					if (features.containsKey(h)) {
						fw.append("1");
					} else {
						fw.append("0");
					}
					continue;
				}

				if (features.containsKey(h)) {
					fw.append("1, ");
				} else {
					fw.append("0, ");
				}
			}
			fw.append("\n");
			progressBar.DisplayBar();
		}

		fw.close();
		Long end = System.currentTimeMillis();
		System.out.println("Time elapsed: " + (end - start) + " ms");
		ExporterHelper.printInfo(collisions, featureCount, reader.getSize());

	} catch (final IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:65,代码来源:ExporterFullFingerprintCSV.java

示例7: export

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public void export(RandomAccessMDLReader reader, EncodingFingerprint fingerprinter, String label, File outputFile, boolean useAromaticFlag) {
	
	try {
		
		final FileWriter fw = new FileWriter(outputFile);
		double collisions = 0;
		double featureCount = 0.0;
		Long start = System.currentTimeMillis();
		writeHeader(fw,fingerprinter,label,reader);
		
		ProgressBar progressBar = new ProgressBar(reader.getSize());
		
			for (int i = 0; i < reader.getSize(); i++) {
			IAtomContainer mol = reader.getMol(i);
			FeatureMap featureMap = new FeatureMap(fingerprinter.getFingerprint(mol));
			String molLabel = (String) mol.getProperty(label);
			if (molLabel != null) {
				featureMap.setLabel(molLabel);
			} else {
				featureMap.setLabel("?");
			}

			Set<IFeature> keys = featureMap.getKeySet();
			featureCount = featureCount + keys.size();
			ArrayList<IFeature> featureBits = new ArrayList<IFeature>();
			// rehash all features and pack them into a sortable list
			
			
			
			for (IFeature feature : keys) {
				if (feature instanceof IFeature) {
					if(feature instanceof PositionFeature){
						featureBits.add(feature);
					}else{
						int localHash = ExporterHelper.rehash(feature.hashCode(), this.hashSpace);
						IFeature hashedFeature = new HashedBitFeature(localHash);
						featureBits.add(hashedFeature);
					}
				}
			}
			
			progressBar.DisplayBar();
				Collections.sort(featureBits);
			collisions += writeFingerprint(featureBits, fw, featureMap.getLabel());
		}

		fw.close();
		Long end = System.currentTimeMillis();
		System.out.println("Time elapsed: " + (end - start) + " ms");
		ExporterHelper.printInfo(collisions, featureCount, reader.getSize());

	} catch (final IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:57,代码来源:ExporterHashLinear.java

示例8: export

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public void export(RandomAccessMDLReader reader, EncodingFingerprint fingerprinter, String label, File outputFile, boolean useAromaticFlag) {
	Long start = System.currentTimeMillis();
	ArrayList<FeatureMap> featuremaps = new ArrayList<FeatureMap>();
	
	ProgressBar progressbar = new ProgressBar(reader.getSize());
	for (int i = 0; i < reader.getSize(); i++) {
		IAtomContainer mol = reader.getMol(i);
		FeatureMap featureMap = new FeatureMap(fingerprinter.getFingerprint(mol));
		String molLabel = (String) mol.getProperty(label);
		if (molLabel != null) {
			featureMap.setLabel(molLabel);
		} else {
			featureMap.setLabel(ExporterHelper.getMolName(mol) + "_INDEX=" + i);
		}
		featuremaps.add(featureMap);
		progressbar.DisplayBar();
	}
	FeatureMapHelper.printFeatureMapStatistics(featuremaps);
	Long end = System.currentTimeMillis();
	System.out.println("Time elapsed (feature generation): " + (end - start) + " ms");
	
	final DecimalFormat df = new DecimalFormat();
	final MatrixCalculator matrixCalculator = new MatrixCalculator();
	matrixCalculator.setSimilaritymeasure(this.distanceMeasure);
	
	start = System.currentTimeMillis();
	final double[][] matrix = matrixCalculator.computeMatrix(featuremaps);
	end = System.currentTimeMillis();
	System.out.println("Time elapsed (matrix computation): " + (end - start) + " ms");

	try {
		final FileWriter fw = new FileWriter(outputFile);
		for (int i = 0; i < matrix.length; i++) {
				fw.append(featuremaps.get(i).getLabel() + " 0:" + (i + 1));
			for (int j = 0; j < matrix[i].length; j++) {
				fw.append(" " + (j + 1) + ":" + df.format(matrix[i][j]));
			}
			fw.append("\n");
		}
		fw.close();
	} catch (final IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:46,代码来源:ExporterLIBSVMMatrix.java

示例9: getPubID

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static PubchemID getPubID(IAtomContainer mol){
	return new PubchemID((String) mol.getProperty("PUBCHEM_COMPOUND_CID"));
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:4,代码来源:MolUtils.java

示例10: getStructID

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static StructID getStructID(IAtomContainer mol){
	return new StructID((String) mol.getProperty("PUBCHEM_COMPOUND_CID") + "_STRUCT");
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:4,代码来源:MolUtils.java


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