Skip to content

Instantly share code, notes, and snippets.

@tdudgeon
tdudgeon / SimpleJetty.java
Created January 23, 2015 17:13
Trying to set ContextHandler for Jetty Camel component
package foo.examples;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ResourceHandler;
@tdudgeon
tdudgeon / CamelJettyServlet.java
Created June 24, 2015 10:29
Servlet with Camel Jetty
package foo;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;
import org.openscience.cdk.ChemFile
import org.openscience.cdk.interfaces.IAtomContainer
import org.openscience.cdk.io.ISimpleChemObjectReader
import org.openscience.cdk.io.MDLV2000Reader
import org.openscience.cdk.io.MDLV3000Reader
import org.openscience.cdk.tools.manipulator.ChemFileManipulator
String v2000 = '''
Mrv0541 02231512112D
@tdudgeon
tdudgeon / conf_gen.py
Created April 22, 2016 09:42
Conformer generation using RDKit
import sys
from rdkit import Chem
from rdkit.Chem import AllChem, TorsionFingerprints
from rdkit.ML.Cluster import Butina
def gen_conformers(mol, numConfs=100, maxAttempts=1000, pruneRmsThresh=0.1, useExpTorsionAnglePrefs=True, useBasicKnowledge=True, enforceChirality=True):
ids = AllChem.EmbedMultipleConfs(mol, numConfs=numConfs, maxAttempts=maxAttempts, pruneRmsThresh=pruneRmsThresh, useExpTorsionAnglePrefs=useExpTorsionAnglePrefs, useBasicKnowledge=useBasicKnowledge, enforceChirality=enforceChirality, numThreads=0)
return list(ids)
@tdudgeon
tdudgeon / FragnetSearch.py
Last active June 17, 2019 13:49
V1 Fragment network searching in Optibrium's Stardrop. Place these two files in the ~/Stardrop/py/fragnet directory and restart Stardrop.
#! /usr/bin/env python
"""A Python wrapper around the Informatics Matters Fragnet service REST API.
Workflow is to create a FragnetSearch instance, authenticate
and then use the FragnetSearch query methods, like search_neighbourhood(): -
fs = FragnetSearch(fragnet_url, username, password)
fs.authenticate()
fs.search_neighbourhood(...)
@tdudgeon
tdudgeon / head-setup.sh
Last active May 23, 2019 11:50
Slurm setup scripts
#!/bin/bash
# head-setup.sh
#
# Copies the configuration files and enables, but does not start the services.
# Use the services-start/stop.sh scripts to start and stop the munge and slurmd services.
set -e
echo "Copying munge key"
cp ~/slurm/munge.key /tmp/
@tdudgeon
tdudgeon / main.nf
Last active March 22, 2019 10:23
Nextflow status reporting
numbers = 0..10
// Create the log file and write something to it as soon as we can.
// The file is located in the workflow directory.
File logfile = new File('status.log')
logfile << 'MSG Workflow started\n'
// This process writes the input to a file that is fed to the second process.
// The status message is generated using the process variable named status.
process p1 {
@tdudgeon
tdudgeon / FragnetSearch.py
Created June 17, 2019 13:51
V2 Fragment network searching in Optibrium's Stardrop. Place these two files in the ~/Stardrop/py/fragnet directory and restart Stardrop.
#! /usr/bin/env python
"""A Python wrapper around the Informatics Matters Fragnet service REST API.
Workflow is to create a FragnetSearch instance, authenticate
and then use the FragnetSearch query methods, like search_neighbourhood(): -
fs = FragnetSearch(fragnet_url, username, password)
fs.authenticate()
fs.search_neighbourhood(...)
@tdudgeon
tdudgeon / rgroups.ipynb
Last active August 27, 2019 17:04
R-group molecule
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.