Skip to content

Instantly share code, notes, and snippets.

View samuell's full-sized avatar
💻
Hacking away

Samuel Lampa samuell

💻
Hacking away
View GitHub Profile
@samuell
samuell / Snakefile
Created February 25, 2015 15:23
Testing some stuff with snakemake ...
rule rawdata:
output: '{base}.raw.fa'
shell: 'echo "ACGTTGCA" > {output}'
rule atot:
input: '{base}.fa'
output: '{base}.atot.fa'
shell: 'cat {input} | sed "s/A/T/g" > {output}'
rule ctog:
@samuell
samuell / pipes_to_subprocess.py
Created February 16, 2015 21:56
Parse a shell command with pipe characters, into a subprocess chain
import subprocess as sub
def create_pipes(cmd):
procs = {}
parts = cmd.split('|')
for i, part in enumerate(parts):
cmdparts = part.strip().split(' ')
if i == 0:
procs[i] = sub.Popen(cmdparts, stdout=sub.PIPE)
@samuell
samuell / reseqtut_lmw.py
Last active October 3, 2016 12:29
Some steps from the the Re-sequencing NGS intro tutorial [1], using Luigi workflow system [2] with the Luigi's Monkey Wrench [3] wrapper. (Refs: [1]: http://uppnex.se/twiki/do/view/Courses/NgsIntro1502/ResequencingAnalysis.html [2]: https://github.com/spotify/luigi [3]: https://github.com/samuell/luigis_monkey_wrench )
import luigi
from luigis_monkey_wrench import *
REF='human_17_v37.fasta'
INDIVIDUALS=['NA06984','NA07000']
SAMPLES=['1','2']
BASENAME='.ILLUMINA.low_coverage.17q_'
PICARDDIR='/sw/apps/bioinfo/picard/1.69/kalkyl/'
KNOWNSITES='/proj/g2014207/labs/gatk/ALL.chr17.phase1_integrated_calls.20101123.snps_indels_svs.genotypes.vcf'
# change to postgres user and open psql prompt
sudo -u postgres psql postgres
# list databases
postgres=# \l
# list roles
postgres=# \du
# create role
@samuell
samuell / MANIFEST.MF
Created October 7, 2014 16:07
Example of a minimal META-INF/MANIFEST.MF file for creating jar files
Manifest-Version: 1.0
Class-Path: some-library.jar
Main-Class: MainClass
@samuell
samuell / zoom_xfce4_terminal.sh
Created October 3, 2014 14:51
Place this in your ```~/.bash_aliases``` file.
zi() {
if [[ ! -z $1 ]]; then
steps=$1;
SIZE=`grep 'FontName' ~/.config/Terminal/terminalrc | cut -d' ' -f 2`
NEWSIZE=$((SIZE + steps))
REGEXPR='s/FontName.*/FontName=Monospace '$NEWSIZE'/g'
sed -i "$REGEXPR" ~/.config/Terminal/terminalrc
else
echo "Usage: zi [zoom steps]";
fi;
defmodule ATGCCount do
def count(sequence), do: cnt(String.to_char_list(sequence),0,0)
def cnt([65|t],at,gc), do: cnt(t,at+1,gc)
def cnt([84|t],at,gc), do: cnt(t,at+1,gc)
def cnt([71|t],at,gc), do: cnt(t,at,gc+1)
def cnt([67|t],at,gc), do: cnt(t,at,gc+1)
def cnt([62|_],at,gc), do: {at,gc}
def cnt([],at,gc), do: {at,gc}
def cnt(_,0,0), do: {0,0}
def cnt([_|t], at, gc), do: cnt(t,at,gc)
inoremap jj <ESC>
noremap <silent> <c-z> :update<CR>
inoremap <silent> <c-z> <c-[>:update<CR>
vnoremap <silent> <c-z> :<c-c>:update<CR>
noremap <c-j> 4j
noremap <c-k> 4k
noremap <c-h> 4h
noremap <c-l> 4l
vs() {
vim $1;
source $1;
}
alias eb='vs ~/.bashrc'
alias ea='vs ~/.bash_aliases'
alias ev='vim ~/.vimrc'
alias ei='vs ~/.irodsEnv'
alias l='ls -1'
alias ltr='ls -1tr'
[xubuntu ~/install/irods]$ l
irods-database-plugin-postgres-1.3.deb
irods-icat-4.0.3-64bit.deb
[xubuntu ~/install/irods]$ sudo dpkg -i *.deb
[sudo] password for xubuntu:
Selecting previously unselected package irods-database-plugin-postgres.
(Reading database ... 179210 files and directories currently installed.)
Preparing to unpack irods-database-plugin-postgres-1.3.deb ...
Unpacking irods-database-plugin-postgres (1.3) ...
Selecting previously unselected package irods-icat.