Skip to content

Instantly share code, notes, and snippets.

View philippmuench's full-sized avatar

Philipp Münch philippmuench

View GitHub Profile
@philippmuench
philippmuench / shell.sh
Last active May 15, 2017 15:04
commonly used docker commands
# cleanup all docker files on your system
sudo docker stop $(docker ps -a -q)
sudo docker rm $(docker ps -a -q)
sudo docker rmi `docker images -a -q`
# build container from github
docker build -t eden github.com/philippmuench/eden
# bild container locally
docker build --rm=true -t eden .
@philippmuench
philippmuench / Dockerfile
Last active April 10, 2021 22:46
packrat inside docker container
# add this line to your Dockerfile (you also need to install Rbase)
RUN R -e 'install.packages("packrat" , repos="http://cran.us.r-project.org"); packrat::restore()'
@philippmuench
philippmuench / VarScan2_format_converter.py
Created February 24, 2017 12:21 — forked from PoisonAlien/VarScan2_format_converter.py
Takes output file generated by VarScan2 somatic programme and converts the formats.
__author__ = "Anand M"
'''
Takes output file generated by VarScan2 somatic programme and converts the formats.
'''
import argparse, math, re
parser = argparse.ArgumentParser(
description="Converts VarScan2 somatic vcf to native format and vice-versa.\nInput is automatically detected")
@philippmuench
philippmuench / eden_without_gui.sh
Last active August 7, 2017 14:24
How to run EDEN without GUI
### description to run EDEN without the GUI, please be aware that some check routines are implemented inside the GUI and thus will not applied to the data (for example the check for validity of input files)
### commands that must be executed inside the docker container are written as `eden@4d4a16919ce0:~$ command`
# 1. run docker using the interactive mode
sudo docker run -p 80:3838 -i -t --entrypoint /bin/bash philippmuench/eden
eden@4d4a16919ce0:~$ mkdir /home/eden/data/fasta
# now the console inside the docker container should be visible `eden@4d4a16919ce0:~$`. This contains also the number of the docker instance, you should use this number for the following commands. If you get the Error "docker: Error response from daemon: driver failed programming external connectivity on endpoint jovial_jenning" please shutdown the running docker instance first. You can do this by usind `sudo docker ps` followed by 'sudo docker stop 4d4a16919ce0' (the last number is the instance ID, please use the instance ID showed a
@philippmuench
philippmuench / simulate.py
Last active October 1, 2017 19:38
simulate CRISPR sequences
#!/usr/bin/env python
import random
import sys
# space sequence characteristics
setsize_min = 2 # min number of spacer
setsize_max = 8 # max number of spacer
minlength = 30 # min length of spacer
maxlength = 40 # max length of spacer
@philippmuench
philippmuench / parse.py
Created October 3, 2017 20:53
code to parse crispr xml file
import xml.etree.ElementTree as ET
tree = ET.parse('all_crispr.xml')
root = tree.getroot()
offset = 1000
for id in root.findall("./Taxons/Taxon/Sequences/Sequence"):
refseq = id.find('RefSeq').text
for crispr in id.findall("CRISPRs"):
crispr_num = crispr.find('CRISPRCount').text
if int(crispr_num) > 0:
for name in crispr.findall("CRISPR"):
@philippmuench
philippmuench / get_proteins.sh
Last active March 6, 2018 11:08
shell script to download all proteins from taxids listed in intersection_ids.txt
#! /bin/sh
rm -rf log.txt # file where the taxid of skipped taxa will written to
max_treshold=20000
mkdir -p out
while read line; do
pyla_name=$(echo $line | awk -F';' '{print $1}' | tr -s ' ' | tr ' ' '_')
txid=$(echo $line | awk -F';' '{print $2}')
echo "processing $pyla_name"
num_found=$(esearch -db protein -query "txid$txid[Organism:exp]"\
@philippmuench
philippmuench / barplot.R
Created March 6, 2018 11:11
script to generate stacked barplot for community
# cleanup
rm(list=ls())
# load packages
require(vegan)
require(pander)
require(ggplot2)
require(ape)
library(RColorBrewer)
@philippmuench
philippmuench / run.R
Last active March 7, 2019 12:25
biomartr Linux test
install.packages("BiocManager")
BiocManager::install("Biostrings", version = "3.8")
BiocManager::install("biomaRt", version = "3.8")
install.packages("biomartr", dependencies = TRUE)
library(biomartr)
getGenome(db = "genbank", organism = "GCA_003138775.1", reference = FALSE)
@philippmuench
philippmuench / gist:59cbbd304619df1bcbf1835c1b771247
Created May 27, 2019 14:18
code for rebuttal of reviewer comments, additional Bayes analysis
n1 = 9196 # total number of lysis positive genomes
y1 = 830 # number of lyssis positive genemes among colicin B positive genomes
n2 = 303 # total number of lysis negative genomes
y2 = 20 # lysis negative genomes among colicin B positive genomes
# SIMULATION
I = 10000 # simulations
theta1 = rbeta(I, y1 + 1, (n1 - y1) + 1)
theta2 = rbeta(I, y2 + 1, (n2 - y2) + 1)
diff = theta1 - theta2 # simulated diffs