This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.cluster.bicluster import SpectralCoclustering | |
spec = SpectralCoclustering(18) | |
cluster_counts_subset = np.vstack([cluster_counts[:31, :], cluster_counts[32:,:]]) | |
spec.fit(cluster_counts + 0.0001) | |
row_labels = spec.row_labels_ | |
column_labels = spec.column_labels_ | |
row_order = np.argsort(row_labels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# makes an svg bingo board | |
import svgwrite | |
def text_to_font_size(text): | |
if isinstance(text, str): | |
total_text = text | |
else: | |
total_text = ''.join(text) | |
if len(total_text) < 10: | |
return 18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# merge DGE matrices from multiple runs of split-seq | |
# joins on genes... | |
import os | |
import sys | |
import numpy as np | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run using 'nohup sh run_split_seq.sh &' | |
nohup split-seq all --fq1 Matthew_77_S1_R1_001.fastq.gz --fq2 Matthew_77_S1_R2_001.fastq.gz --output_dir output --chemistry v2 --genome_dir /data/reference_genomes/mm10/ --nthreads 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in $(seq 1 18); do | |
aws s3 cp --recursive s3://sdfas/S${i}_L1_outputDGE_filtered S${i}_L1_outputDGE_filtered | |
aws s3 cp --recursive s3://sdfas/S${i}_L2_outputDGE_filtered S${i}_L2_outputDGE_filtered | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# kills all gunicorn processes with 8889 | |
pids=`ps ax | grep gunicorn | grep "8889" | awk '{split($0,a," "); print a[1]}'` | |
# TODO | |
for pid in $pids; do | |
killall -9 $pid | |
echo "killed gunicorn process $pid" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for var in "$@"; do | |
filename=${var%.*} | |
#echo $filename | |
#echo $@ | |
echo writing to $filename.html | |
pandoc $var --self-contained --toc -c /home/yjzhang/Dropbox/Notes/buttondown.css -s --mathml -o $filename.html | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(l): | |
output = [] | |
for x in l: | |
try: | |
output += flatten(x) | |
except: | |
output.append(x) | |
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TrieNode(object): | |
def __init__(self, char = '', children = {}, parent = None, wordEnd = False, value = True): | |
self.char = char | |
self.children = children | |
self.parent = parent | |
self.wordEnd = wordEnd | |
self.value = value | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple implementation of quantile normalization? | |
import numpy as np | |
def quantile_norm(data): | |
""" | |
Source: https://en.wikipedia.org/wiki/Quantile_normalization | |
Note: this doesn't deal with ties very well. | |
Args: |