本文整理汇总了C#中IAtomContainer.getConnectedAtomsVector方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.getConnectedAtomsVector方法的具体用法?C# IAtomContainer.getConnectedAtomsVector怎么用?C# IAtomContainer.getConnectedAtomsVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAtomContainer
的用法示例。
在下文中一共展示了IAtomContainer.getConnectedAtomsVector方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCanNeigh
/// <summary> Return the neighbours of atom <code>a</code> in canonical order with the
/// atoms that have high bond order at the front.
///
/// </summary>
/// <param name="a"> the atom whose neighbours are to be found.
/// </param>
/// <param name="container"> the AtomContainer that is being parsed.
/// </param>
/// <returns> Vector of atoms in canonical oreder.
/// </returns>
private System.Collections.IList getCanNeigh(IAtom a, IAtomContainer container)
{
System.Collections.IList v = container.getConnectedAtomsVector(a);
if (v.Count > 1)
{
SupportClass.CollectionsSupport.Sort(v, new AnonymousClassComparator(this));
}
return v;
}
示例2: parseChain
/// <summary> Parse a branch
///
/// </summary>
/// <param name="v"> Description of Parameter
/// </param>
/// <param name="buffer"> Description of Parameter
/// </param>
/// <param name="container"> Description of Parameter
/// </param>
/// <param name="parent"> Description of Parameter
/// </param>
/// <param name="chiral"> Description of Parameter
/// </param>
/// <param name="doubleBondConfiguration"> Description of Parameter
/// </param>
/// <param name="atomsInOrderOfSmiles"> Description of Parameter
/// </param>
private void parseChain(System.Collections.ArrayList v, System.Text.StringBuilder buffer, IAtomContainer container, IAtom parent, bool chiral, bool[] doubleBondConfiguration, System.Collections.ArrayList atomsInOrderOfSmiles)
{
int positionInVector = 0;
IAtom atom;
//System.out.println("in parse chain. Size of tree: " + v.size());
for (int h = 0; h < v.Count; h++)
{
System.Object o = v[h];
if (o is IAtom)
{
atom = (IAtom)o;
if (parent != null)
{
parseBond(buffer, atom, parent, container);
}
else
{
if (chiral && BondTools.isStereo(container, atom))
{
parent = (IAtom)((System.Collections.ArrayList)v[1])[0];
}
}
parseAtom(atom, buffer, container, chiral, doubleBondConfiguration, parent, atomsInOrderOfSmiles, v);
//System.out.println("in parseChain after parseAtom()");
/*
* The principle of making chiral smiles is quite simple, although the code is
* pretty uggly. The Atoms connected to the chiral center are put in sorted[] in the
* order they have to appear in the smiles. Then the Vector v is rearranged according
* to sorted[]
*/
if (chiral && BondTools.isStereo(container, atom) && container.getBond(parent, atom) != null)
{
//System.out.println("in parseChain in isChiral");
IAtom[] sorted = null;
System.Collections.IList chiralNeighbours = container.getConnectedAtomsVector(atom);
if (BondTools.isTetrahedral(container, atom, false) > 0)
{
sorted = new IAtom[3];
}
if (BondTools.isTetrahedral(container, atom, false) == 1)
{
if (container.getBond(parent, atom).Stereo == CDKConstants.STEREO_BOND_DOWN)
{
for (int i = 0; i < chiralNeighbours.Count; i++)
{
if (chiralNeighbours[i] != parent)
{
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[2] = (IAtom)chiralNeighbours[i];
}
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && !BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[1] = (IAtom)chiralNeighbours[i];
}
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == CDKConstants.STEREO_BOND_UP && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[0] = (IAtom)chiralNeighbours[i];
}
}
}
}
if (container.getBond(parent, atom).Stereo == CDKConstants.STEREO_BOND_UP)
{
for (int i = 0; i < chiralNeighbours.Count; i++)
{
if (chiralNeighbours[i] != parent)
{
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[1] = (IAtom)chiralNeighbours[i];
}
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && !BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[2] = (IAtom)chiralNeighbours[i];
}
if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == CDKConstants.STEREO_BOND_DOWN && !isBondBroken((IAtom)chiralNeighbours[i], atom))
{
sorted[0] = (IAtom)chiralNeighbours[i];
}
}
}
}
//.........这里部分代码省略.........
示例3: primeProduct
/// <summary> Calculates the product of the neighbouring primes.
///
/// </summary>
/// <param name="v">the invariance pair vector
/// </param>
private void primeProduct(System.Collections.ArrayList v, IAtomContainer atomContainer)
{
System.Collections.IEnumerator it = v.GetEnumerator();
System.Collections.IEnumerator n;
InvPair inv;
IAtom a;
long summ;
//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
while (it.MoveNext())
{
//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
inv = (InvPair)it.Current;
System.Collections.IList neighbour = atomContainer.getConnectedAtomsVector(inv.Atom);
n = neighbour.GetEnumerator();
summ = 1;
//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
while (n.MoveNext())
{
//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
a = (IAtom)n.Current;
int next = ((InvPair)a.getProperty(InvPair.INVARIANCE_PAIR)).getPrime();
summ = summ * next;
}
inv.Last = inv.Curr;
inv.Curr = summ;
}
}
示例4: getPathsOfLength
/// <summary> Get the paths starting from an atom of specified length.
/// <p/>
/// This method returns a set of paths. Each path is a <code>List</code> of atoms that
/// make up the path (ie they are sequentially connected).
///
/// </summary>
/// <param name="atomContainer">The molecule to consider
/// </param>
/// <param name="start"> The starting atom
/// </param>
/// <param name="length"> The length of paths to look for
/// </param>
/// <returns> A <code>List</code> containing the paths found
/// </returns>
public static System.Collections.IList getPathsOfLength(IAtomContainer atomContainer, IAtom start, int length)
{
System.Collections.ArrayList curPath = new System.Collections.ArrayList();
System.Collections.ArrayList paths = new System.Collections.ArrayList();
curPath.Add(start);
paths.Add(curPath);
for (int i = 0; i < length; i++)
{
System.Collections.ArrayList tmpList = new System.Collections.ArrayList();
for (int j = 0; j < paths.Count; j++)
{
curPath = (System.Collections.ArrayList)paths[j];
IAtom lastVertex = (IAtom)curPath[curPath.Count - 1];
System.Collections.IList neighbors = atomContainer.getConnectedAtomsVector(lastVertex);
for (int k = 0; k < neighbors.Count; k++)
{
System.Collections.ArrayList newPath = new System.Collections.ArrayList(curPath);
if (newPath.Contains(neighbors[k]))
continue;
newPath.Add(neighbors[k]);
tmpList.Add(newPath);
}
}
paths.Clear();
paths.AddRange(tmpList);
}
return (paths);
}
示例5: findPathBetween
private static void findPathBetween(IAtomContainer atomContainer, IAtom start, IAtom end, System.Collections.IList path)
{
if (start == end)
{
path.Add(start);
allPaths.Add(new System.Collections.ArrayList(path));
path.RemoveAt(path.Count - 1);
return;
}
if (path.Contains(start))
return;
path.Add(start);
System.Collections.IList nbrs = atomContainer.getConnectedAtomsVector(start);
//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
for (System.Collections.IEnumerator i = nbrs.GetEnumerator(); i.MoveNext(); )
{
//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
findPathBetween(atomContainer, (IAtom)i.Current, end, path);
}
path.RemoveAt(path.Count - 1);
}
示例6: stereosAreOpposite
/// <summary> Says if of four atoms connected two one atom the up and down bonds are
/// opposite or not, i. e.if it's tetrehedral or square planar. The method
/// doesnot check if there are four atoms and if two or up and two are down
///
/// </summary>
/// <param name="a"> The atom which is the center
/// </param>
/// <param name="container"> The atomContainer the atom is in
/// </param>
/// <returns> true=are opposite, false=are not
/// </returns>
public static bool stereosAreOpposite(IAtomContainer container, IAtom a)
{
System.Collections.IList atoms = container.getConnectedAtomsVector(a);
//UPGRADE_ISSUE: Class hierarchy differences between 'java.util.TreeMap' and 'System.Collections.SortedList' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
//UPGRADE_TODO: Constructor 'java.util.TreeMap.TreeMap' was converted to 'System.Collections.SortedList' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilTreeMapTreeMap'"
System.Collections.SortedList hm = new System.Collections.SortedList();
for (int i = 1; i < atoms.Count; i++)
{
hm[(double)giveAngle(a, (IAtom)atoms[0], ((IAtom)atoms[i]))] = (System.Int32)i;
}
//UPGRADE_TODO: Method 'java.util.TreeMap.values' was converted to 'System.Collections.SortedList.Values' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilTreeMapvalues'"
System.Object[] ohere = SupportClass.ICollectionSupport.ToArray(hm.Values);
int stereoOne = container.getBond(a, (IAtom)atoms[0]).Stereo;
int stereoOpposite = container.getBond(a, (IAtom)atoms[(((System.Int32)ohere[1]))]).Stereo;
if (stereoOpposite == stereoOne)
{
return true;
}
else
{
return false;
}
}
示例7: removeHydrogens
/// <summary> Produces an AtomContainer without explicit Hs but with H count from one with Hs.
/// The new molecule is a deep copy.
///
/// </summary>
/// <param name="atomContainer">The AtomContainer from which to remove the hydrogens
/// </param>
/// <returns> The molecule without Hs.
/// </returns>
/// <cdk.keyword> hydrogen, removal </cdk.keyword>
public static IAtomContainer removeHydrogens(IAtomContainer atomContainer)
{
//UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
System.Collections.IDictionary map = new System.Collections.Hashtable(); // maps original atoms to clones.
System.Collections.IList remove = new System.Collections.ArrayList(); // lists removed Hs.
// Clone atoms except those to be removed.
IMolecule mol = atomContainer.Builder.newMolecule();
int count = atomContainer.AtomCount;
for (int i = 0; i < count; i++)
{
// Clone/remove this atom?
IAtom atom = atomContainer.getAtomAt(i);
if (!atom.Symbol.Equals("H"))
{
IAtom clonedAtom = null;
try
{
clonedAtom = (IAtom)atom.Clone();
}
//UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
catch (System.Exception e)
{
// TODO Auto-generated catch block
SupportClass.WriteStackTrace(e, Console.Error);
}
clonedAtom.setHydrogenCount(0);
mol.addAtom(clonedAtom);
map[atom] = clonedAtom;
}
else
{
remove.Add(atom); // maintain list of removed H.
}
}
// Clone bonds except those involving removed atoms.
count = atomContainer.getBondCount();
for (int i = 0; i < count; i++)
{
// Check bond.
//UPGRADE_NOTE: Final was removed from the declaration of 'bond '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
IBond bond = atomContainer.getBondAt(i);
IAtom[] atoms = bond.getAtoms();
bool removedBond = false;
//UPGRADE_NOTE: Final was removed from the declaration of 'length '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
int length = atoms.Length;
for (int k = 0; k < length; k++)
{
if (remove.Contains(atoms[k]))
{
removedBond = true;
break;
}
}
// Clone/remove this bond?
if (!removedBond)
// if (!remove.contains(atoms[0]) && !remove.contains(atoms[1]))
{
IBond clone = null;
try
{
clone = (IBond)atomContainer.getBondAt(i).Clone();
}
//UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
catch (System.Exception e)
{
// TODO Auto-generated catch block
SupportClass.WriteStackTrace(e, Console.Error);
}
clone.setAtoms(new IAtom[] { (IAtom)map[atoms[0]], (IAtom)map[atoms[1]] });
mol.addBond(clone);
}
}
// Recompute hydrogen counts of neighbours of removed Hydrogens.
//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
for (System.Collections.IEnumerator i = remove.GetEnumerator(); i.MoveNext(); )
{
// Process neighbours.
//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
for (System.Collections.IEnumerator n = atomContainer.getConnectedAtomsVector((IAtom)i.Current).GetEnumerator(); n.MoveNext(); )
{
//UPGRADE_NOTE: Final was removed from the declaration of 'neighb '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
IAtom neighb = (IAtom)map[n.Current];
neighb.setHydrogenCount(neighb.getHydrogenCount() + 1);
}
}
//.........这里部分代码省略.........