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


Java IAtomContainer.setProperty方法代码示例

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


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

示例1: getCandidateByIdentifier

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * Get many IAtomContainers by one several compound ids
 * 
 * @throws Exception 
 * 
 */
public Vector<IAtomContainer> getCandidateByIdentifier(java.util.Vector<String> identifiers) throws Exception {
	//fetch the hits from PubChem
	Vector<String> ids = this.savingRetrievedHits(identifiers);
	
	Vector<IAtomContainer> containers = new Vector<IAtomContainer>();
	if(ids == null || ids.size() == 0) return containers;

	for(int i = 0; i < ids.size(); i++) {
		if(this.cidToInChIs.get(ids.get(i)) == null) {
			System.err.println("Error: Could not retrieve molecule with ID " + ids.get(i));
			throw new Exception();
		}
			
		IAtomContainer container = this.getAtomContainerFromInChI(this.cidToInChIs.get(ids.get(i)));
		//if you like to use SMILES uncomment here
		//IAtomContainer container = this.getAtomContainerFromSMILES(this.cidToSmiles.get(identifier));
		this.prepareAtomContainer(container);
		container.setProperty("Identifier", ids.get(i));
		//set additional properties that you like ....
		
		containers.addElement(container);
	}

	return containers;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:32,代码来源:OnlinePubChemDatabaseMicha.java

示例2: readDataBlockInto

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private void readDataBlockInto(IAtomContainer m) throws IOException {
    String fieldName = null;
    while ((currentLine = input.readLine()) != null
            && !SDF_RECORD_SEPARATOR.matcher(currentLine).matches()) {
        logger.debug("looking for data header: ", currentLine);
        String str = new String(currentLine);
        if (SDF_FIELD_START.matcher(str).find()) {
            fieldName = extractFieldName(fieldName, str);
            String data = input.readLine();
            if (fieldName != null) {
                logger.info("fieldName, data: ", fieldName, ", ", data);
                m.setProperty(fieldName, data);
            }
        }
    }
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:17,代码来源:IteratingSDFReader.java

示例3: 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

示例4: addSkeletonToMainLib

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
void addSkeletonToMainLib(IAtomContainer container) {
    IAtomContainer skeleton = clearHydrogens(AtomContainerManipulator.skeleton(container));
    for (int i = 0; i < container.getAtomCount(); i++)
        skeleton.getAtom(i).setPoint2d(new Point2d(container.getAtom(i).getPoint2d()));
    skeleton.setProperty(CDKConstants.TITLE, container.getProperty(CDKConstants.TITLE));
    String skeletonKey = toCanSmi(skeleton);
    library.put(skeletonKey, skeleton);
}
 
开发者ID:cdk,项目名称:cdk-build-util,代码行数:9,代码来源:RingTemplateExtractor.java

示例5: addAnonymousToMainLib

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
void addAnonymousToMainLib(IAtomContainer container) {
    IAtomContainer skeleton = clearHydrogens(AtomContainerManipulator.skeleton(container));
    for (int i = 0; i < container.getAtomCount(); i++)
        skeleton.getAtom(i).setPoint2d(new Point2d(container.getAtom(i).getPoint2d()));
    skeleton.setProperty(CDKConstants.TITLE, container.getProperty(CDKConstants.TITLE));
    String skeletonKey = toCanSmi(skeleton);
    library.put(skeletonKey, skeleton);
}
 
开发者ID:cdk,项目名称:cdk-build-util,代码行数:9,代码来源:RingTemplateExtractor.java

示例6: addSkeleton

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
void addSkeleton(IAtomContainer container) {
    IAtomContainer skeleton = clearHydrogens(AtomContainerManipulator.skeleton(container));
    for (int i = 0; i < container.getAtomCount(); i++)
        skeleton.getAtom(i).setPoint2d(new Point2d(container.getAtom(i).getPoint2d()));
    skeleton.setProperty(CDKConstants.TITLE, container.getProperty(CDKConstants.TITLE));
    String skeletonKey = toCanSmi(skeleton);
    if (!skeltons.containsKey(skeletonKey))
        skeltons.put(skeletonKey, skeleton);
}
 
开发者ID:cdk,项目名称:cdk-build-util,代码行数:10,代码来源:RingTemplateExtractor.java

示例7: addAnonymous

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
void addAnonymous(IAtomContainer container) {
    IAtomContainer anonymous = clearHydrogens(AtomContainerManipulator.anonymise(container));
    for (int i = 0; i < container.getAtomCount(); i++)
        anonymous.getAtom(i).setPoint2d(new Point2d(container.getAtom(i).getPoint2d()));
    anonymous.setProperty(CDKConstants.TITLE, container.getProperty(CDKConstants.TITLE));
    String anonymousKey = toCanSmi(anonymous);
    if (!this.anonymous.containsKey(anonymousKey))
        this.anonymous.put(anonymousKey, anonymous);
}
 
开发者ID:cdk,项目名称:cdk-build-util,代码行数:10,代码来源:RingTemplateExtractor.java

示例8: generateMatchingFragments

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param molecule
 * @param masses
 * @param exactMass
 * @param mzabs
 * @param mzppm
 * @param posCharge
 * @param mode
 * @param treeDepth
 * @return
 */
public static IAtomContainer[] generateMatchingFragments(IAtomContainer molecule, double[] masses, double exactMass, 
		double mzabs, double mzppm, boolean posCharge, int mode, int treeDepth) {

	Logger.getLogger("net.sf.jnati.deploy.artefact.ConfigManager").setLevel(Level.ERROR);
	Logger.getLogger("net.sf.jnati.deploy.repository.ClasspathRepository").setLevel(Level.ERROR);
	Logger.getLogger("net.sf.jnati.deploy.repository.LocalRepository").setLevel(Level.ERROR);
	Logger.getLogger("net.sf.jnati.deploy.artefact.ManifestReader").setLevel(Level.ERROR);
	Logger.getLogger("net.sf.jnati.deploy.NativeArtefactLocator").setLevel(Level.ERROR);
	Logger.getLogger("net.sf.jnati.deploy.NativeLibraryLoader").setLevel(Level.ERROR);
	
	MoleculeFunctions.prepareAtomContainer(molecule, false);
	
	IAtomContainer[] moleculeAsArray = {molecule};

	String peaksString = "";
	if(masses.length > 0) peaksString += masses[0] + " 100";
	for(int i = 1; i < masses.length; i++) {
		peaksString += "\n" + masses[i] + " 100";
	}
	
	String[] score_names = {VariableNames.METFRAG_FRAGMENTER_SCORE_NAME};
	Double[] score_weights = {1.0};
	
	MetFragGlobalSettings settings = new MetFragGlobalSettings();
	settings.set(VariableNames.MOLECULES_IN_MEMORY, moleculeAsArray);
	settings.set(VariableNames.PEAK_LIST_STRING_NAME, peaksString);
	settings.set(VariableNames.METFRAG_DATABASE_TYPE_NAME, "LocalInMemoryDatabase");
	settings.set(VariableNames.METFRAG_PEAK_LIST_READER_NAME, "de.ipbhalle.metfraglib.peaklistreader.FilteredStringTandemMassPeakListReader");
	settings.set(VariableNames.METFRAG_SCORE_TYPES_NAME, score_names);
	settings.set(VariableNames.METFRAG_SCORE_WEIGHTS_NAME, score_weights);
	settings.set(VariableNames.RELATIVE_MASS_DEVIATION_NAME, mzppm);
	settings.set(VariableNames.ABSOLUTE_MASS_DEVIATION_NAME, mzabs);
	settings.set(VariableNames.IS_POSITIVE_ION_MODE_NAME, posCharge);
	settings.set(VariableNames.PRECURSOR_ION_MODE_NAME, mode);
	settings.set(VariableNames.PRECURSOR_NEUTRAL_MASS_NAME, exactMass);
	settings.set(VariableNames.MAXIMUM_TREE_DEPTH_NAME, (byte)treeDepth);

	CombinedMetFragProcess mp = new CombinedMetFragProcess(settings);

	try {
		mp.retrieveCompounds();
	} catch (Exception e2) {
		System.err.println("Error retrieving candidates");
	}
	
	try {
		mp.run();
	} catch (Exception e) {
		System.err.println("Error running MetFrag process");
	}
	
	SortedScoredCandidateList scoredCandidateList = (SortedScoredCandidateList) mp.getCandidateList();
	
	MatchList assignedFragmentList = scoredCandidateList.getElement(0).getMatchList();
	IAtomContainer[] assignedFragments = new IAtomContainer[assignedFragmentList.getNumberElements()];
	
	for(int i = 0; i < assignedFragmentList.getNumberElements(); i++) {
		IAtomContainer currentFragment = assignedFragmentList.getElement(i).getBestMatchedFragment().getStructureAsIAtomContainer();
		currentFragment.setProperty("AssignedMassPeak", assignedFragmentList.getElement(i).getMatchedPeak().getMass());
		currentFragment.setProperty("FragmentMass", assignedFragmentList.getElement(i).getBestMatchedFragment().getMonoisotopicMass());
		assignedFragments[i] = currentFragment;
	}
	
	return assignedFragments;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:78,代码来源:MetfRag.java

示例9: main

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * @param args
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
	String cacheMassBank = "/vol/massbank/Cache/";
	String recDir = "/home/mgerlich/Datasets/allSpectra/";
	File recs = new File(recDir);
	File[] list = recs.listFiles();
	MassBankUtilities mbu = new MassBankUtilities();
	SDFWriter sdfw = new SDFWriter(new FileOutputStream(new File("/home/mgerlich/dataset.sdf")));
	
	for (int i = 0; i < list.length; i++) {
		String id = list[i].getName().substring(0, list[i].getName().indexOf("."));
		String prefix = "";
   		if(id.matches("[A-Z]{3}[0-9]{5}"))
   			prefix = id.substring(0, 3);
   		else prefix = id.substring(0, 2);
   		
   		String[] info = mbu.getPeaklistFromFile(list[i]);
   		id = info[2];
   		
           File dir = new File(cacheMassBank);
           String[] institutes = dir.list();
           File f = null;
           String basePath = "";
           for (int j = 0; j < institutes.length; j++) {
               if(institutes[j].equals(prefix)) {
                   f = new File(dir, institutes[j] + "/mol/");
                   basePath = f.getAbsolutePath();
                   if(!basePath.endsWith("/"))
                           basePath += "/";
                   break;
               }
           }
           
           IAtomContainer container = null;
           // first look if container is present, then download if not
           container = mbu.getContainer(id, basePath);
           container.setProperty("cdk:Title", id);
           
           Map<String, String> links = mbu.retrieveLinks(id, "0");
           if(links.containsKey("KEGG"))
           	container.setProperty("KEGG", links.get("KEGG"));	// not all records have KEGG ID's
           
           container.setProperty("PUBCHEM", links.get("PUBCHEM")); // but all records do have PUBCHEM ID's
           
           try {
			sdfw.write(container);
		} catch (CDKException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	sdfw.close();
}
 
开发者ID:mgerlich,项目名称:MetFusion,代码行数:58,代码来源:OrganizeDataset.java


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