Skip to content

Instantly share code, notes, and snippets.

View andrewkern's full-sized avatar
💚

Andrew Kern andrewkern

💚
View GitHub Profile
@andrewkern
andrewkern / sesame-jupyter
Last active October 27, 2021 04:16
osa script for automating the opening of a remote jupyter session on sesame
#!/usr/bin/osascript
tell application "iTerm2"
tell current session of current tab of current window
write text "ssh -X $USERNAME@sesame.uoregon.edu"
# i generally like to activate a conda environment
write text "conda activate stdpopsim"
write text "jupyter lab --no-browser --port 8088"
split horizontally with default profile
end tell
tell second session of current tab of current window
@andrewkern
andrewkern / pushing_code_2_pr.sh
Created October 13, 2020 19:36
push code to a PR
# fetch the code on a PR
git fetch upstream pull/351/head:pr351
# make sure you got it
git branch -v
# switch to relevant branch
git checkout pr351
# perhaps you need to rebase against
# upstream/master cause the PR is stale
import msprime
import stdpopsim
from stdpopsim import drosophila_melanogaster
chr_str = "chr2L"
genetic_map = stdpopsim.drosophila_melanogaster.Comeron2012_dm6()
genetic_map.download()
chrom = drosophila_melanogaster.genome.chromosomes[chr_str]
@andrewkern
andrewkern / singleGeno.py
Created December 12, 2018 19:15
example of simulating single genotype matrix
import keras
import msprime
import matplotlib
import numpy as np
# generate tree sequence
ts=msprime.simulate(
Ne=0.5,
population_configurations=[
msprime.PopulationConfiguration(sample_size=1000)],
@andrewkern
andrewkern / gist:043d9bf5cf83c703e045a65640665049
Created February 9, 2018 20:02
timing replicates with msprime
import time
import msprime
now = time.clock()
theta=2
nsamp=100
m = 0.1
numReps=100
for i in list(range(numReps)):
ts = msprime.simulate(
Ne=1/2,