Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Ming Tang crazyhottommy

🎯
Focusing
View GitHub Profile
@crazyhottommy
crazyhottommy / iterm2-solarized.md
Created Mar 26, 2020 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@crazyhottommy
crazyhottommy / Pkgdown deploy from Travis.md
Created Feb 13, 2020 — forked from gaborcsardi/Pkgdown deploy from Travis.md
Walkthrough: deploy a pkgdown site from Travis
View Pkgdown deploy from Travis.md

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@crazyhottommy
crazyhottommy / BSdownload.md
Created Aug 23, 2019 — forked from lh3/BSdownload.md
Download files from Illumina's BaseSpace
View BSdownload.md

References:

Steps:

  1. Follow steps 1-5 in the first link above to acquire access_token. This will take a while, but you only need to do this once. Never share this token!!
  2. Find the file you want to download. Copy the link, which looks something like: https://basespace.illumina.com/sample/9804795/files/tree/NA12878-L1_S1_L001_R1_001.fastq.gz?id=515013503. The "id" is the unique file identifier.
  3. Download the file with: wget -O filename 'https://api.basespace.illumina.com/v1pre3/files/{id}/content?access_token={token}', where {token} is from step 1 and {id} from step 2.
View rstudio_cloud_server_crash.md

download data

cd data
mkdir pbmc5k
cd pbmc5k

wget http://cf.10xgenomics.com/samples/cell-exp/3.0.2/5k_pbmc_v3/5k_pbmc_v3_filtered_feature_bc_matrix.tar.gz

tar xvzf 5k_pbmc_v3_filtered_feature_bc_matrix.tar.gz
View alevin.snk
DATASETS = ["PBMC_8K", "PBMC_4k"]
SALMON = "$BINS/salmon-0.14.0_linux_x86_64/bin/salmon"
rule all:
input: expand("quants/{dataset}/alevin/quants_mat.gz", dataset=DATASETS)
rule salmon_quant:
input:
r1 = "reads/{sample}_1.fastq",
View check_phred.sh
# https://www.biostars.org/p/63225/
FILE=VLI9_AA_S60_L008_R1_001.fastq.gz
zcat $FILE | head -n 40 | awk '{if(NR%4==0) printf("%s",$0);}' | od -A n -t u1 | awk 'BEGIN{min=100;max=0;}{for(i=1;i<=NF;i++) {if($i>max) max=$i; if($i<min) min=$i;}}END{if(max<=74 && min<59) print "Phred+33"; else if(max>73 && min>=64) print "Phred+64"; else if(min>=59 && min<64 && max>73) print "Solexa+64"; else print "Unknown score encoding";}'
@crazyhottommy
crazyhottommy / plot_aligned_series.R
Created Feb 4, 2019 — forked from tomhopper/plot_aligned_series.R
Align multiple ggplot2 graphs with a common x axis and different y axes, each with different y-axis labels.
View plot_aligned_series.R
#' When plotting multiple data series that share a common x axis but different y axes,
#' we can just plot each graph separately. This suffers from the drawback that the shared axis will typically
#' not align across graphs due to different plot margins.
#' One easy solution is to reshape2::melt() the data and use ggplot2's facet_grid() mapping. However, there is
#' no way to label individual y axes.
#' facet_grid() and facet_wrap() were designed to plot small multiples, where both x- and y-axis ranges are
#' shared acros all plots in the facetting. While the facet_ calls allow us to use different scales with
#' the \code{scales = "free"} argument, they should not be used this way.
#' A more robust approach is to the grid package grid.draw(), rbind() and ggplotGrob() to create a grid of
#' individual plots where the plot axes are properly aligned within the grid.
View simmulate_scRNAseq.md
library(splatter)
library(scater)
library(scran)
library(Seurat)
library(dplyr)

# Load the PBMC dataset https://s3-us-west-2.amazonaws.com/10x.files/samples/cell/pbmc3k/pbmc3k_filtered_gene_bc_matrices.tar.gz
pbmc.data <- Read10X(data.dir = "~/Downloads/filtered_gene_bc_matrices/hg19/")
View simplified_dendrogram_to_circlepack.R
library(tidyverse)
library(ggraph)
library(dendextend)
library(igraph)
cut_df <- function(dendrogram, height, c){
#Function to cut a dendrogram
cd <- cutree(dendrogram, h = height) %>% as.data.frame()
cd$ID <- row.names(cd)
cd <- cd %>% as_tibble()
You can’t perform that action at this time.