Skip to content

Instantly share code, notes, and snippets.

View jmuhlich's full-sized avatar

Jeremy Muhlich jmuhlich

  • Harvard Medical School Laboratory of Systems Pharmacology
  • Boston, MA
View GitHub Profile
@jmuhlich
jmuhlich / Columbus single cell data exploration.ipynb
Created June 15, 2017 19:02
Load single-cell data from Columbus and demonstrate some techniques for exploring and visualizing it.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmuhlich
jmuhlich / notes.md
Last active June 3, 2017 20:05
Working with Python on the Orchestra cluster

Create the venv (virtual environment)

You only need to do this one time.

module avail  # look for dev/python/3
module load dev/python/3.4.2
python -m venv ~/venv   # You can replace ~/venv with any directory if you wish

Activate the venv

Do this each time you log in, before running python code.

@jmuhlich
jmuhlich / screen data processing.ipynb
Last active May 26, 2017 19:08
Explore some snippets of code from the ramm_screening_data_processing project.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmuhlich
jmuhlich / fm_jaydebeapi.py
Created January 5, 2017 21:19
Connect to FileMaker Pro Server in Python using JDBC driver via jaydebeapi
import jaydebeapi
import pandas as pd
def cursor_to_df(cursor):
df = pd.DataFrame(cursor.fetchall())
df.columns = [d[0] for d in cursor.description]
return df
fmsHostname = 'fmprod13.med.harvard.edu'
fmFilename = 'HITS_Reagent_Tracker_2_0'
@jmuhlich
jmuhlich / sqlalchemy_subqueryload_poly.py
Last active August 15, 2016 15:44 — forked from dpwrussell/sqlalchemy_subqueryload_poly.py
SQLAlchemy Subqueryload Poly
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (relationship, sessionmaker, subqueryload,
with_polymorphic)
from sqlalchemy import create_engine, Column, String, Integer
from sqlalchemy.schema import ForeignKey
Base = declarative_base()
class A(Base):
@jmuhlich
jmuhlich / mymod.py
Created May 15, 2016 01:16
python logging minimal example
import logging
logger = logging.getLogger(__name__)
def foo(a, b):
logger.info('foo(%s, %s)', a, b)
@jmuhlich
jmuhlich / gist:cacd807cde0446fb5fad
Last active May 14, 2022 21:03
Notes on StarCluster and EC2
@jmuhlich
jmuhlich / model1.py
Last active October 1, 2015 16:12
pysb fridlyand diabetes model test
from pysb import *
Model()
Monomer('Glucose')
Monomer('Vp')
Parameter('kf', .015)
Parameter('kr', .015)
Parameter('Vsk', -18)
@jmuhlich
jmuhlich / gist:b6e349c5d80ec3897a77
Created June 3, 2015 15:56
profile top-level code with line_profiler
# Hacks to get line_profiler to profile top-level code in a script/module.
# 1. The interface only allows profiling functions, but the core profiling logic
# actually works directly with code objects. We create a new function object
# from the code at the top level of the script to profile, and call
# profile.add_function on it. This is enough to trick the bookkeeping code in
# line_profiler to include the top-level code.
# 2. Even though the entirety of the top-level code is profiled in full, the
# results printer will stop at the first function definition, class definition,
@jmuhlich
jmuhlich / dose_response.elm
Created September 5, 2014 04:38
Parametrizing perturbagen dose-response relationships
import String
import Array
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
logistic : Float -> Float -> Float -> Float -> Float -> Float
logistic x emin emax mid slope =
( (emin-emax) / (1 + ((x/mid)^slope) ) ) + emax
lcurve : Float -> Float -> Float -> Path