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
parallel::mcparallel(system('ping -i 600 www.google.com')) |
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
# from https://stackoverflow.com/questions/24117449/install-a-package-into-multiple-all-conda-environments | |
conda env list | cut -d" " -f1 | tail -n+4 | xargs -L 1 conda install YOUR_PACKAGE -n |
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
{ | |
"$schema": "vscode://schemas/color-theme", | |
"type": "dark", | |
"colors": { | |
"activityBar.background": "#2f333d", | |
"activityBar.foreground": "#d7dae0", | |
"activityBarBadge.background": "#528bff", | |
"activityBarBadge.foreground": "#f8fafd", | |
"button.background": "#528bff", | |
"diffEditor.insertedTextBackground": "#00809b33", |
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
# HEAD~1 is a single commit back, HEAD~2 is two.. | |
# Don't forget to write the full path | |
git show HEAD:all_regeneration_datasets_Sungmin/app.R |
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
for (i in seq_along(ls())) { | |
objects <- ls() | |
obj_size <- object.size(get(objects[i])) | |
cat("\n") | |
print(objects[i]) | |
if (obj_size > 1 * 10^9) { | |
print(obj_size, units = "GB") | |
} else if (obj_size > 1 * 10^6) { | |
print(obj_size, units = "MB") |
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
SeuratObjSize <- function(seurat_obj) { | |
all_slots <- slotNames(seurat_obj) | |
for (i in seq_along(all_slots)) { | |
obj_size <- object.size(slot(seurat_obj, all_slots[i])) | |
print(all_slots[i]) | |
print(obj_size, units = "MB") | |
cat("\n") | |
} |
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
# must overide default conda PS1 with "conda config --set changeps1 False' first | |
PS1='(\[\e[0;32m\]$(basename "$CONDA_DEFAULT_ENV")\[\e[m\]) \u\[\e[0;90m\]@\[\e[m\]\h '; | |
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
n_clust <- 1:(max(as.numeric(Idents(seurat_obj)))) | |
mcFindMarkers <- function(i){ | |
ident1 <- i | |
ident2 <- n_clust[n_clust != i] | |
table <- FindMarkers(seurat_obj, | |
ident.1 = ident1, ident.2 = ident2, only.pos = TRUE) | |
table$Gene.name.uniq <- rownames(table) | |
table$cluster <- rep(i, nrow(table)) | |
return(table) | |
} |
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
gg_color_hue <- function(n) { | |
hues = seq(15, 375, length = n + 1) | |
hcl(h = hues, l = 65, c = 100)[1:n] | |
} |
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
# Get size of each slot in Seurat object | |
objectSize <- function(seurat_obj) { | |
slots <- slotNames(seurat_obj) | |
for (i in 1:length(slots)) { | |
print(paste0(slots[i], " - ", class(slot(seurat_obj, slots[i])))) | |
print(object.size(slot(seurat_obj, slots[i])), units = "auto") | |
} | |
} |
NewerOlder