Skip to content

Instantly share code, notes, and snippets.

View crazyhottommy's full-sized avatar
🎯
Focusing

Ming Tang crazyhottommy

🎯
Focusing
View GitHub Profile
```{r}
library(GEOquery)
library(tidyverse)
meta<- getGEO(GEO= "GSE185507",GSEMatrix=FALSE)
```
```{r}
meta@gsms$GSM5616943@header$characteristics_ch1
```
```{r}
TAAs<- c("MSLN", "EGFR", "ERBB2", "CEACAM5", "NECTIN4", "EPCAM", "MUC16", "MUC1", "CD276",
"FOLH1", "DLL3", "VTCN1", "PROM1", "PVR", "CLDN6", "MET", "FOLR1", "TNFRSF10B", "TACSTD2")
```
```{r}
TCGAExprsAndPheno2 <- function(gene_vector, cancer_types = "all", expression_type = "TPM"){
library(recount3)
## Get all possible projects
@crazyhottommy
crazyhottommy / case_when.r
Last active March 5, 2023 04:07
R tricks
> library(dplyr)
> cars %>%
as_tibble %>%
mutate(case_code = case_when(
speed == 4 & dist == 2 ~ "this",
dist > 6 & dist == 10 ~ "is",
speed >=10 & dist >= 18 ~ "awesome"))
# A tibble: 50 × 3
@crazyhottommy
crazyhottommy / data-ggplot-evolution-vol1.r
Created September 9, 2022 18:42 — forked from z3tt/data-ggplot-evolution-vol1.r
Data for the blog post "The Evolution of a ggplot (Vol. 1)"
library(tidyverse)
df_students <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-05-07/student_teacher_ratio.csv")
df_world_tile <- readr::read_csv("https://gist.githubusercontent.com/maartenzam/787498bbc07ae06b637447dbd430ea0a/raw/9a9dafafb44d8990f85243a9c7ca349acd3a0d07/worldtilegrid.csv") %>%
mutate(
## Namibias two-digit country code is handled as `NA` - let us fix that
alpha.2 = if_else(name == "Namibia", "NA", alpha.2),
## We are going to split "Americas" into "North America" and "Sout America"
region = if_else(region == "Americas", sub.region, region),
@crazyhottommy
crazyhottommy / convert_MDS_to_Prism.r
Last active August 16, 2022 17:37
convert MDS ELISA data to Prism ready format
install.packages(c("tidyverse", "janitor", "readxl"))
library(tidyverse)
library(janitor)
library(readxl)
convert_MDS_to_Prism<- function(infile_path, sheet_range, outfile_path){
if (!file.exists(infile_path)){
stop("the input file does not exist, please check your file name!")
}
@crazyhottommy
crazyhottommy / example_modulefile.lua
Created September 15, 2021 15:41 — forked from sbamin/example_modulefile.lua
Advanced Modulefile using lua syntax
--[[
## Modulefile in lua syntax
## Author: Samir Amin
## Read about Lmod
## https://lmod.readthedocs.io/en/latest/015_writing_modules.html
## https://lmod.readthedocs.io/en/latest/050_lua_modulefiles.html
## https://lmod.readthedocs.io/en/latest/020_advanced.html
--]]
@crazyhottommy
crazyhottommy / tile_bed_file_to_bins.rmd
Last active January 19, 2021 04:45
tile bed file to same width bins
Note, bed file is 0-based, and R is 1 based. when import bed file to
R, the GRanges will add 1 in the start.
cat test.bed
chr1 1 14
chr1 14 20
chr1 30 38
```{r}
@crazyhottommy
crazyhottommy / clustered_dotplot.r
Last active March 17, 2021 21:56
clustered_dotplot
library(Seurat)
library(aplot)
library(tidyverse)
cluster_dot_plot<- function(obj, features, annotation){
p<- DotPlot(object = obj, features = features)
df<- p$data
df<- left_join(df, annotation, by =c("id" = "seurat_clusters")) %>%
mutate(id = paste0(annotation, "_", id))
@crazyhottommy
crazyhottommy / auto-insert-python.el
Created August 25, 2020 14:47 — forked from michaelmhoffman/auto-insert-python.el
Template for Python scripts
(defun new-copyright ()
"Generate new copyright string."
(format-time-string "Copyright %Y Michael M. Hoffman <michael.hoffman@utoronto.ca>"))
(define-auto-insert 'python-mode
`(
"Description: "
"#!/usr/bin/env python3.6" \n
"\"\"\"" (setq basename (buffer-file-basename)) ": " str \n
"\"\"\"" \n \n