Skip to content

Instantly share code, notes, and snippets.

View holgerbrandl's full-sized avatar

Holger Brandl holgerbrandl

View GitHub Profile
@holgerbrandl
holgerbrandl / analyzeRK.R
Last active December 15, 2017 22:03
Analyze RunKeeper tracks with R
## Inspired by
#http://runkeeper.com/download/activity?activityId=181462294&downloadType=googleEarth
#http://cnr.lwlss.net/GarminR/
#install.packages("lubridate")
library(XML)
library(plyr)
library(lubridate)
library(stringr)
@holgerbrandl
holgerbrandl / gist:6ba45dfb3e09ddcea7b6
Last active August 29, 2015 14:01
Example for ddply numerics problem
library(plyr)
exampleData <- structure(list(movie = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "my_movie", class = "factor"),
normS1 = c(-0.00000514991529017386, 0.00000434044351014654,
0.000011374474150384, 0.00000791328447026715, 0.00000180037689006078,
-0.00000259589226008764, -0.000014779838190499, -0.0000025679794400867,
-0.0000208090073107025, -0.00000607103835020496, 0.00000872275625029448,
-0.00000428461787014465, -0.000000851341010028744, -0.00000168872561005701,
0.00000796911011026904, 0.00000787141524026574, 0.00000436835633014748,
package info.movito.ui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D;
class Toast extends JFrame {
@holgerbrandl
holgerbrandl / fasta_length_filter.kts
Last active December 1, 2016 16:26
A kscript/kotlin tool to filter fasta files by length
//DEPS de.mpicbg.scicomp:kutils:0.4
//KOTLIN_OPTS -J-Xmx5g
import de.mpicbg.scicomp.bioinfo.openFasta
import java.io.File
import kotlin.system.exitProcess
if (args.size != 2) {
System.err.println("Usage: fasta_filter <fasta> <length_cutoff>")
exitProcess(-1)

Keybase proof

I hereby claim:

  • I am holgerbrandl on github.
  • I am holgerbrandl (https://keybase.io/holgerbrandl) on keybase.
  • I have a public key ASA1uMjcmPjfn1Ii4hjNU3NRu7UTizjmBlgr89dWRgWPFAo

To claim this, I am signing this object:

@holgerbrandl
holgerbrandl / doctopt_with_wrapper.kts
Created August 10, 2017 21:41
kotlin docopt wrapper example
#!/usr/bin/env kscript
//DEPS com.offbytwo:docopt:0.6.0.20150202,log4j:log4j:1.2.14,com.github.holgerbrandl:kscript:1.2.2-SNAPSHOT
//import org.docopt.Docopt
import java.util.*
import kscript.util.DocOpt
//val args = arrayOf("hg19", "/some/where/N.bam", "/some/where/aRG.bam", "/some/where/bRG.bam")
@holgerbrandl
holgerbrandl / gist:de4d88628f98ff046a0000b80a23c4ac
Created December 1, 2017 19:36
Create build basic gralde in current directory
curl https://raw.githubusercontent.com/JetBrains/kotlin-examples/master/gradle/hello-world/build.gradle
@holgerbrandl
holgerbrandl / fastq_read_lengths.kts
Created March 9, 2018 09:57
Output read ids and corresponding read lengths for a fastq argument file
#!/usr/bin/env kscript
@file:DependsOn("de.mpicbg.scicomp:kutils:0.9.0")
import de.mpicbg.scicomp.bioinfo.openFastq
openFastq(args[0]).forEach { println(it.id+""+it.sequence.length) }
@holgerbrandl
holgerbrandl / filter_fastq_by_ids
Last active March 20, 2018 09:52
Filter fastq with id list
//DEPS de.mpicbg.scicomp:kutils:0.7
//KOTLIN_OPTS -J-Xmx10g -J-server
import de.mpicbg.scicomp.bioinfo.openFastq
import java.io.File
//val args = listOf("ID.txt", "../lanereps_pooled/s1_WT_A_R1_paired.fastq")
val filterIds = File(args[0]).readLines().map{ "@" + it}
@file:DependsOn("de.mpicbg.scicomp:kutils:0.10")
@file:KotlinOpts("-J-Xmx5g")
import de.mpicbg.scicomp.bioinfo.openFasta
import java.io.File
//val inputFasta = File("test.fasta")
val inputFasta = File(args[0])
openFasta(inputFasta).shuffled().forEach{ println(it.toEntryString())}