Skip to content

Instantly share code, notes, and snippets.

View tomsing1's full-sized avatar

Thomas Sandmann tomsing1

View GitHub Profile
##' Make a VRanges object from a GRanges object
##'
##' makeVRangesFromDataFrame takes a \code{\linkS4class{GenomicRanges}} object as input and tries to find the specified columns required by the \code{\link{VRanges}} constructor.
##' @param gr \code{\linkS4class{GenomicRanges}} object
##' @param ... Additional arguments passed on to the \code{\link{VRanges}} constructor function.
##' @return \code{\linkS4class{VRanges}} object
##' @importFrom VariantAnnotation VRanges
##' @importFrom GenomicRanges makeGRangesFromDataFrame
##' @importMethodsFrom S4Vectors mcols
##' @importMethodsFrom GenomeInfoDb seqinfo
@tomsing1
tomsing1 / rnaseq_qc_results.txt
Created February 1, 2016 16:20
Example of a qualimap RNAseq report for paired-end data
RNA-Seq QC report
-----------------------------------
>>>>>>> Input
bam file = /tmp/07122375.bam
gff file = /mnt/annotation.gtf
counting algorithm = uniquely-mapped-reads
protocol = strand-specific-forward
@tomsing1
tomsing1 / accession2url.R
Created November 1, 2016 21:29 — forked from mikelove/accession2url.R
ENA accession to URL
accession2url <- function(x) {
prefix <- "ftp://ftp.sra.ebi.ac.uk/vol1/fastq"
dir1 <- paste0("/",substr(x,1,6))
dir2 <- ifelse(nchar(x) == 9, "",
ifelse(nchar(x) == 10, paste0("/00",substr(x,10,10)),
ifelse(nchar(x) == 11, paste0("/0",substr(x,10,11)),
paste0("/",substr(x,10,12)))))
paste0(prefix,dir1,dir2,"/",x)
}
@tomsing1
tomsing1 / weblogo.md
Last active November 24, 2016 15:32
Generating sequence logo from position frequency matrices with Weblogo / RWeblogo

WebLogo3

The weblogo3 website accepts motifs in many different formats, most of which represent the alignmed motifs themselves (eg fasta format). It is also possible to submit a position-specific score matrix (PSSM) in Transfac format. This format is also accepted by the RWebLogo::weblogo R function.

For conversion between many different motif formats, the

@tomsing1
tomsing1 / cfnCluster_introdution.md
Last active January 23, 2019 00:43
Introduction to provision HPCs on AWS with cfnCluster
@tomsing1
tomsing1 / bcbio_installation_on_aws.md
Last active May 28, 2019 14:23
Notes on installing bcbio on AWS instances

bcbio

A python toolkit providing best-practice pipelines for fully automated high throughput sequencing analysis. You write a high level configuration file specifying your inputs and analysis parameters. This input drives a parallel pipeline that handles distributed execution, idempotent processing restarts and safe transactional steps.

bcbio logo

Installation

@tomsing1
tomsing1 / docker_machine.md
Last active December 2, 2016 21:39
Experimenting with docker machine on AWS
@tomsing1
tomsing1 / listviewer.R
Created January 16, 2017 17:23
Exploring R lists with listviewer
# install the release version from CRAN
install.packages(c("listviewer", "wesanderson"))
library(listviewer)
library(wesanderson)
# explore the color palettes included in the wesanderson package
jsonedit(wes_palettes)
@tomsing1
tomsing1 / spurious_correlation.R
Last active February 15, 2017 18:27
R script demonstrating how spurious correlations between two variables can be introduced by common normalization factor
# Create 3 random vectors of length 50
# We use human / mouse gene symbols to illustrate that this
# reflects commonly used procedures in biomedical science,
# e.g. the analysis of qPCR results with a single
# reference gene.
# See MIQE guidelines on how to normalize properly:
# https://www.ncbi.nlm.nih.gov/pubmed/19246619
Il6 <- rnorm(mean = 10, n = 50)
Il1b <- rnorm(mean = 10, n = 50)
Gapdh <- rnorm(mean = 10, sd = 3, n = 50)
@tomsing1
tomsing1 / forcats_ifelse_mutate.R
Created March 19, 2017 00:13
Change factor levels conditionally using dplyr and forcats
library(dplyr)
library(forcats)
# encode the 'Month' column of the 'airquality' dataset as a factor
airquality2 <- airquality %>%
dplyr::mutate(
Month = factor(Month),
Month = forcats::fct_recode(Month, May = "5", June = "6", July = "7",
August = "8", September = "9")
)