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


C# IAtomContainer.getProperty方法代码示例

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


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

示例1: MatchByMass

		private bool MatchByMass(IAtomContainer ac, double peak, double mzabs, double mzppm, out double matchedMass, out double hydrogenPenalty, out int hydrogensAdded)
		{
			matchedMass = 0;
			hydrogenPenalty = 0;
			hydrogensAdded = 0;
			
			double mass;
			//speed up and neutral loss matching!
			if (ac.getProperty("FragmentMass") != null && (string)ac.getProperty("FragmentMass") != "")
			{
                mass = double.Parse(ac.getProperty("FragmentMass").ToString(), CultureInfo.InvariantCulture);
			}
			else
			{
				mass = MolecularFormulaTools.GetMonoisotopicMass(GetMolecularFormula(ac));
			}

			var peakLow = peak - mzabs - PpmTool.GetPPMDeviation(peak, mzppm);
			var peakHigh = peak + mzabs + PpmTool.GetPPMDeviation(peak, mzppm);			

			//now try to add/remove neutral hydrogens ...at most the treedepth
			var treeDepth = int.Parse((String)ac.getProperty("TreeDepth"));
			for (var i = 0; i <= treeDepth; i++)
			{
				var hMass = i * hydrogenMass;

				if ((mass + hMass) >= peakLow && (mass + hMass) <= peakHigh)
				{
					matchedMass = Math.Round(mass + hMass, 4);

					//now add a bond energy equivalent to a H-C bond
					hydrogenPenalty = (i * 1000);

					hydrogensAdded = i;

					return true;
				}

				if ((mass - hMass) >= peakLow && (mass - hMass) <= peakHigh)
				{
					matchedMass = Math.Round(mass - hMass, 4);

					//now add a bond energy equivalent to a H-C bond
					hydrogenPenalty = (i * 1000);

					hydrogensAdded = -i;

					return true;
				}
			}
			return false;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:52,代码来源:FragmentPeakAssigner.cs

示例2: isIdentical

		/**
		 * Quick isomorphism check:
		 * ...if the fragment is isomorph to the ones already in the map
		 * ...only the atoms are compared and a list of bonds is stored in a
		 * 		map with sum formula to fragment
		 * 
		 * 
		 * @param fragment the fragment to be checked
		 * 
		 * @return true, if successful
		 * 
		 * @throws CDKException the CDK exception
		 */

		private bool isIdentical(IAtomContainer fragment, string currentSumFormula)
		{
			var isomorph = false;

			List<IAtomContainer> fragsToCompare = null;
			
			//iterate over list to check for isomorphism
			if (sumformulaToFragMap.TryGetValue(currentSumFormula, out fragsToCompare))
			{
				isomorph = identicalAtoms(fragment, fragsToCompare);

				if (isomorph)
				{
					//now replace fragment if its "bond energy is less"
					var bondEnergy = Double.Parse((String)fragment.getProperty("BondEnergy"), CultureInfo.InvariantCulture);
					foreach (var atomContainer in fragsToCompare)
					{
                        if (Double.Parse((String)atomContainer.getProperty("BondEnergy"), CultureInfo.InvariantCulture) > bondEnergy)
						{
							addFragmentToListMapReplace(fragment, currentSumFormula);
						}
					}
				}
					//if not in map (with this formula) add it
				else
				{
					addFragmentToListMap(fragment, currentSumFormula);
				}
			}
			else
			{
				//sum formula has no entry in map yet
				addFragmentToListMap(fragment, currentSumFormula);
			}
			return isomorph;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:50,代码来源:Fragmenter.cs

示例3: getFragmentMass

		/**
		 * Gets the fragment mass subtracting the neutral loss from it.
		 * It also sets the new FragmentWeight property
		 * 
		 * @param fragment the fragment
		 * @param mass the mass
		 * 
		 * @return the fragment mass
		 */

		private double getFragmentMass(IAtomContainer fragment, double mass)
		{
			var massFinal = mass;
			var nlMass = 0.0;
			if (fragment.getProperty("FragmentMass") != null && (string)fragment.getProperty("FragmentMass") != "")
			{
				if (fragment.getProperty("NlMass") != null && (string)fragment.getProperty("NlMass") != "")
				{
					var tempNLMass = fragment.getProperty("NlMass").ToString().Split(',');
					for (var i = 0; i < tempNLMass.Count(); i++)
					{
                        nlMass += Convert.ToDouble(tempNLMass[i], CultureInfo.InvariantCulture);
					}
				}
			}
			massFinal = massFinal - nlMass;
			fragment.setProperty("FragmentMass", massFinal.ToString(CultureInfo.InvariantCulture));
			return massFinal;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:29,代码来源:Fragmenter.cs

示例4: setBondEnergy

		/**
		 * Sets the bond energy.
		 * 
		 * @param mol the mol
		 * @param bondEnergy the bond energy
		 * 
		 * @return the i atom container
		 */

		private IAtomContainer setBondEnergy(IAtomContainer origMol, IAtomContainer mol, Double bondEnergy)
		{
			var props = mol.getProperties();
			var bondEnergyOrig = (String)origMol.getProperty("BondEnergy");
			if (bondEnergyOrig != null)
			{
                var sumEnergy = Convert.ToDouble(bondEnergyOrig, CultureInfo.InvariantCulture) + bondEnergy;
				props.put("BondEnergy", sumEnergy.ToString(CultureInfo.InvariantCulture));
			}
			else
			{
				props.put("BondEnergy", bondEnergy.ToString(CultureInfo.InvariantCulture));
			}

			mol.setProperties(props);
			return mol;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:26,代码来源:Fragmenter.cs


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