Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wckdouglas
wckdouglas / zshrc
Last active November 15, 2023 16:15
zshrc template with starship (how I like my zsh behaves)
# using starship: https://starship.rs/
eval "$(starship init zsh)"
# never beep
setopt NO_BEEP
# auto completion: https://dev.to/rossijonas/how-to-set-up-history-based-autocompletion-in-zsh-k7o
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
autoload -U compinit && compinit
#!/usr/bin/env python
import subprocess
from pathlib import Path
import numpy as np
import pandas as pd
import luigi
from luigi.contrib.sge import SGEJobTask # fixed SGE in this branch https://github.com/wckdouglas/luigi
from luigi.mock import MockTarget
@wckdouglas
wckdouglas / deep_DNA.py
Last active May 7, 2019 08:58
Deep-learning framework modified from DanQ model (a hybrid convolutional and recurrent deep neural network)
# load libraries
from keras import backend as K
from keras.models import Sequential, model_from_json
from keras.layers import Dense, Conv1D,\
Flatten, MaxPool1D, \
Dropout, LSTM, \
Bidirectional
from sequencing_tools.fastq_tools import reverse_complement, \
onehot_sequence_encoder
chr1 566309 566361 - GTGATT
chr1 568081 568136 + TTGAAA,TTGAAA,TTGAAA
chr1 16840712 16840773 - TACTTA
chr1 17067025 17222642 + TGGCAG
chr1 45196732 45196802 - TCGCCT
chr1 161424755 161432231 - GCGTTG
chr1 161493635 161493697 - TGGTGG
chr1 173834762 173834818 - TTGTAA
chr1 173835773 173835846 - TCCACA
chr1 204475714 204475737 + TCAAGT
@wckdouglas
wckdouglas / README.md
Last active May 14, 2023 16:44
Running deseq2 in python

I have reused the code enough to make a package out of it.

The python package is deposited at Github. with an example in Jupyter notebook.

⚠️ this gist is out-of-date, please see the diffexpr package for a maintained version of the code

@wckdouglas
wckdouglas / region_generator.py
Last active May 4, 2017 20:54
Generator function for segmenting chromosome regions
def make_regions(chromosome_length, how_many_bases_to_look_at):
start = 0
end = start + leap
while end < chromosome_length:
yield (start, end)
start = end
end = end + how_man_bases_to_look_at
yield (start, chromosome_length)
>PrefixPE/1
AATGATACGGCGACCACCGAGATCTACACGTTCAGAGTTCTACAGTCCGACGATC
>PrefixPE/2
CAAGCAGAAGACGGCATACGAGATNNNNNNGTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT
>PCR_Primer1
AATGATACGGCGACCACCGAGATCTACACGTTCAGAGTTCTACAGTCCGACGATC
>PCR_Primer1_rc
GATCGTCGGACTGTAGAACTCTGAACGTGTAGATCTCGGTGGTCGCCGTATCATT
>PCR_Primer2
CAAGCAGAAGACGGCATACGAGATNNNNNNGTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT
@wckdouglas
wckdouglas / coloring_legend_text.R
Created February 1, 2017 20:53
Given a ggplot2 plot, matching colors on legend text with the keys
library(grid)
# http://stackoverflow.com/questions/23588127/match-legend-text-color-in-geom-text-to-symbol
coloring_legend_text <- function(p){
g <- ggplotGrob(p)
names.grobs <- grid.ls(grid.force(g))$name
labels <- names.grobs[which(grepl("label", names.grobs))]
# Get the colours
# The colours are the same as the colours of the plotted points.
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content