This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Rsamtools) | |
.cigarAlignInput <- | |
function(file, param, what) | |
{ | |
result <- readBamGappedAlignments(file, param=param) | |
names(mcols(result))[names(mcols(result)) == what] <- "what" | |
result | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(org.Hs.eg.db) | |
library(org.Mm.eg.db) | |
library(org.Dm.eg.db) | |
db <- c(Human="org.Hs.eg.db", Mouse="org.Mm.eg.db", | |
Drosophila="org.Dm.eg.db") | |
map <- lapply(db, function(elt) tryCatch({ | |
library(elt, quietly=TRUE, character.only=TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadNamespace("rtracklayer") | |
loadNamespace("XML") | |
.organismToTaxid <- function(organism=character()) | |
{ | |
## query NCBI for taxonomy ID | |
.eutils <- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils" | |
## 1. ids | |
uorganism <- unique(organism[!is.na(organism)]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## compatibility | |
if (!exists("lengths")) | |
lengths <- function(x) vapply(x, length, integer(1)) | |
## | |
## methods | |
## | |
.S4methodsForClass <- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Imports: GEOquery, Biobase | |
acc <- "GSE62944" | |
if (!file.exists(acc)) | |
GEOquery::getGEOSuppFiles(acc) | |
setwd(acc) | |
clinvar <- local({ | |
message("clinvar") | |
fl <- "GSE62944_TCGA_20_420_Clinical_Variables_7706_Samples.txt.gz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.require <- | |
function(pkg) | |
{ | |
withCallingHandlers({ | |
suppressPackageStartupMessages({ | |
require(pkg, character.only=TRUE, quietly=TRUE) | |
}) | |
}, warning=function(w) { | |
invokeRestart("muffleWarning") | |
}) || { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## dplyr compatibility | |
as.data.frame.RangedSummarizedExperiment <- | |
function(x, row.names=NULL, optional=FALSE, ...) | |
{ | |
colData <- colData(x) | |
rownames(colData) <- NULL | |
cbind(as.data.frame(rowRanges(x)[as.vector(row(x))]), | |
as.data.frame(colData[as.vector(col(x)),, drop=FALSE]), | |
sapply(assays(x), as.vector)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ascii_offset <- function() | |
setNames(33:126 - 33L, strsplit(rawToChar(as.raw(33:126)), "")[[1]]) | |
.phred2ascii_int <- | |
function(x, scheme) | |
{ | |
## See https://en.wikipedia.org/wiki/FASTQ_format#Encoding | |
ascii <- .ascii_offset() | |
switch(scheme, "Illumina 1.8+" = { | |
## L - Illumina 1.8+ Phred+33, raw reads typically (0, 41) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Query DisGeNET disease / gene database | |
#' | |
#' Based on a script by [email protected], retrieved from | |
#' http://www.disgenet.org/ds/DisGeNET/scripts/disgenet.R on 7 April, | |
#' 2016. This version is meant for interactive use within an R | |
#' session, and makes a single query to DisGeNET rather than one query | |
#' for each input symbol. | |
#' | |
#' @param input: character vector of gene or disease identifiers | |
#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geneRanges <- | |
function(db, column="ENTREZID") | |
{ | |
g <- genes(db, columns=column) | |
col <- mcols(g)[[column]] | |
genes <- granges(g)[rep(seq_along(g), elementNROWS(col))] | |
mcols(genes)[[column]] <- as.character(unlist(col)) | |
genes | |
} |
OlderNewer