This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package biojava; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.vecmath.Point3d; | |
import org.biojava.bio.structure.Atom; | |
import org.biojava.bio.structure.Chain; | |
import org.biojava.bio.structure.Group; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var iter = cdk.createMoleculeIterator("/tmp/C10H16_filtered.sdf"); | |
var substructure = cdk.fromSMILES("C1CCCCC1"); | |
var filepath = "/tmp/matches.sdf"; | |
var molList = cdk.createMoleculeList(); | |
while (iter.hasNext()) { | |
var mol = cdk.create(iter.next()); | |
if (cdk.subStructureMatches(mol, substructure)) { | |
molList.add(mol); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def EnumPartitions(m, n): | |
P = {(0, 0) : 1} | |
for i in range(1, m + 1): | |
P[(i, 0)] = 0 | |
for i in range(1, m + 1): | |
for j in range(1, min(i, n) + 1): | |
if i < 2 * j: | |
P[(i, j)] = P[(i - 1, j - 1)] | |
else: | |
P[(i, j)] = P[(i - 1, j - 1)] + P[(i - j, j)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bin(x, count=8): | |
return map(lambda y: (x>>y)&1, range(count-1, -1, -1)) | |
def pvrSequenceToMatrix(X): | |
return [bin(x, len(X)) for x in X] | |
def generateAllPVRSequences(xs, X, l, n, m): | |
if l == n: | |
xs.append(X) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IChemObjectBuilder builder = | |
NoNotificationChemObjectBuilder.getInstance(); | |
public IMolecule makeCHXFragment(int hCount) { | |
IMolecule mol = builder.newMolecule(); | |
mol.addAtom(builder.newAtom("C")); | |
mol.getAtom(0).setHydrogenCount(hCount); | |
return mol; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tmp; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class Model { | |
public Map<String, Class> parameterTypes; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tmp; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
public class BaseGenerator implements IGenerator { | |
public Map<String, Class> parameterTypes; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tmp; | |
public class MyGenerator extends BaseGenerator { | |
public static final String BOND_DISTANCE = "BondDistance"; | |
public MyGenerator() { | |
super.register(BOND_DISTANCE, Double.class, 5.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.util.ArrayList; | |
import java.util.List; | |
import tmp.IGenerator; | |
import tmp.Model; | |
import tmp.MyGenerator; | |
import static tmp.MyGenerator.BOND_DISTANCE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openscience.cdk.CDKConstants; | |
import org.openscience.cdk.interfaces.IAtom; | |
import org.openscience.cdk.interfaces.IAtomContainer; | |
import org.openscience.cdk.interfaces.IBond; | |
import signature.chemistry.Molecule.BondOrder; | |
/** | |
* Adapts a CDK IAtomContainer class to a signature.chemistry.Molecule class, |