Hi Martin,
looks interesting.
A similar implementation in the SMSD might be of interest to you too.
https://github.com/asad/SMSD/blob/master/src/cmd/SMSDcmd.java
Look for nMCS method
public static void runNMCS
Cheers,
Asad
On 8 Sep 2011, at 13:03, [email protected] wrote:
> Send Cdk-user mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/cdk-user
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cdk-user digest..."
>
>
> Today's Topics:
>
> 1. How to compute MCS for multiple molecules (Martin Guetlein)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 8 Sep 2011 12:14:57 +0200
> From: Martin Guetlein <[email protected]>
> Subject: [Cdk-user] How to compute MCS for multiple molecules
> To: [email protected]
> Message-ID:
> <CANjGdQJ0FabJNQ6Xo3uUqKV4OE+sDZoCWBL3G=xkwsv-8-v...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> I wanted to contribute sth (instead of just sending bugs and feature
> requests): here is how I used UniversalIsomorphismTester.getOverlaps to
> compute the MCS for more than just 2 Molecules (runtime is of course
> O(n^2)).
> (I hope its not yet included in CDK, havent found it, though).
>
> Best regards,
> Martin
>
> org.openscience.cdk.isomorphism.MultiMCSComputer
> [[[
> package org.openscience.cdk.isomorphism;
>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Comparator;
> import java.util.List;
>
> import org.openscience.cdk.Molecule;
> import org.openscience.cdk.exception.CDKException;
> import org.openscience.cdk.interfaces.IAtomContainer;
> import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
>
> public class MultiMCSComputer
> {
> public static IAtomContainer computeMCS(IAtomContainer mols[]) throws
> CDKException
> {
> // sort according to number of atoms in ascending order to reduce
> computational effort
> Arrays.sort(mols, new Comparator<IAtomContainer>()
> {
> @Override
> public int compare(IAtomContainer o1, IAtomContainer o2)
> {
> return new Integer(o1.getAtomCount()).compareTo(new
> Integer(o2.getAtomCount()));
> }
> });
>
> List<IAtomContainer> candidates = new ArrayList<IAtomContainer>();
> // iterate over compounds
> for (IAtomContainer mol : mols)
> {
> mol = new
> Molecule(AtomContainerManipulator.removeHydrogens(mol));
> if (candidates.size() == 0)
> {
> // if == first compound, add compound to candidates
> candidates.add(mol);
> }
> else
> {
> // else compute mcs of all candidates with this compound,
> use results as new candidates
> List<IAtomContainer> newCandiates = new
> ArrayList<IAtomContainer>();
> for (IAtomContainer can : candidates)
> {
> List<IAtomContainer> canMCS =
> UniversalIsomorphismTester.getOverlaps(can, mol);
> for (IAtomContainer m : canMCS)
> if (m.getAtomCount() > 0)
> newCandiates.add(m);
> }
> candidates = newCandiates;
> if (candidates.size() == 0)
> return null;
> }
> }
> IAtomContainer max = null;
> for (IAtomContainer mol : candidates)
> if (max == null || mol.getAtomCount() > max.getAtomCount())
> max = mol;
> return max;
> }
> }
> ]]]
>
>
>
> --
> Dipl-Inf. Martin G?tlein
> Phone:
> +49 (0)761 203 7633 (office)
> +49 (0)177 623 9499 (mobile)
> Email:
> [email protected]
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops? How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
>
> ------------------------------
>
> _______________________________________________
> Cdk-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>
> End of Cdk-user Digest, Vol 64, Issue 6
> ***************************************
------------------------------------------------------------------------------
Why Cloud-Based Security and Archiving Make Sense
Osterman Research conducted this study that outlines how and why cloud
computing security and archiving is rapidly being adopted across the IT
space for its ease of implementation, lower cost, and increased
reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user