Skip to content

Instantly share code, notes, and snippets.

@inodb
inodb / parallel_sickle
Created January 16, 2014 14:10
Run sickle on paired end fastq files in parallel. The paired fastq files should be ending on _1.fastq.gz and _2.fastq.gz. The resulting files will be in the current directory with name $base.sickle.{pe1,pe2,se}.fastq. The filenames/directory structure is based on reads delivered by the sequencing facility at SciLifeLab, Sweden to the UPPMAX clus…
#!/bin/sh
parallel lib1={}';' \
lib2='$('echo {} '|' sed s/_1.fastq.gz/_2.fastq.gz/');' \
base='$('basename {} _1.fastq.gz');' \
sickle pe -f '$lib1' -r '$lib2' -t sanger \
-o '$base'.sickle.pe1.fastq \
-p '$base'.sickle.pe2.fastq \
-s '$base'.sickle.se.fastq \
::: /proj/b2010008/INBOX/A.Andersson_13_06/*/*/*_1.fastq.gz
@inodb
inodb / rightpath
Last active January 3, 2016 13:29
Get all the access rights of a file or directory. Use like rightpath /path/to/file.txt, or rightpath /path/to/directory
#!/bin/sh
rightpath() {
path=""
for d in `readlink -f $1 | tr / " "`
do
path="$path/$d"
stat -c "%A %a %U %G %n" $path
done | column -t
}
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<style>
/* BEGIN /Users/debruiji/anaconda/lib/python2.7/site-packages/bokeh/server/static/css/bokeh.min.css */
.bk-bs-container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}@media(min-width:768px){.bk-bs-container{width:750px}}@media(min-width:992px){.bk-bs-container{width:970px}}@media(min-width:1200px){.bk-bs-container{width:1170px}}.bk-bs-container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.bk-bs-row{margin-left:-15px;margin-right:-15px}.bk-bs-col-xs-1,.bk-bs-col-sm-1,.bk-bs-col-md-1,.bk-bs-col-lg-1,.bk-bs-col-xs-2,.bk-bs-col-sm-2,.bk-bs-col-md-2,.bk-bs-col-lg-2,.bk-bs-col-xs-3,.bk-bs-col-sm-3,.bk-bs-col-md-3,.bk-bs-col-lg-3,.bk-bs-col-xs-4,.bk-bs-col-sm-4,.bk-bs-col-md-4,.bk-bs-col-lg-4,.bk-bs-col-xs-5,.bk-bs-col-sm-5,.bk-bs-col-md-5,.bk-bs-col-lg-5,.bk-bs-col-xs-6,.bk-bs-col-sm-6,.bk-bs-col-md-6,.bk-bs-col-lg-6,.bk
@inodb
inodb / string-format.js
Created February 25, 2016 23:13 — forked from poxip/string-format.js
Python-like string format in JavaScript
/**
* Python-like string format function
* @param {String} str - Template string.
* @param {Object} data - Data to insert strings from.
* @returns {String}
*/
var format = function(str, data) {
var re = /{([^{}]+)}/g;
return str.replace(/{([^{}]+)}/g, function(match, val) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@inodb
inodb / mummer_duplicate_contigs
Created May 16, 2014 15:14
Map contigs against itself with MUMmer. Then find duplicate contigs
for row in $(cat nucmer.coords | awk -v OFS=, '{if ($10 == 100.00 && $11 == 100.00 && $7 == 100.00 && $12 != $13) {print $12,$13}}')
do
echo $row | tr ',' '\n' | sort | tr '\n' ',' | sed 's/,$//'
echo
done | cut -d, -f2 | sort -u > duplicatecontigs.txt
@inodb
inodb / grep_color_barcodes.sh
Created May 25, 2016 23:47
Use grep --color=always to color a file by another file of patterns. Pretty useful for sequencing analysis
color_grep_file() {
COLOR_CMD="cat $1"
echo $COLOR_CMD
local i=31;
while read line; do
echo $line
COLOR_CMD="$COLOR_CMD | GREP_COLOR='01;$i' grep --color=always -E '$line|$'"
i=$(( $i + 1 ))
done < $2
COLOR_CMD="$COLOR_CMD | less -RS"
@inodb
inodb / deletion_fastq_simulation_ensembl_api.md
Last active June 3, 2016 17:49
Generate deletions of arbitrary length in hg19 using ensembl rest api

Generate reads with deletions of arbitrary length using ensembl rest api

for del_size in 10 30 50 70 90 150 300 600
do
  chr=17
  start_pos=4126000
  read_length=100
  ens_url="http://grch37.rest.ensembl.org/sequence/region/human/"
  qual=$(python -c "print 'A'*${read_length}")
  (
@inodb
inodb / 20161012_frontend_dev_workshop.md
Last active October 12, 2016 16:52
Frontend dev workshop 20161012

20161002 Frontend dev workshop

Set up cbioportal-frontend

Check out the README at https://github.com/cBioPortal/cbioportal-frontend/ for up to date info

Try to make a component

Make a new component that show the Patient Information on a single line, instead of in a table. We would like that line to be in the PatientHeader component. You could name it PatientInline similar to SampleInline.

@inodb
inodb / gene_lengths.md
Last active December 22, 2016 17:09
Gene lengths in Jupyter notebook

Gene lenghts from ENSEMBL REST API

Use inside notebook (uses ! syntax):

import json
import pandas as pd

def get_gene_length(gene):
    gene_info = \
        !curl -s "http://grch37.rest.ensembl.org/xrefs/symbol/homo_sapiens/"{gene} -H 'Content-type:application/json' | \
 jq '.[0].id' | tr -d '"' | \