Skip to content

Instantly share code, notes, and snippets.

View cknoxrun's full-sized avatar

Craig Knox cknoxrun

View GitHub Profile
# Export PATH variables
export PATH="/usr/local/bin:~/.bin:$PATH"
# Nicer bash defaults
export PS1='\[\e[31;1m\][${LOGNAME}@\h]:\[\e[34m\]\w\[\e[0m\]>'
export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi'
export HISTCONTROL=erasedups # Erase duplicates
export HISTSIZE=5000 # resize history size
shopt -s histappend # append to bash_history if Terminal.app quits
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
max_allowed_packet=500M
#
# include all files from the config directory
#
namespace :redis do
namespace :flush do
desc "Flushes all redis cached moldbi views"
task :moldbi do
on roles(:db) do
execute "redis-cli KEYS \"moldbi/*\" | xargs redis-cli DEL"
end
end
desc "Flushes all redis cached moldbi resources"
Fun times!

Drug Groups

Vitamin D - Several individual compounds is_a vitamin D Often referred to as a single compound, even by DPD/FDA

Prodrug

$ ->
$('.gene-regulations').each ->
table = $(this)
source = table.data('source')
table.dataTable
processing: true
serverSide: true
ajax: source
aoColumnDefs: [
# Don't sort columns with class 'no-sort'
json.key_format! camelize: :lower
json.draw params[:draw].to_i + 1
json.records_total @total_count
json.records_filtered @filter_count
json.data do
json.array! @gene_regulations.each do |gene_regulation|
json.array! [ gene_regulation.gene_name,
bio_link_out(:genecard, gene_regulation.gene_symbol),
bio_link_out(:ncbi_gene, gene_regulation.gene_id),
gene_regulation.interaction,
# Note that this action responds to fracked up datatable parameters.
# If you need to use this for some other reason (HTML, etc), you
# might want to consider moving it into it's own method
# (datatable or something).
def index
# These are the columns, in the correct order, used by datatables
cols = [:gene_name, :gene_symbol, :gene_id, :interaction, :chromosome]
@gene_regulations =
if params[:kind] == 'up_regulated'
def self.apply!(features, ca, oxy, hy, halo, s, ni, total_atom_nr, morphology, amino_acid_derivative, bile_acid_or_alcohol)
# TODO: ca + oxy + hy == total_atom_nr does not always hold
# for fatty acids, exple given CCCCCCCC(=O)O.NN.
# Deal with this!
if features.include?('fatty-ester-head') &&
features.include_any?('pregnane-skeleton',
'cholestane-skeleton',
'androstane-skeleton',
'estrane-skeleton',
require 'java'
require 'jchem_connection'
require 'lib/jchem/lib/jchem.jar'
java_package 'search.db'
java_import 'chemaxon.jchem.db.JChemSearch'
java_import 'chemaxon.sss.SearchConstants'
java_import 'chemaxon.sss.search.JChemSearchOptions'