Skip to content

Instantly share code, notes, and snippets.

@tgirke
tgirke / PeakSeq.sh
Last active May 29, 2018 00:50
How to run PeakSeq
##################################################
## Create mappability file for reference genome ##
##################################################
## Thomas Girke
## Date: May 16, 2018
## PeakSeq docs:
## https://github.com/gersteinlab/PeakSeq
## http://gensoft.pasteur.fr/docs/PeakSeq/1.1/PeakSeq.readme
## Note: mappability step should be skipped in newer version of PeakSeq
@tgirke
tgirke / Jekyll_Doc_Theme.md
Last active December 8, 2022 19:28
How to set up and maintain Jekyll Documentation Theme
@tgirke
tgirke / test.R
Created October 25, 2016 20:54
delete
x <- 1:12
@tgirke
tgirke / DrugBank2SQLite.R
Last active July 28, 2023 06:17
Import DrugBank to SQLite
########################################
## Import of DrugBank Annotation Data ##
########################################
## Function to import DrugBank XML to data.frame
## Last step gives error. To debug, the following function may help.
## Note, this functions needs some major speed improvements. Ideally,
## it should be replaced with a standard XML import method.
## (1) Download
## - download DrugBank XML (https://www.drugbank.ca/releases/latest)
## - name uncompressed file 'drugbank.xml'
@tgirke
tgirke / Bioconductor_Git_Mirror.md
Last active April 15, 2020 00:36
How to maintain Bioconductor package on GitHub and keep it in sync with SVN repository on Bioconductor
#####################################
## Quality Trimming of FASTQ Reads ##
#####################################
## Author: Thomas Girke
## Last update: May 30, 2016
## Usage of below function combined with preprocessReads form systemPipeR:
# qcTrim <- "qualityTrimming(fq, phred_cutoff=20, cutoff_occurrences=1, N_cutoff=1, minreadlength=100)"
# preprocessReads(args=args, Fct=qcTrim, batchsize=100000, overwrite=TRUE, compress=TRUE)
## Arguments:
@tgirke
tgirke / gist-markdown-template.md
Last active April 4, 2023 00:51
Gist Markdown Template

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@tgirke
tgirke / appendCounter.R
Last active October 22, 2015 21:35
Append occurrence counter to entries in a character vector
############################
## appendCounter Function ##
############################
## Author: Thomas Girke
## Last update: 04-Oct-15
## Function to append occurrence counter to entries in character
## vector and return the results as named vector where the
## original data are in the same order in the data slot
## and the counting result in the name slot.
#############################
## Source R code from Gist ##
#############################
## Display code snippet as raw by pressing Raw button on top right corner of Gist
## Save URL in address bar of browser
# library(RCurl)
## (a) Source specific commit of code
# source(textConnection(getURL("https://gist.githubusercontent.com/tgirke/c26daac0f647f1732a58/raw/521292eca2d4daeab8911df2552f0c55b0e58e6b/Source_Gist_in_R")))
## (b) Source latest version of code (delete commit ID in URL after .../raw/...)
# source(textConnection(getURL("https://gist.githubusercontent.com/tgirke/c26daac0f647f1732a58/raw/Source_Gist_in_R")))
@tgirke
tgirke / test.R
Created November 18, 2012 00:31
test
my_frame[!duplicated(my_frame[,2]),] # Removes rows with duplicated values in selected column.
my_frame[my_frame$y2 > my_frame$y3,] # Prints all rows of data frame where values of col1 > col2. Comparison operators are: == (equal), != (not equal), >= (greater than or equal), etc. Logical operators are & (and), | (or) and ! (not).
x <- 0.5:10; x[x<1.0] <- -1/x[x<1.0] # Replaces all values in vector or data frame that are below 1 with their reciprocal value.
x <-data.frame(month=month.abb[1:12], AB=LETTERS[1:2], no1=1:48, no2=1:24); x[x$month == "Apr" & (x$no1 == x$no2 | x$no1 > x$no2),] # Prints all records of frame 'x' that contain 'Apr' AND have equal values in columns 'no1' and 'no2' OR have greater values in column 'no1'.
x[x[,1] %in% c("Jun", "Aug"),] # Retrieves rows with column matches specified in a query vector.
x[c(grep("\\d{2}", as.character(x$no1), perl = TRUE)),] # Possibility to print out all rows of a data frame where a regular expression matches (here all double digit values in col 'no1').
x[c(g