Skip to content

Instantly share code, notes, and snippets.

@markziemann
markziemann / pathways.Rmd
Created February 15, 2024 02:18
Analysis of the coverage and depth of pathway databases included in MSigDB including KEGG, Reactome and GO Biological Process
---
title: "Why use KEGG?"
author: "Mark Ziemann"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
fig_width: 7
fig_height: 7
@markziemann
markziemann / blast_example.sh
Created February 2, 2024 03:00
Run a simple BLAST workflow. Prerequisites: blast+ (NCBI), emboss, unwrap_fasta.pl
#!/bin/bash
# Download
URL="ftp://ftp.ensemblgenomes.org/pub/bacteria/release-42/fasta/bacteria_0_collection/escherichia_coli_str_k_12_substr_mg1655/cds/Escherichia_coli_str_k_12_substr_mg1655.ASM584v2.cds.all.fa.gz"
# unzip
if [[ ! -r $FA ]] ; then
wget -N $URL
gunzip -kf $FA.gz
fi
@markziemann
markziemann / rslurm_example.Rmd
Created December 30, 2023 02:16
This is an example for how to run a highly parallel job on a slurm cluster. Mostly this is a copy of the original documentation (https://cran.r-project.org/web/packages/rslurm/vignettes/rslurm.html) but with some extra options added and a lot of words removed. To use this script. Begin with module load R/4.2.3 and then open R with the R command.…
---
title: "rslurm example workflow"
author: "Mark Ziemann"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
fig_width: 7
fig_height: 7
@markziemann
markziemann / node_mon.sh
Created January 13, 2022 01:45
A simple bash script for monitoring the health of a bitcoin node running on raspberry pi
#!/bin/bash
x(){
echo "========================================================"
}
export -f x
node_dash(){
clear
echo -n "BITCOIN NODE INFO "
@markziemann
markziemann / mitopathways.R
Created October 23, 2021 03:26
Getting mitopathways into GMT format
library(rvest)
library(dplyr)
url="https://www.broadinstitute.org/files/shared/metabolism/mitocarta/human.mitocarta3.0.path_.html"
webpage <- read_html(url)
tbls <- html_nodes(webpage, "table")
---
title: "Compare DEG tools"
author: "Mark Ziemann"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
theme: cosmo
---
@markziemann
markziemann / mitch4macsue.Rmd
Created April 22, 2021 14:11
here is an Rmd script for performing integrative analysis of proteomic and methylation (array) analysis
---
title: "Macsue proteomic/methylation mitch analysis"
author: "Mark Ziemann"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
theme: cosmo
---
# unwrap_fasta.pl
# https://chk.ipmb.sinica.edu.tw/wiki/doku.php/tutorials/perl/unwrap_fasta.pl
# Read a fasta file, unwrap the sequences
# (i.e., remove all extra line breaks),
# and save the result to an output file.
my $in_file = shift;
my $out_file = shift;
my %seq_hash; # key = seq_name, value = seq;
{
# create the control data
IID <- paste("CTRL",1:20000,sep="")
ctrl <- as.data.frame(IID)
ctrl$GENO <- "AA"
ctrl[19209:19992,2] <- "AC"
ctrl[19993:20000,2] <- "CC"
ctrl$GENO <- as.factor(ctrl$GENO)
ctrl$PHENO <- "CONTROL"
# create the RA data
@markziemann
markziemann / R hierarchical clustering
Created July 9, 2020 11:42
This gist demonstrates how to perform unsupervised hierarchical clustering
library(RColorBrewer)
library(gplots)
# Generate some random data
N_SAMPLES=20
N_GENES=30
x<- matrix(data = rnorm(600), nrow = N_GENES, ncol = N_SAMPLES)
rownames(x) <- paste("genes",1:N_GENES)
colnames(x) <- paste("sample",1:N_SAMPLES)
head(x)