This file contains 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
lincpet = function(ssize=17) { | |
s1 = sample(letters, size=ssize, replace=FALSE) | |
s2 = sample(letters, size=ssize, replace=FALSE) | |
ssize^2/length(intersect(s1,s2)) | |
} |
This file contains 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
FROM ubuntu:18.04 | |
RUN apt-get update | |
RUN apt-get install -y wget | |
# We do things this way to keep the docker image | |
# size down. See https://nickjanetakis.com/blog/docker-tip-3-chain-your-docker-run-instructions-to-shrink-your-images | |
RUN wget http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.9.2/sratoolkit.2.9.2-ubuntu64.tar.gz \ | |
&& tar -xvzf sratoolkit.2.9.2-ubuntu64.tar.gz \ | |
&& rm sratoolkit.2.9.2-ubuntu64.tar.gz |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
libstats = function(inisess, newsess) { | |
inibase = inisess$basePkgs | |
inioth = names(inisess$otherPkgs) | |
newbase = newsess$basePkgs | |
newoth = names(newsess$otherPkgs) | |
iniatt = length(unique(c(inibase,inioth))) | |
newatt = length(unique(c(newbase,newoth))) | |
addatt = newatt-iniatt | |
inilo = names(inisess$loadedOnly) | |
newlo = names(newsess$loadedOnly) |
This file contains 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
sudo apt-get install -y accountsservice acl acpid adduser adwaita-icon-theme and ansible apparmor apport apport-symptoms apt apt-utils aspell aspell-en at at-spi2-core autoconf automake autopoint autotools-dev base-files base-passwd bash bash-completion bc bcache-tools bcc bin86 bind9-host binutils binutils-common binutils-x86-64-linux-gnu bison bridge-utils bsdmainutils bsdutils btrfs-progs btrfs-tools build-essential busybox-initramfs busybox-static byobu bzip2 bzip2-doc ca-certificates ca-certificates-java cabextract cgroupfs-mount cloud-guest-utils cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf cmake cmake-data command-not-found command-not-found-data console-setup console-setup-linux containerd coreutils cpio cpp cpp-7 cron cryptsetup cryptsetup-bin curl cwltool dash dbus dbus-user-session dbus-x11 dconf-gsettings-backend dconf-service debconf debconf-i18n debhelper debianutils default-jdk default-jdk-headless default-jre default-jre-headless default-libmysqlclient-dev desktop-base deskt |
This file contains 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
get_rslocs_38 = function(rsids = c("rs6060535", "rs56116432")) { | |
server <- "https://rest.ensembl.org" | |
ext <- "/variant_recoder/homo_sapiens" | |
r <- httr::POST(paste(server, ext, sep = ""), | |
httr::content_type("application/json"), | |
httr::accept("application/json"), | |
body = list(ids=rsids), encode="json") | |
httr::stop_for_status(r) | |
ans = rjson::fromJSON( rjson::toJSON( httr::content(r))) | |
ids = lapply(ans, "[[", "id") |
This file contains 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
# genesym is a gene symbol as a character(1) | |
# compend is a SummarizedExperiment 'like' result of HumanTranscriptomeCompendium::htx_load() | |
# stat is a function that will compute a statistic on the log(selected gene's expression+1) over samples | |
# pctile is the percentile for selecting studies | |
highly_vbl = function(genesym, compend, stat=mad, pctile=.9) { | |
stopifnot("gene_name" %in% colnames(rowData(compend))) | |
stopifnot("study_accession" %in% colnames(colData(compend))) | |
stopifnot("study_title" %in% colnames(colData(compend))) | |
ind = which(rowData(compend)$gene_name == genesym)[1] | |
if (is.na(ind)) stop("could not find genesym in compend") |
This file contains 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
#!/bin/sh | |
# original mktexpk -- make a new PK font, because one wasn't found. | |
# | |
# (If you change or delete the word `original' on the previous line, | |
# installation won't write this script over yours.) | |
# | |
# Originally written by Thomas Esser, Karl Berry, and Olaf Weber. | |
# Public domain. | |
version='$Id: mktexpk 34656 2014-07-18 23:38:50Z karl $' |
This file contains 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
# probably needs to do something to inform R that a new package is available? | |
# the code can be used but will installed.packages() work properly? | |
lib2 = function(pkgname, dry.run=TRUE, repos=BiocManager::repositories(), | |
character.only=FALSE, source_gs="gs://biocbbs_2020a/packs_3.10/", | |
target=.libPaths()[1], ...) { | |
if (!character.only) pkgname = as.character(substitute(pkgname)) | |
stopifnot(is.character(pkgname) && is.atomic(pkgname) && length(pkgname)==1) | |
# verify need | |
ino = options(no.readonly=TRUE) | |
options(repos=repos) |
This file contains 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(dplyr) | |
library(magrittr) | |
library(RCurl) | |
library(R0) | |
fetch_JHU_Data = function (as.data.frame = FALSE) | |
{ | |
csv <- getURL("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv") | |
data <- read.csv(text = csv, check.names = F) | |
names(data)[1] <- "ProvinceState" | |
names(data)[2] <- "CountryRegion" |
OlderNewer