Skip to content

Instantly share code, notes, and snippets.

View moldach's full-sized avatar

Matthew J. Oldach moldach

View GitHub Profile
@moldach
moldach / ez-extract
Created September 21, 2017 19:38
Function to easily uncompress a variety of formats in Linux - add this to .bashrc. then run it on file (e.g. extract file.zip)
# Extracting various compression files made easy
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
@moldach
moldach / gist:552cc704ced328a0120394271404779f
Created October 2, 2019 17:42
Shapefiles and Raster of Relief do not match for Hawaii
### This method works for Switzerland and The USA (shown here, at the top) but not Hawaii (shown at the bottom)
library(sf)
library(raster)
library(dplyr)
library(ggplot2)
## USA
# download shapefile: https://catalog.data.gov/dataset/tiger-line-shapefile-2017-nation-u-s-current-state-and-equivalent-national
usa_geo <- read_sf("data/shapefiles/usa/tl_2017_us_state.shp")
@moldach
moldach / import_QC_Koh
Last active September 14, 2021 22:34
Troubleshooting QC for scRNAseq_clustering_comparison
---
title: "Import and QC of Koh data set (SRP073808)"
output: html_document
editor_options:
chunk_output_type: console
---
```{r load-packages}
suppressPackageStartupMessages({
library(MultiAssayExperiment)
@moldach
moldach / qs package for saving ggplot objects
Last active October 29, 2019 19:12
Troubleshooting bench::mark with qs::qread()
library(bench)
library(qs)
library(sf)
library(cowplot)
# load ggplot
download.file("https://www.dropbox.com/s/ao0827vayr5u3vx/hawaii_agriculture_100m_basemap.rds?raw=1" , "hawaii_agriculture_100m_basemap.rds")
hawaii <- readRDS("hawaii_agriculture_100m_basemap.rds")
# bench mark saving
@moldach
moldach / gist:d184be424098e69f2dde3599b6cba83c
Created February 5, 2020 18:21
ggtext troubleshooting
# remotes::install_github("wilkelab/ggtext")
library(tibble)
library(ggplot2)
library(dplyr)
data <- tribble(
~bactname, ~OTUname, ~name, ~value,
"Staphylococcaceae", "OTU1", "Staphylococcaceae (OTU1)", -0.5,
"Moraxella", "OTU2", "Moraxella (OTU2)", 0.5,
@moldach
moldach / r_ubuntu.sh
Last active May 6, 2020 15:13 — forked from luispuerto/r_ubuntu.sh
Install R and RStudio on Ubuntu 19.10 with essential libraries for data science. Based on pachamaltese/r_ubuntu_17_10.sh (for Ubuntu 17.10). Note: You need to make sure the default library location - /usr/local/lib/R/site-packages - is writable .
!#/bin/bash
set -o nounset # To exit when your script tries to use undeclared variables.
set -o xtrace # To trace what gets exectued (debugging).
set -e # Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs)
set -o pipefail # Causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero return value.
# Install multiple versions of python
# https://github.com/pyenv/pyenv
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
@moldach
moldach / pyenv_3.5.0_ubuntu-20.04.log
Created May 20, 2020 19:48
pyenv install 3.5.0 failing for Ubuntu 20.04 LTS
This file has been truncated, but you can view the full file.
/tmp/python-build.20200520134504.60362 ~/projects/data/celegans
/tmp/python-build.20200520134504.60362/Python-3.5.0 /tmp/python-build.20200520134504.60362 ~/projects/data/celegans
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
@moldach
moldach / Snakefile
Created May 22, 2020 18:18
Snakemake workflow
'''
This is a snakemake for variant calling workflow
-------------------
# An example run of this workflow
Usage:
snakemake --profile slurm --jobs 20
@moldach
moldach / survivor_comparison_matrix.tsv
Created May 26, 2020 23:29
Binary matrix for UpSet
Breakdancer CNVnator DeepVariant Delly GRIDSS Lumpy Manta MindTheGap NGSep Pindel Tardis
0 0 0 0 1 0 1 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 0 0 1 0 1 1 0 0 0 1
0 0 0 1 0 1 1 0 0 0 1
0 0 0 0 1 0 1 0 0 0 0
0 0 0 1 0 1 1 0 0 0 1
1 0 0 0 1 0 0 0 1 0 0
0 0 0 1 0 0 1 0 0 0 0
@moldach
moldach / fastqc_wrapper_nohup.out
Created September 22, 2020 23:01
Error log from snakemake fastqc wrapper when using --use-singularity and --use-conda on HPC
Workflow defines that rule get_vep_cache is eligible for caching between workflows (use the --cache argument to enable this).
Building DAG of jobs...
Creating conda environment https:/github.com/snakemake/snakemake-wrappers/raw/0.66.0/bio/vep/plugins/environment.yaml...
Downloading and installing remote packages.
CreateCondaEnvironmentException:
Could not create conda environment from /tmp/tmpisqd78u6.yaml:
Solving environment: ...working... failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<