Skip to content

Instantly share code, notes, and snippets.

View soh-i's full-sized avatar

Soh Ishiguro soh-i

View GitHub Profile
@soh-i
soh-i / hoge.R
Created July 31, 2024 21:19
ggplot with lockticks (version 3.5.1)
...
scale_y_log10(
guide = guide_axis_logticks(long = 1.5, mid = 1.0, short = 0.5),
breaks = c(0.001, 0.01, 0.1, 1.00), limits = c(0.001, 1), expand = c(0, 0)
) +
scale_x_log10(
guide = guide_axis_logticks(long = 1.5, mid = 1.0, short = 0.5),
breaks = c(0.001, 0.01, 0.1, 1.00), limits = c(0.001, 1), expand = c(0, 0)
) +
...
@soh-i
soh-i / gg.R
Created January 5, 2024 22:03
ggplot with nice log ticks
LINE.W <- 0.232 # 0.5pt
breaks_log10 <- function(x) {
low <- floor(log10(min(x)))
high <- ceiling(log10(max(x)))
10^(seq.int(low, high))
}
... scale_y_log10(
limits = c(1e-3, 10),
@soh-i
soh-i / merge_fcs.R
Created March 16, 2022 19:25
Merge multiple FCS files into a single fcs file
# premessa::concatenate_fcs_files
# modified based on the following code:
# https://rdrr.io/github/ParkerICI/premessa/src/R/fcs_io.R
update_flowFrame_keywords <- function(flowFrame, exprs.m, desc = NULL, data.range = "data") {
params <- flowCore::parameters(flowFrame)
pdata <- flowCore::pData(params)
if (is.null(desc)) {
desc <- colnames(exprs.m)
@soh-i
soh-i / dyna_gates.R
Created February 24, 2022 02:50
Generate dynamic rectangleGate object with flowCore and flowWorkspace
compute_dynamic_gate <- function(gs, inv.bins) {
df.stat <- data.frame()
for (min.cutoff in inv.bins) {
# Create dynamic FL1-A gate
rg_gfp <- flowCore::rectangleGate(
"FL1-A" = c(min.cutoff, Inf), "FSC-A" = c(-Inf, Inf),
filterId = "_dynamic"
)
gates <- flowWorkspace::gs_get_pop_paths(gs)
if ("/P1/_dynamic" %in% gates) {
@soh-i
soh-i / config.json
Created February 19, 2022 23:05
VScode config
{
//Theme
"workbench.colorTheme": "Monokai Dimmed",
//Editor configs
"files.autoSave": "afterDelay",
"editor.minimap.enabled": false,
"workbench.colorCustomizations": {"editorIndentGuide.background": "#00000000" }, // hide via 100% transparency.
"git.ignoreLegacyWarning": true,
"workbench.editor.enablePreview": false,
@soh-i
soh-i / gs.R
Created February 17, 2022 19:08
Get single cell expression from GatingSet object
...
sample.names <- sampleNames(gs.trans)
gs.exp.df <- data.table()
for (sample in sample.names) {
message(sprintf("Processing: %s", sample))
df <- gs_get_singlecell_expression(gs.trans, c("P1"),
threshold = FALSE, marginal = FALSE, inverse.transform = TRUE,
other.markers = c("SSC-A", "FL1-A", "FL5-A")
)[[sample]] %>%
data.table() %>%
@soh-i
soh-i / vs_knit.json
Created February 8, 2022 06:52
Knit initialized snippet for VScode
{
"init_knit": {
"prefix": "init_knit",
"body": [
"---",
"title: $1",
"author: \"Soh Ishiguro\"",
"date: \"`r Sys.Date()`\"",
"output:",
" html_document: ",
@soh-i
soh-i / template.Rmd
Created January 17, 2022 22:57
Rmarkdown template
---
title: "notebook title"
author: "Soh Ishiguro"
date: "`r Sys.Date()`"
output:
html_document:
toc: yes
toc_float: no
number_sections: yes
keep_md: yes
@soh-i
soh-i / editor.css
Created October 31, 2020 03:01
Quiver css configulations
/*
Edit this CSS file to change styles of the editor.
If you need to revert it back, use the "Reset" button.
*/
/**
* Text Cell
*/
.text-cell {
@soh-i
soh-i / sw.jl
Last active September 23, 2020 12:59
Fast Local Alignment in Julia
module main
using BioSequences
using BioAlignments
using BenchmarkTools
struct AlignmentResults
align::BioAlignments.PairwiseAlignmentResult
name::String
end