Skip to content

Instantly share code, notes, and snippets.

@gilleain
gilleain / build.xml
Created March 28, 2011 13:51
running cdk build.xml from another project
<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="cdk-ant">
<target name="cdk-ant" description="build cdk">
<echo>"Building CDK"</echo>
<subant target="dist-all" buildpath="../cdk">
</subant>
</target>
</project>
@gilleain
gilleain / debug.out
Created March 28, 2011 12:27
subant debug output
Apache Ant(TM) version 1.8.2 compiled on February 28 2011
Buildfile: /Users/maclean/development/projects/SMSD/build-smsd.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.6 in: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Detected OS: Mac OS X
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> /Users/maclean/development/projects/SMSD/build-smsd.xml
Setting ro project property: ant.file.type -> file
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
@gilleain
gilleain / test.n3
Created February 8, 2011 16:54
Test N3 triples output
<het/TBD> <prop/hasAtom> <atom/TBD> .
<atom/TBD> <prop/hasH2Sig> "[B]([H][H][H][P]([O][O][O]))" .
<atom/TBD> <prop/hasAtomSymbol> "B1A" .
<atom/TBD> <prop/hasH2Sig> "[P]([B]([H][H][H])[O]([C])[O]([H])[O]([P]))" .
<atom/TBD> <prop/hasAtomSymbol> "PA" .
<atom/TBD> <prop/hasAtomID> "TBD" .
@gilleain
gilleain / test.rdf
Created February 8, 2011 15:17
Test output from null atomtype checking of PDB CIF-HET dictionary
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="http://cpt/p/" >
<rdf:Description rdf:about="http://cpt/r/">
<j.0:HET rdf:resource="http://cpt/r/TBE"/>
<j.0:HET rdf:resource="http://cpt/r/TBD"/>
</rdf:Description>
<rdf:Description rdf:about="http://cpt/r/TBD">
<j.0:hasHeight2Sig>[B]([H][H][H][P]([O][O][O]))</j.0:hasHeight2Sig>
<j.0:hasAtomSymbol>B1A</j.0:hasAtomSymbol>
@gilleain
gilleain / Extract.java
Created January 11, 2011 18:44
Method to extract substructures from atom containers
public static IAtomContainer extractSubstructure(
IAtomContainer atomContainer, int... atomIndices) throws CloneNotSupportedException {
IAtomContainer substructure = (IAtomContainer) atomContainer.clone();
int numberOfAtoms = substructure.getAtomCount();
IAtom[] atoms = new IAtom[numberOfAtoms];
for (int atomIndex = 0; atomIndex < numberOfAtoms; atomIndex++) {
atoms[atomIndex] = substructure.getAtom(atomIndex);
}
Arrays.sort(atomIndices);
IMoleculeSet molSet = makeMolSet();
Vector2d axis = new Vector2d(1.25, .5);
axis.normalize();
LinearMoleculeSetLayout layout = new LinearMoleculeSetLayout(new StandardMoleculeLayout(), 3, axis);
/**
* Layout an object.
*
* @author maclean
*
* @param <T>
*/
public interface ILayout<T> {
public enum AxisOrientation { X, Y };
AxisOrientation orientationA = AxisOrientation.Y;
AxisOrientation orientationB = AxisOrientation.X;
ILayout<IReaction> layout = new LinearReactionLayout(
new LinearMoleculeSetLayout(
new StandardMoleculeLayout(), orientationA),
new LinearMoleculeSetLayout(
new StandardMoleculeLayout(), orientationA),
2, orientationB);
public class TechnicallyJava {
public Map<Integer, Integer> zip(int[] a, int[] b) {
assert a.length == b.length;
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int i = 0; i < a.length; i++) {
map.put(a[i], b[i]);
}
return map;
}
public class ArcDrawer extends AWTDrawVisitor {
private Graphics2D g2;
public ArcDrawer(Graphics2D g) {
super(g);
this.g2 = g;
}
@Override