Skip to content

Instantly share code, notes, and snippets.

View angelovangel's full-sized avatar
nextflow, R, shiny, shell

Angel Angelov angelovangel

nextflow, R, shiny, shell
  • Germany
View GitHub Profile
angelovangel / olefins-analysis.R
Created February 2, 2017 14:33
GCMS analysis of olefins in R (specific for Shimadzu GCMS Postrun output)
n <- as.integer(grep("Header", readLines("ASCIIData.txt")) %>% length()) # number of runs, without the system call above
ole <- readline(prompt="Enter number of olefins detected for these runs(including C30): ")
ole <- as.integer(ole)
angelovangel / linear model plot with coefficients
Last active October 29, 2017 21:56
plotting linear models plus the model coefficients
# a general function for plotting linear models
# makes plots of the data and the model plus the model coefficients
# the function takes a linear model object as argument
ggplotLM <- function(fit) {
angelovangel / Using models from the drc package with ggplot
Last active June 23, 2023 13:43
Using models from the drc package (for dose-response curves) with ggplot
# the aim is to use the 'drc' package to fit models to data and then extract the data and use for plotting in ggplot
# the data could be growth curves, dose-response, Michaelis-Menten etc.
# here, the S.alba data from drc is used for dose-response
attach(S.alba) # the data used in this gist
angelovangel / do_drm.R
Last active January 23, 2024 11:36
Fit dose-response models (with drc) and plot, for many samples
# these two functions perform the following:
# do_drm() --> performs drm (from the drc package) on a long dataframe, using the LL.4 log-logistic model for describing dose-response relationships
# do_drm_plot() --> plots the output of do_drm()
# to use the functions just paste this file in your R session and source it.
# try it out with
# do_drm(S.alba, Dose, DryMatter, Herbicide) %>% do_drm_plot(ed50 = TRUE, color = ~Herbicide) + scale_x_log10()
# do_drm() usage
# do_drm(df, d, r, x, y, ...)
angelovangel / FACS data plotting (geom_hex)
Last active June 23, 2023 13:43
FACS data plotting
# this code is about
# reading fcs files (from FACS) and converting them to one dataframe
# plotting is then done normally in ggplot
# installation instructions for the required libraries can be found on the internet:)
### this function reads a fcs file and returns the data as a tibble, adding a column with the file name #####
angelovangel / Leaflet-R-hotline-demo.R
Last active March 27, 2021 09:34
Leaflet hotline demo
# demonstrate Leaflet.hotline JS plugin in leaflet for R
# the Leaflet.hotline plugin has to be locally downloaded
angelovangel /
Last active February 12, 2020 20:56
SI prefixes with printf

In ksh only (not in bash), this just works:

printf '%#d\n' 105000000

Even this!!!

angelovangel /
Last active March 26, 2021 16:20
checksum many files
Generate checksums for many files in a directory
# make checksums (use md5 on macos)
find ./some_dir -type f -exec md5sum {} \; >> checksums.md5
# check them
md5sum -c checksums.md5
# use gnu parallel for really many files? Much faster
angelovangel /
Created September 12, 2023 13:34 — forked from rragundez/
Template of bash script with mandatory and optional arguments
set -e
usage="$(basename "$0") [-h] [-i PROJECT] [-v VM] [-p PYTHON] [-d NOTEBOOKS]
Make a user provide SSH key and jupyter notebooks (in roles/bootstrap/files/notebooks) to each user listed in var/common.yml
-h show this help text
-i google cloud project id
-v name of instance/virtual machine
-p python path