Skip to content

Instantly share code, notes, and snippets.

View holgerbrandl's full-sized avatar

Holger Brandl holgerbrandl

View GitHub Profile
@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,
@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 / 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 / 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 / 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())}
@holgerbrandl
holgerbrandl / gist:821313db8ecaf17134b2b3ce089eb111
Created April 24, 2018 16:05
thread dump of deadlock in org.deeplearning4j.bagofwords.vectorizer.TfidfVectorizerTest#testTfIdfVectorizer
"main@1" prio=5 tid=0x1 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.Object.wait(Object.java:502)
at org.deeplearning4j.models.word2vec.wordstore.VocabConstructor$VocabRunnable.awaitDone(VocabConstructor.java:536)
at org.deeplearning4j.models.word2vec.wordstore.VocabConstructor.buildJointVocabulary(VocabConstructor.java:221)
at org.deeplearning4j.bagofwords.vectorizer.BaseTextVectorizer.buildVocab(BaseTextVectorizer.java:53)
at org.deeplearning4j.bagofwords.vectorizer.BaseTextVectorizer.fit(BaseTextVectorizer.java:58)
at org.deeplearning4j.bagofwords.vectorizer.TfidfVectorizerTest.testTfIdfVectorizer(TfidfVectorizerTest.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
@holgerbrandl
holgerbrandl / gist:095c8eb7a486626676882c94269bc741
Created April 25, 2018 04:56
Thread dump of deadlock in org.deeplearning4j.streaming.kafka.NDArrayPublisherTests#testPublish
Full thread dump
"main@1" prio=5 tid=0x1 nid=NA waiting
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Unsafe.java:-1)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at org.apache.camel.component.seda.SedaPollingConsumer.receive(SedaPollingConsumer.java:41)
at org.apache.camel.impl.ConsumerCache.receive(ConsumerCache.java:202)