Skip to content

Instantly share code, notes, and snippets.

View yannickwurm's full-sized avatar
😜

Yannick Wurm yannickwurm

😜
View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

  1. Create authentification token on github

  2. cd to somewhere with some space.

  3. The following

ACCESS_TOKEN=theSetOfLettersAndNumbersInGithubAuthentificationToken
curl -s "https://api.github.com/orgs/wurmlab/repos?page=1&per_page=100&type=private&access_token=$ACCESS_TOKEN" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
ants_fyi <- read.table("https://bit.ly/antsofuk")
colnames(ants_fyi) <- c("genus", "species")
nrow(ants_fyi)
head(ants_fyi)
play_guess_the_genus <- function() {
ants <- read.table("https://bit.ly/antsofuk")
colnames(ants) <- c("genus", "species")
score <- 0
attempts <- 0
@yannickwurm
yannickwurm / splitreads.sh
Created November 7, 2017 16:52
fastq into 2 files, separating orphans from paired
egrep '^@' in.fq | cut -f 1 -d ' ' | sort | uniq -c > in.fq.counts
cat in.fq.counts | egrep " 1 " | ruby -pe 'gsub(/ +1 @/, "")' > in.fq.orphan_ids
cat in.fq.counts | egrep " 2 " | ruby -pe 'gsub(/ +2 @/, "")' > in.fq.paired_ids
then subseq
def parse(signalp_hash, open_reading_frames_condensed, motif)
signalp_with_seq = {}
signalp_hash.each do |id, h|
current_orf = open_reading_frames_condensed[id]
sequence = current_orf.to_s.gsub('["', '').gsub('"]', '')
sp_clv = h[0][:cut_off].to_i - 1
signalp = sequence[0,sp_clv]
seq_end = sequence[sp_clv+1, sequence.length - (sp_clv+1)]
if seq_end.match(/#{motif}/)
signalp_with_seq[id + "~- S.P. Cleavage Site: #{sp_clv}:" \
@yannickwurm
yannickwurm / gist:6931821
Created October 11, 2013 09:06
Detecting numbers of processors in ruby (old ugly code)
def YWSystemTools.number_of_processors
if RUBY_PLATFORM =~ /linux/
cpuinfo = IO.readlines("/proc/cpuinfo").delete_if{|x| x.index("processor")==nil}
return cpuinfo.length
elsif RUBY_PLATFORM =~ /darwin/
return `sysctl -n hw.logicalcpu`.to_i
elsif RUBY_PLATFORM =~ /win32/
# this works for windows 2000 or greater
require 'win32ole'
wmi = WIN32OLE.connect("winmgmts://")
('proc00001'..'proc00024').each do |processor|
threads << Thread.new(processor) do |threadid|
until commandArray.empty?
commandToRun = commandArray.pop
$log.info('running:' + commandToRun)
## %x[#{commandToRun}]
stdout = %x[#{commandToRun}]
print(stdout)
end
end
def YWSystemTools.runMultithreaded(commandArray)
# runs commands on N processors at a time - can take more jobs & launches them sequentially.
if commandArray.length > 1
$log.info("#{commandArray.length} commands to run")
elsif commandArray.length == 1
$log.warn("only one command!")
else
raise ArgumentError, 'No commands to run!'
end
@yannickwurm
yannickwurm / mergePairedReads.rb
Created August 22, 2012 14:00
Paste left read and right read from Illumina into a single megaread
#!/usr/bin/env ruby
# (copy) Yannick Wurm - google me.
# All right reserved.
help = "Usage: \n" +
" #{$0} MySequences_R1.fastq MySequences_R2.fastq > MySequences_R1R2pasted.fastq\n" +
"Joins two paired reads into a single megaread. Can be helpful for deduplication.\n" +
"The two fastq files must have reads in the same order. Some error checking is performed.\n"
@yannickwurm
yannickwurm / ants_gb.txt
Created September 29, 2015 18:23
Ants of Great Britain
# from https://en.wikipedia.org/wiki/List_of_ants_of_Great_Britain - unclear how reliable
Anergates atratulus
Camponotus sp.
Crematogaster scutellaris
Formica aquilonia
Formica cunicularia
Formica exsecta
Formica fusca
Formica lemani
Formica lugubris